Skip to content

crypto/tls: the whole http body is read, but an Unexpected EOF is return at the same time #49422

Description

@Jarvis-Zhou

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

$ go version
go1.16.6 linux/amd64

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions