• Brad Fitzpatrick's avatar
    crypto/tls, net/http: reject HTTP requests to HTTPS server · c942191c
    Brad Fitzpatrick authored
    This adds a crypto/tls.RecordHeaderError.Conn field containing the TLS
    underlying net.Conn for non-TLS handshake errors, and then uses it in
    the net/http Server to return plaintext HTTP 400 errors when a client
    mistakenly sends a plaintext HTTP request to an HTTPS server. This is the
    same behavior as Apache.
    
    Also in crypto/tls: swap two error paths to not use a value before
    it's valid, and don't send a alert record when a handshake contains a
    bogus TLS record (a TLS record in response won't help a non-TLS
    client).
    
    Fixes #23689
    
    Change-Id: Ife774b1e3886beb66f25ae4587c62123ccefe847
    Reviewed-on: https://go-review.googlesource.com/c/143177Reviewed-by: 's avatarFilippo Valsorda <filippo@golang.org>
    c942191c
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...