diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-15 15:27:55 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-15 15:27:55 +0000 |
commit | b05e0ac05876e626cc85d3a59e5b8dc2b1a6d9c0 (patch) | |
tree | e9e14b819719d8a1226f8d08195d69da314d06ad /net | |
parent | ad0acc68a5ae79ace062eee99475aa2edb187c4e (diff) | |
download | chromium_src-b05e0ac05876e626cc85d3a59e5b8dc2b1a6d9c0.zip chromium_src-b05e0ac05876e626cc85d3a59e5b8dc2b1a6d9c0.tar.gz chromium_src-b05e0ac05876e626cc85d3a59e5b8dc2b1a6d9c0.tar.bz2 |
Handle unexpected connection close during SSL handshake on Mac
SSLHandlshake may return errSSLClosedGraceful error code which is
interpreted as net::OK by NetErrorFromOSStatus, but the caller code
sometimes do not check status!=noErr cases if net_error==OK,
and this can lead unexpected status in the handshake sequence
(and causes ExtensionApiTest.CrossOriginXHR failure on Mac).
BUG=29711
TEST=ExtensionApiTest.CrossOriginXHR
Review URL: http://codereview.chromium.org/500018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/socket/ssl_client_socket_mac.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc index 3aa3591d..1bf68a0 100644 --- a/net/socket/ssl_client_socket_mac.cc +++ b/net/socket/ssl_client_socket_mac.cc @@ -710,6 +710,10 @@ int SSLClientSocketMac::DoHandshakeStart() { } } + if (status == errSSLClosedGraceful) + // The server unexpectedly closed on us. + return ERR_UNEXPECTED; + int net_error = NetErrorFromOSStatus(status); if (status == noErr || IsCertificateError(net_error)) { server_cert_ = GetServerCert(ssl_context_); @@ -765,6 +769,9 @@ int SSLClientSocketMac::DoHandshakeFinish() { if (status == errSSLWouldBlock) next_handshake_state_ = STATE_HANDSHAKE_FINISH; + if (status == errSSLClosedGraceful) + return ERR_UNEXPECTED; + if (status == noErr) { completed_handshake_ = true; DCHECK(next_handshake_state_ == STATE_NONE); |