diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 19:07:28 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 19:07:28 +0000 |
commit | a85197ef8eb15f8582c54eb2bc4b34eff38dd62b (patch) | |
tree | 40838d9492469df10d99c9868f9a85dacf4f0dd7 /net | |
parent | 88fa5807ae6fb9578b47128d77fb8d6871efad12 (diff) | |
download | chromium_src-a85197ef8eb15f8582c54eb2bc4b34eff38dd62b.zip chromium_src-a85197ef8eb15f8582c54eb2bc4b34eff38dd62b.tar.gz chromium_src-a85197ef8eb15f8582c54eb2bc4b34eff38dd62b.tar.bz2 |
Prevent the infinite loop inside SSLClientSocketOpenSSL::OnSendComplete.
This ports the SSLClientSocketNSS fix in
https://chromiumcodereview.appspot.com/10382186 to SSLClientSocketOpenSSL.
R=joth@chromium.org,jnd@chromium.org
BUG=127822
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10391174
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/socket/ssl_client_socket_openssl.cc | 12 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_openssl.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index c7ed20f..55f9fbf 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -416,6 +416,7 @@ SSLClientSocketOpenSSL::SSLClientSocketOpenSSL( const SSLClientSocketContext& context) : transport_send_busy_(false), transport_recv_busy_(false), + transport_recv_eof_(false), completed_handshake_(false), client_auth_cert_needed_(false), cert_verifier_(context.cert_verifier), @@ -718,6 +719,7 @@ void SSLClientSocketOpenSSL::Disconnect() { transport_send_busy_ = false; send_buffer_ = NULL; transport_recv_busy_ = false; + transport_recv_eof_ = false; recv_buffer_ = NULL; user_connect_callback_.Reset(); @@ -955,9 +957,10 @@ X509Certificate* SSLClientSocketOpenSSL::UpdateServerCert() { bool SSLClientSocketOpenSSL::DoTransportIO() { bool network_moved = false; - int nsent = BufferSend(); - int nreceived = BufferRecv(); - network_moved = (nsent > 0 || nreceived >= 0); + if (BufferSend() > 0) + network_moved = true; + if (!transport_recv_eof_ && BufferRecv() >= 0) + network_moved = true; return network_moved; } @@ -1050,6 +1053,8 @@ void SSLClientSocketOpenSSL::TransportReadComplete(int result) { // Received 0 (end of file) or an error. Either way, bubble it up to the // SSL layer via the BIO. TODO(joth): consider stashing the error code, to // relay up to the SSL socket client (i.e. via DoReadCallback). + if (result == 0) + transport_recv_eof_ = true; BIO_set_mem_eof_return(transport_bio_, 0); (void)BIO_shutdown_wr(transport_bio_); } else { @@ -1098,6 +1103,7 @@ void SSLClientSocketOpenSSL::OnSendComplete(int result) { network_moved = DoTransportIO(); } while (rv_read == ERR_IO_PENDING && rv_write == ERR_IO_PENDING && + (user_read_buf_ || user_write_buf_) && network_moved); if (user_read_buf_ && rv_read != ERR_IO_PENDING) diff --git a/net/socket/ssl_client_socket_openssl.h b/net/socket/ssl_client_socket_openssl.h index cf3cf76..9fc1b22 100644 --- a/net/socket/ssl_client_socket_openssl.h +++ b/net/socket/ssl_client_socket_openssl.h @@ -123,6 +123,7 @@ class SSLClientSocketOpenSSL : public SSLClientSocket { bool transport_send_busy_; scoped_refptr<DrainableIOBuffer> send_buffer_; bool transport_recv_busy_; + bool transport_recv_eof_; scoped_refptr<IOBuffer> recv_buffer_; CompletionCallback user_connect_callback_; |