diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 23:14:48 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 23:14:48 +0000 |
commit | fab9ca551a96625486fa2c5b0883186edb1bed39 (patch) | |
tree | 399ae12d8791b78968f9501d5e706f829967862e /net | |
parent | 2535a2f5393527e97a1146579d19311aa6b9ffdc (diff) | |
download | chromium_src-fab9ca551a96625486fa2c5b0883186edb1bed39.zip chromium_src-fab9ca551a96625486fa2c5b0883186edb1bed39.tar.gz chromium_src-fab9ca551a96625486fa2c5b0883186edb1bed39.tar.bz2 |
Fix a SPDY regression introduced in r39037. When we ignore certificate
errors for SPDY, we need to set |result| to OK.
Add rudimentary support for restarting a SPDY network transaction after
the user ignores a certificate error. This requires turning |use_spdy|
into a class member.
R=willchan
BUG=35108
TEST=Testing SPDY with NPN against a server with a broken certificate
should not result in an SSL certificate error page.
Review URL: http://codereview.chromium.org/651054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39508 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_network_transaction.cc | 31 | ||||
-rw-r--r-- | net/http/http_network_transaction.h | 4 |
2 files changed, 24 insertions, 11 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 4be611d..89325e0 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -158,6 +158,7 @@ HttpNetworkTransaction::HttpNetworkTransaction(HttpNetworkSession* session) using_ssl_(false), proxy_mode_(kDirectConnection), establishing_tunnel_(false), + use_spdy_(false), embedded_identity_used_(false), read_buf_len_(0), next_state_(STATE_NONE) { @@ -191,7 +192,13 @@ int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info, int HttpNetworkTransaction::RestartIgnoringLastError( CompletionCallback* callback) { if (connection_->socket()->IsConnectedAndIdle()) { - next_state_ = STATE_SEND_REQUEST; + // TODO(wtc): Should we update any of the connection histograms that we + // update in DoSSLConnectComplete if |result| is OK? + if (use_spdy_) { + next_state_ = STATE_SPDY_SEND_REQUEST; + } else { + next_state_ = STATE_SEND_REQUEST; + } } else { connection_->socket()->Disconnect(); connection_->Reset(); @@ -326,11 +333,12 @@ int HttpNetworkTransaction::Read(IOBuffer* buf, int buf_len, State next_state = STATE_NONE; // Are we using SPDY or HTTP? - if (spdy_stream_.get()) { + if (use_spdy_) { DCHECK(!http_stream_.get()); DCHECK(spdy_stream_->GetResponseInfo()->headers); next_state = STATE_SPDY_READ_BODY; } else { + DCHECK(!spdy_stream_.get()); scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); DCHECK(headers.get()); next_state = STATE_READ_BODY; @@ -786,19 +794,20 @@ int HttpNetworkTransaction::DoSSLConnectComplete(int result) { if (result == OK || IsCertificateError(result)) status = ssl_socket->GetNextProto(&proto); static const char kSpdyProto[] = "spdy"; - const bool use_spdy = (status == SSLClientSocket::kNextProtoNegotiated && - proto == kSpdyProto); + use_spdy_ = (status == SSLClientSocket::kNextProtoNegotiated && + proto == kSpdyProto); if (IsCertificateError(result)) { result = HandleCertificateError(result); // TODO(wtc): We currently ignore certificate errors for // spdy but we shouldn't. http://crbug.com/32020 - if ((result == OK || use_spdy) && - !connection_->socket()->IsConnectedAndIdle()) { - connection_->socket()->Disconnect(); - connection_->Reset(); - next_state_ = STATE_INIT_CONNECTION; - return OK; + if (use_spdy_) + result = OK; + if (result == OK && !connection_->socket()->IsConnectedAndIdle()) { + connection_->socket()->Disconnect(); + connection_->Reset(); + next_state_ = STATE_INIT_CONNECTION; + return result; } } @@ -807,7 +816,7 @@ int HttpNetworkTransaction::DoSSLConnectComplete(int result) { base::TimeDelta connect_duration = base::TimeTicks::Now() - ssl_connect_start_time_; - if (use_spdy) { + if (use_spdy_) { UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency", connect_duration, base::TimeDelta::FromMilliseconds(1), diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h index c7aec45..9a4036e 100644 --- a/net/http/http_network_transaction.h +++ b/net/http/http_network_transaction.h @@ -311,6 +311,10 @@ class HttpNetworkTransaction : public HttpTransaction { // the real request/response of the transaction. bool establishing_tunnel_; + // True if SPDY has been negotiated using the TLS next protocol negotiation + // (NPN) extension. + bool use_spdy_; + // True if we've used the username/password embedded in the URL. This // makes sure we use the embedded identity only once for the transaction, // preventing an infinite auth restart loop. |