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

Side by Side Diff: net/http/http_stream_parser.cc

Issue 1494813002: Fix HttpStreamParser::CanReuseConnection(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bring back removed test Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_stream_parser.h" 5 #include "net/http/http_stream_parser.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1071
1072 void HttpStreamParser::SetConnectionReused() { 1072 void HttpStreamParser::SetConnectionReused() {
1073 connection_->set_reuse_type(ClientSocketHandle::REUSED_IDLE); 1073 connection_->set_reuse_type(ClientSocketHandle::REUSED_IDLE);
1074 } 1074 }
1075 1075
1076 bool HttpStreamParser::CanReuseConnection() const { 1076 bool HttpStreamParser::CanReuseConnection() const {
1077 if (!CanFindEndOfResponse()) 1077 if (!CanFindEndOfResponse())
1078 return false; 1078 return false;
1079 if (!response_->headers || !response_->headers->IsKeepAlive()) 1079 if (!response_->headers || !response_->headers->IsKeepAlive())
1080 return false; 1080 return false;
1081 return connection_->socket() && connection_->socket()->IsConnectedAndIdle(); 1081 return connection_->socket() && connection_->socket()->IsConnected();
1082 } 1082 }
1083 1083
1084 void HttpStreamParser::GetSSLInfo(SSLInfo* ssl_info) { 1084 void HttpStreamParser::GetSSLInfo(SSLInfo* ssl_info) {
1085 if (request_->url.SchemeIsCryptographic() && connection_->socket()) { 1085 if (request_->url.SchemeIsCryptographic() && connection_->socket()) {
1086 SSLClientSocket* ssl_socket = 1086 SSLClientSocket* ssl_socket =
1087 static_cast<SSLClientSocket*>(connection_->socket()); 1087 static_cast<SSLClientSocket*>(connection_->socket());
1088 ssl_socket->GetSSLInfo(ssl_info); 1088 ssl_socket->GetSSLInfo(ssl_info);
1089 } 1089 }
1090 } 1090 }
1091 1091
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 } 1138 }
1139 1139
1140 void HttpStreamParser::ValidateStatusLine(const std::string& status_line) { 1140 void HttpStreamParser::ValidateStatusLine(const std::string& status_line) {
1141 HttpStatusLineValidator::StatusLineStatus status = 1141 HttpStatusLineValidator::StatusLineStatus status =
1142 HttpStatusLineValidator::ValidateStatusLine(status_line); 1142 HttpStatusLineValidator::ValidateStatusLine(status_line);
1143 UMA_HISTOGRAM_ENUMERATION("Net.HttpStatusLineStatus", status, 1143 UMA_HISTOGRAM_ENUMERATION("Net.HttpStatusLineStatus", status,
1144 HttpStatusLineValidator::STATUS_LINE_MAX); 1144 HttpStatusLineValidator::STATUS_LINE_MAX);
1145 } 1145 }
1146 1146
1147 } // namespace net 1147 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698