Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 11366155: SSLClientSocket::IsConnected should care for internal buffers (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add unit test Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/socket/ssl_client_socket_nss.cc
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 4a26b270430862ac38bf387cd940b56bb442290e..736453c6a35e527bf2a89f8c7938102f8376fb9c 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -2677,6 +2677,7 @@ SSLClientSocketNSS::SSLClientSocketNSS(
server_bound_cert_service_(context.server_bound_cert_service),
ssl_session_cache_shard_(context.ssl_session_cache_shard),
completed_handshake_(false),
+ core_recv_eof_(false),
next_handshake_state_(STATE_NONE),
nss_fd_(NULL),
net_log_(transport_socket->socket()->NetLog()),
@@ -2870,7 +2871,9 @@ bool SSLClientSocketNSS::IsConnected() const {
// closed by the server when we send a request anyway, a false positive in
// exchange for simpler code is a good trade-off.
EnterFunction("");
- bool ret = completed_handshake_ && transport_->socket()->IsConnected();
+ bool ret = completed_handshake_ & !core_recv_eof_;
tyoshino (SeeGerritForStatus) 2012/12/14 15:13:54 why &?
Takashi Toyoshima 2012/12/21 06:39:03 Oops...
+ if (ret)
+ ret = transport_->socket()->IsConnected();
wtc 2012/12/14 22:55:14 1. Please define |ret| using a single expression:
Ryan Sleevi 2012/12/15 01:03:04 I discussed with Wan-Teh and would propose an alte
LeaveFunction("");
return ret;
}
@@ -2885,7 +2888,9 @@ bool SSLClientSocketNSS::IsConnectedAndIdle() const {
// transport_->socket()->IsConnectedAndIdle() returns the desired false
// when we receive close_notify.
EnterFunction("");
- bool ret = completed_handshake_ && transport_->socket()->IsConnectedAndIdle();
+ bool ret = completed_handshake_ & !core_recv_eof_;
tyoshino (SeeGerritForStatus) 2012/12/14 15:13:54 ditto
Takashi Toyoshima 2012/12/21 06:39:03 Done.
+ if (ret)
+ ret = transport_->socket()->IsConnectedAndIdle();
LeaveFunction("");
return ret;
}
@@ -2957,6 +2962,8 @@ int SSLClientSocketNSS::Read(IOBuffer* buf, int buf_len,
EnterFunction(buf_len);
int rv = core_->Read(buf, buf_len, callback);
+ if (rv == 0)
+ core_recv_eof_ = true;
LeaveFunction(rv);
return rv;

Powered by Google App Engine
This is Rietveld 408576698