Update gtcp_conn.go

This commit is contained in:
Anson
2021-08-12 10:50:46 +08:00
committed by GitHub
parent 2bd76dfdde
commit 91cd4f96f0

View File

@ -6,7 +6,7 @@ import (
"os"
"github.com/gogf/gf/net/gtcp"
"strconv"
"github.com/gogf/gf/util/gconv"
)
func main() {
@ -31,10 +31,7 @@ func main() {
// 获得页面内容长度
if contentLength == 0 && len(array) == 2 && bytes.EqualFold([]byte("Content-Length"), array[0]) {
// http 以\r\n换行需要把\r也去掉
contentLength, err = strconv.Atoi(string(array[1][:len(array[1])-1]))
if err != nil {
fmt.Println(err)
}
contentLength = gconv.Int(string(array[1][:len(array[1])-1]))
}
header = append(header, data...)
header = append(header, '\n')