# go-tcp-http **Repository Path**: bzsome_admin/go-tcp-http ## Basic Information - **Project Name**: go-tcp-http - **Description**: 基于tcp协议实现http协议 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-11-28 - **Last Updated**: 2023-10-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # go-tcp-http 响应tcp的完整报文 可用于检查http协议的请求报文,并通过http协议响应给客户端 ## 打包编译 - linux ```shell SET CGO_ENABLED=0 SET GOOS=linux SET GOARCH=amd64 go build -o go-http main.go ``` - windows ```shell SET CGO_ENABLED=0 SET GOOS=windows SET GOARCH=amd64 go build -o go-http.exe main.go ``` ## 使用示例 - 启动go-tcp-http,监听9090端口 ./go-http -p=9090 - 使用浏览器打开http://127.0.0.1:9090 - 实际发送给9090端口的报文如下: ```http request GET /hi HTTP/1.1 Host: localhost:8080 Connection: keep-alive sec-ch-ua: "Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Accept-Encoding: gzip, deflate, br Accept-Language: zh-CN,zh;q=0.9 ``` - 响应的http报文,响应体为上诉的请求报文。即浏览器中显示的内容为上诉报文内容