| 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_factory_impl_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 stream_type_ = request_->stream_type(); | 250 stream_type_ = request_->stream_type(); |
| 251 StartInternal(); | 251 StartInternal(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) { | 254 int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) { |
| 255 DCHECK_GT(num_streams, 0); | 255 DCHECK_GT(num_streams, 0); |
| 256 base::WeakPtr<HttpServerProperties> http_server_properties = | 256 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 257 session_->http_server_properties(); | 257 session_->http_server_properties(); |
| 258 if (http_server_properties && | 258 if (http_server_properties && |
| 259 http_server_properties->SupportsRequestPriority( | 259 http_server_properties->SupportsRequestPriority( |
| 260 HostPortPair::FromURL(request_info_.url))) { | 260 url::SchemeHostPort(request_info_.url))) { |
| 261 num_streams_ = 1; | 261 num_streams_ = 1; |
| 262 } else { | 262 } else { |
| 263 num_streams_ = num_streams; | 263 num_streams_ = num_streams; |
| 264 } | 264 } |
| 265 return StartInternal(); | 265 return StartInternal(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 int HttpStreamFactoryImpl::Job::RestartTunnelWithProxyAuth( | 268 int HttpStreamFactoryImpl::Job::RestartTunnelWithProxyAuth( |
| 269 const AuthCredentials& credentials) { | 269 const AuthCredentials& credentials) { |
| 270 DCHECK(establishing_tunnel_); | 270 DCHECK(establishing_tunnel_); |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 | 1409 |
| 1410 if (!spdy_session->HasAcceptableTransportSecurity()) { | 1410 if (!spdy_session->HasAcceptableTransportSecurity()) { |
| 1411 spdy_session->CloseSessionOnError( | 1411 spdy_session->CloseSessionOnError( |
| 1412 ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY, ""); | 1412 ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY, ""); |
| 1413 return ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY; | 1413 return ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY; |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 SSLInfo ssl_info; | 1416 SSLInfo ssl_info; |
| 1417 bool was_npn_negotiated; | 1417 bool was_npn_negotiated; |
| 1418 NextProto protocol_negotiated; | 1418 NextProto protocol_negotiated; |
| 1419 if (spdy_session->GetProtocolVersion() >= HTTP2 && | 1419 if (spdy_session->GetSSLInfo(&ssl_info, &was_npn_negotiated, |
| 1420 spdy_session->GetSSLInfo(&ssl_info, &was_npn_negotiated, | 1420 &protocol_negotiated) && |
| 1421 &protocol_negotiated)) { | 1421 spdy_session->GetProtocolVersion() >= HTTP2) { |
| 1422 UMA_HISTOGRAM_SPARSE_SLOWLY( | 1422 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 1423 "Net.Http2SSLCipherSuite", | 1423 "Net.Http2SSLCipherSuite", |
| 1424 SSLConnectionStatusToCipherSuite(ssl_info.connection_status)); | 1424 SSLConnectionStatusToCipherSuite(ssl_info.connection_status)); |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 new_spdy_session_ = spdy_session; | 1427 new_spdy_session_ = spdy_session; |
| 1428 spdy_session_direct_ = direct; | 1428 spdy_session_direct_ = direct; |
| 1429 const HostPortPair& host_port_pair = spdy_session_key.host_port_pair(); | 1429 const HostPortPair host_port_pair = spdy_session_key.host_port_pair(); |
| 1430 bool is_https = ssl_info.is_valid(); |
| 1431 url::SchemeHostPort scheme_host_port(is_https ? "https" : "http", |
| 1432 host_port_pair.host(), |
| 1433 host_port_pair.port()); |
| 1434 |
| 1430 base::WeakPtr<HttpServerProperties> http_server_properties = | 1435 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 1431 session_->http_server_properties(); | 1436 session_->http_server_properties(); |
| 1432 if (http_server_properties) | 1437 if (http_server_properties) |
| 1433 http_server_properties->SetSupportsSpdy(host_port_pair, true); | 1438 http_server_properties->SetSupportsSpdy(scheme_host_port, true); |
| 1434 | 1439 |
| 1435 // Create a SpdyHttpStream or a BidirectionalStreamImpl attached to the | 1440 // Create a SpdyHttpStream or a BidirectionalStreamImpl attached to the |
| 1436 // session; OnNewSpdySessionReadyCallback is not called until an event loop | 1441 // session; OnNewSpdySessionReadyCallback is not called until an event loop |
| 1437 // iteration later, so if the SpdySession is closed between then, allow | 1442 // iteration later, so if the SpdySession is closed between then, allow |
| 1438 // reuse state from the underlying socket, sampled by SpdyHttpStream, | 1443 // reuse state from the underlying socket, sampled by SpdyHttpStream, |
| 1439 // bubble up to the request. | 1444 // bubble up to the request. |
| 1440 return SetSpdyHttpStreamOrBidirectionalStreamImpl(new_spdy_session_, | 1445 return SetSpdyHttpStreamOrBidirectionalStreamImpl(new_spdy_session_, |
| 1441 spdy_session_direct_); | 1446 spdy_session_direct_); |
| 1442 } | 1447 } |
| 1443 | 1448 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 if (connection_->socket()) { | 1808 if (connection_->socket()) { |
| 1804 ConnectionAttempts socket_attempts; | 1809 ConnectionAttempts socket_attempts; |
| 1805 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1810 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1806 request_->AddConnectionAttempts(socket_attempts); | 1811 request_->AddConnectionAttempts(socket_attempts); |
| 1807 } else { | 1812 } else { |
| 1808 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1813 request_->AddConnectionAttempts(connection_->connection_attempts()); |
| 1809 } | 1814 } |
| 1810 } | 1815 } |
| 1811 | 1816 |
| 1812 } // namespace net | 1817 } // namespace net |
| OLD | NEW |