]> Cypherpunks repositories - gostls13.git/commit
crypto/tls: don't send IP literals as SNI values.
authorAdam Langley <agl@golang.org>
Mon, 9 Nov 2015 03:10:14 +0000 (19:10 -0800)
committerAdam Langley <agl@golang.org>
Mon, 9 Nov 2015 23:09:48 +0000 (23:09 +0000)
commita4dcc692011bf1ceca9b1a363fd83f3e59e399ee
tree91e28169c78c03656d479a885ccd52bbc7511b96
parent712ffc0861cd6ec425736422415bf650c6cb013f
crypto/tls: don't send IP literals as SNI values.

https://tools.ietf.org/html/rfc6066#section-3 states:

  “Literal IPv4 and IPv6 addresses are not permitted in "HostName".”

However, if an IP literal was set as Config.ServerName (which could
happen as easily as calling Dial with an IP address) then the code would
send the IP literal as the SNI value.

This change filters out IP literals, as recognised by net.ParseIP, from
being sent as the SNI value.

Fixes #13111.

Change-Id: Ie9ec7acc767ae172b48c9c6dd8d84fa27b1cf0de
Reviewed-on: https://go-review.googlesource.com/16742
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
src/crypto/tls/common.go
src/crypto/tls/handshake_client.go
src/crypto/tls/handshake_client_test.go