Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: Is this a bug? Net/http is used to create an HTTP client to send a request. Instead of sending FIN packets, RST and ACK are sent when waving four times #53442

Closed
qifengzhang007 opened this issue Jun 18, 2022 · 1 comment

Comments

@qifengzhang007
Copy link

qifengzhang007 commented Jun 18, 2022

What version of Go are you using (go version)?

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Administrator\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=linux
set GOPATH=C:\Users\Administrator\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=D:\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=E:\Project\test\test_httpclient\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build3528424264=/tmp/go-build -gno-record-gcc-switches

Does this issue reproduce with the latest release?

YES

What operating system and processor architecture are you using (go env)?

centos amdx64

What did you do?

  • 1.I used the following code to create an HTTP client, send a get request, and then capture packets on the centos server.
func main() {
	resp, err := http.Get("http://49.232.145.118:20171/api/v1/portal/news?newsType=10&page=1&limit=50")
	if err != nil {
		fmt.Println(err)
		return
	}
	body, err := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
	fmt.Println(resp.StatusCode)
	if resp.StatusCode == 200 {
		fmt.Println("ok")
	}
	_ = resp.Body.Close()
}


  • 2.centos server capture packets as follows:
19:48:38.422375 IP ..8598 > VM-0-13-centos.20171: Flags [S], seq 3292284131, win 64240, options [mss 1412,nop,wscale 8,nop,nop,sackOK], length 0
19:48:38.422510 IP VM-0-13-centos.20171 > ..8598: Flags [S.], seq 314920111, ack 3292284132, win 29200, options [mss 1460,nop,nop,sackOK,nop,wscale 9], length 0
19:48:38.454949 IP ..8598 > VM-0-13-centos.20171: Flags [.], ack 1, win 512, length 0
19:48:38.455966 IP ..8598 > VM-0-13-centos.20171: Flags [P.], seq 1:180, ack 1, win 512, length 179
19:48:38.456017 IP VM-0-13-centos.20171 > ..8598: Flags [.], ack 180, win 60, length 0
19:48:38.456783 IP VM-0-13-centos.20171 > ..8598: Flags [P.], seq 1:764, ack 180, win 60, length 763

#  NOTICE next  row,Instead of sending fin, HTTP client  sends RST and ACK packets

19:48:38.500583 IP ..8598 > VM-0-13-centos.20171: Flags [R.], seq 180, ack 764, win 0, length 0


What did you expect to see?

  • 1.I want to see packets sent out like postman
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
19:47:20.999654 IP ..8542 > VM-0-13-centos.20171: Flags [S], seq 117586486, win 64240, options [mss 1412,nop,wscale 8,nop,nop,sackOK], length 0
19:47:20.999768 IP VM-0-13-centos.20171 > ..8542: Flags [S.], seq 3215054407, ack 117586487, win 29200, options [mss 1460,nop,nop,sackOK,nop,wscale 9], length 0
19:47:21.038163 IP ..8542 > VM-0-13-centos.20171: Flags [.], ack 1, win 512, length 0
19:47:21.039984 IP ..8542 > VM-0-13-centos.20171: Flags [P.], seq 1:1057, ack 1, win 512, length 1056
19:47:21.040044 IP VM-0-13-centos.20171 > ..8542: Flags [.], ack 1057, win 62, length 0
19:47:21.040933 IP VM-0-13-centos.20171 > ..8542: Flags [P.], seq 1:764, ack 1057, win 62, length 763

#NOTICE ,this  is  postman  send data  package,  it  send  FIN  

19:47:21.091855 IP ..8542 > VM-0-13-centos.20171: Flags [F.], seq 1057, ack 764, win 509, length 0
19:47:21.091999 IP VM-0-13-centos.20171 > ..8542: Flags [F.], seq 764, ack 1058, win 62, length 0
19:47:21.131111 IP ..8542 > VM-0-13-centos.20171: Flags [.], ack 765, win 509, length 0



What I don't understand

Is it golang intention that the HTTP client created by net/http did not send fin when waving four times? Or what?

I want to get a brief answer

@qifengzhang007 qifengzhang007 changed the title Is this a bug? Net/http is used to create an HTTP client to send a request. Instead of sending fin packets, RST and ACK are sent when waving four times net/http: Is this a bug? Net/http is used to create an HTTP client to send a request. Instead of sending fin packets, RST and ACK are sent when waving four times Jun 18, 2022
@qifengzhang007 qifengzhang007 changed the title net/http: Is this a bug? Net/http is used to create an HTTP client to send a request. Instead of sending fin packets, RST and ACK are sent when waving four times net/http: Is this a bug? Net/http is used to create an HTTP client to send a request. Instead of sending FIN packets, RST and ACK are sent when waving four times Jun 18, 2022
@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2022
@golang golang locked and limited conversation to collaborators Jun 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants