OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |