From 91cd4f96f0b9b9ad464b50c2d8de9bdc34b9e07f Mon Sep 17 00:00:00 2001 From: Anson <77931774@qq.com> Date: Thu, 12 Aug 2021 10:50:46 +0800 Subject: [PATCH] Update gtcp_conn.go --- .example/net/gtcp/gtcp_conn.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.example/net/gtcp/gtcp_conn.go b/.example/net/gtcp/gtcp_conn.go index 7cd01001e..323595751 100644 --- a/.example/net/gtcp/gtcp_conn.go +++ b/.example/net/gtcp/gtcp_conn.go @@ -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')