Skip to content

crypto/tls: Failed handshake should not send any data to client #8720

Description

@AudriusButkevicius
What does 'go version' print?

go version go1.3 windows/amd64

What steps reproduce the problem?

Snippet: http://play.golang.org/p/eu_6CStY3k

1. Run the snippet above
2. Browse to http://localhost:8181

What happened?

Depending on platform or browser different things might happen.
If the browser thinks the data looks binary, it usually starts a download.
If the data looks plain-text'ish, it outputs bytes to the browser.

What should have happened instead?

The connection should have been closed without any data sent, since it doesn't get past
the TLS handshake due to protocol mismatch.

Or alternatively, a feature specific to net/http using TLS could downgrade the protocol
to HTTP and deal with it in some way.

Please provide any additional information below.

The culprit is the following line:
https://code.google.com/p/go/source/browse/src/crypto/tls/conn.go#582

If commented out, it produces the expected "No data received" error on Chrome.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions