nss: prevent NSS from incorrectly re-using a session

Without this workaround, NSS re-uses a session cache entry despite the
server name does not match.  This causes SNI host name to differ from
the actual host name.  Consequently, certain servers (e.g. github.com)
respond by 400 to such requests.

Bug: https://bugzilla.mozilla.org/1202264
This commit is contained in:
Kamil Dudka 2015-09-18 17:10:05 +02:00
parent a9fd53887b
commit 958d2ffb19
2 changed files with 6 additions and 0 deletions

View file

@ -1806,6 +1806,10 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
if(SSL_SetURL(connssl->handle, conn->host.name) != SECSuccess)
goto error;
/* prevent NSS from re-using the session for a different hostname */
if(SSL_SetSockPeerID(connssl->handle, conn->host.name) != SECSuccess)
goto error;
return CURLE_OK;
error: