-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
crypto/tls: the whole http body is read, but an Unexpected EOF is return at the same time #49422
Comments
Could you provide an example of the code that produced the error, preferably as a Go playground link? |
https://play.golang.org/p/hCyV1oEl4YC , my code is just like this, very normal. But in my environment, I got an Unexpected EOF with the whole body. Then I add log print in tls/conn, I found that it will return Unexpected EOF when TLS Alert packet is not right. |
I also write my code using python or just using curl, it is ok. because they are not deal with the alert packet in body reading. |
@Jarvis-Zhou Thank you for the updated information. |
Which web server is replying with this broken TLS interrupting its response? |
It is a http server in my local environment. And I am keeping on finding out the problem why it is interrupted. |
But other language does not return this error |
Got same error, mabye this answer can solve it. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?amd64 ubuntu
What did you do?
I just send a http request and use ioutil.ReadAll to read body, all the body is read, but I got an unexpected error at the same time.
May my env is special, I use tcpdump and wareshark the trace the connection, I found that the last packet from server end with part of Alert meg 0x15 0x03 0x03, and later the server send a RST packet.
After reading golang code, I find out that after the whole body is read, we will check the alert packet. But as the alert packet is not full, will return the Unexpected EOF.
https://github.com/golang/go/blame/9e6ad46bccfa7a63e768236bcd1fd54dab38e4d1/src/crypto/tls/conn.go#L1305
What did you expect to see?
I think We should add a check here, this error show in resp.Body.Close or next read.
What did you see instead?
The text was updated successfully, but these errors were encountered: