| 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.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream( | 49 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream( |
| 50 const HttpRequestInfo& request_info, | 50 const HttpRequestInfo& request_info, |
| 51 RequestPriority priority, | 51 RequestPriority priority, |
| 52 const SSLConfig& server_ssl_config, | 52 const SSLConfig& server_ssl_config, |
| 53 const SSLConfig& proxy_ssl_config, | 53 const SSLConfig& proxy_ssl_config, |
| 54 HttpStreamRequest::Delegate* delegate, | 54 HttpStreamRequest::Delegate* delegate, |
| 55 const BoundNetLog& net_log) { | 55 const BoundNetLog& net_log) { |
| 56 DCHECK(!for_websockets_); | 56 DCHECK(!for_websockets_); |
| 57 return RequestStreamInternal(request_info, | 57 return RequestStreamInternal(request_info, priority, server_ssl_config, |
| 58 priority, | 58 proxy_ssl_config, delegate, nullptr, |
| 59 server_ssl_config, | 59 HttpStreamRequest::HTTP_STREAM, net_log); |
| 60 proxy_ssl_config, | |
| 61 delegate, | |
| 62 NULL, | |
| 63 net_log); | |
| 64 } | 60 } |
| 65 | 61 |
| 66 HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream( | 62 HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream( |
| 67 const HttpRequestInfo& request_info, | 63 const HttpRequestInfo& request_info, |
| 68 RequestPriority priority, | 64 RequestPriority priority, |
| 69 const SSLConfig& server_ssl_config, | 65 const SSLConfig& server_ssl_config, |
| 70 const SSLConfig& proxy_ssl_config, | 66 const SSLConfig& proxy_ssl_config, |
| 71 HttpStreamRequest::Delegate* delegate, | 67 HttpStreamRequest::Delegate* delegate, |
| 72 WebSocketHandshakeStreamBase::CreateHelper* create_helper, | 68 WebSocketHandshakeStreamBase::CreateHelper* create_helper, |
| 73 const BoundNetLog& net_log) { | 69 const BoundNetLog& net_log) { |
| 74 DCHECK(for_websockets_); | 70 DCHECK(for_websockets_); |
| 75 DCHECK(create_helper); | 71 DCHECK(create_helper); |
| 76 return RequestStreamInternal(request_info, | 72 return RequestStreamInternal(request_info, priority, server_ssl_config, |
| 77 priority, | 73 proxy_ssl_config, delegate, create_helper, |
| 78 server_ssl_config, | 74 HttpStreamRequest::HTTP_STREAM, net_log); |
| 79 proxy_ssl_config, | |
| 80 delegate, | |
| 81 create_helper, | |
| 82 net_log); | |
| 83 } | 75 } |
| 84 | 76 |
| 85 HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamJob( | 77 HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamJob( |
| 86 const HttpRequestInfo& request_info, | 78 const HttpRequestInfo& request_info, |
| 87 RequestPriority priority, | 79 RequestPriority priority, |
| 88 const SSLConfig& server_ssl_config, | 80 const SSLConfig& server_ssl_config, |
| 89 const SSLConfig& proxy_ssl_config, | 81 const SSLConfig& proxy_ssl_config, |
| 90 HttpStreamRequest::Delegate* delegate, | 82 HttpStreamRequest::Delegate* delegate, |
| 91 const BoundNetLog& net_log) { | 83 const BoundNetLog& net_log) { |
| 92 DCHECK(!for_websockets_); | 84 DCHECK(!for_websockets_); |
| 93 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); | 85 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); |
| 94 | 86 |
| 95 // TODO(xunjieli): Create QUIC's version of BidirectionalStreamJob. | 87 return RequestStreamInternal( |
| 96 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) | 88 request_info, priority, server_ssl_config, proxy_ssl_config, delegate, |
| 97 HostPortPair server = HostPortPair::FromURL(request_info.url); | 89 nullptr, HttpStreamRequest::BIDIRECTIONAL_STREAM_SPDY_JOB, net_log); |
| 98 GURL origin_url = ApplyHostMappingRules(request_info.url, &server); | |
| 99 Request* request = | |
| 100 new Request(request_info.url, this, delegate, nullptr, net_log, | |
| 101 Request::BIDIRECTIONAL_STREAM_SPDY_JOB); | |
| 102 Job* job = new Job(this, session_, request_info, priority, server_ssl_config, | |
| 103 proxy_ssl_config, server, origin_url, net_log.net_log()); | |
| 104 request->AttachJob(job); | |
| 105 | |
| 106 job->Start(request); | |
| 107 return request; | |
| 108 | |
| 109 #else | |
| 110 DCHECK(false); | |
| 111 return nullptr; | |
| 112 #endif | |
| 113 } | 90 } |
| 114 | 91 |
| 115 HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal( | 92 HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal( |
| 116 const HttpRequestInfo& request_info, | 93 const HttpRequestInfo& request_info, |
| 117 RequestPriority priority, | 94 RequestPriority priority, |
| 118 const SSLConfig& server_ssl_config, | 95 const SSLConfig& server_ssl_config, |
| 119 const SSLConfig& proxy_ssl_config, | 96 const SSLConfig& proxy_ssl_config, |
| 120 HttpStreamRequest::Delegate* delegate, | 97 HttpStreamRequest::Delegate* delegate, |
| 121 WebSocketHandshakeStreamBase::CreateHelper* | 98 WebSocketHandshakeStreamBase::CreateHelper* |
| 122 websocket_handshake_stream_create_helper, | 99 websocket_handshake_stream_create_helper, |
| 100 HttpStreamRequest::StreamType stream_type, |
| 123 const BoundNetLog& net_log) { | 101 const BoundNetLog& net_log) { |
| 124 Request* request = new Request(request_info.url, this, delegate, | 102 Request* request = new Request(request_info.url, this, delegate, |
| 125 websocket_handshake_stream_create_helper, | 103 websocket_handshake_stream_create_helper, |
| 126 net_log, Request::HTTP_STREAM); | 104 net_log, stream_type); |
| 127 HostPortPair server = HostPortPair::FromURL(request_info.url); | 105 HostPortPair server = HostPortPair::FromURL(request_info.url); |
| 128 GURL origin_url = ApplyHostMappingRules(request_info.url, &server); | 106 GURL origin_url = ApplyHostMappingRules(request_info.url, &server); |
| 129 | 107 |
| 130 Job* job = new Job(this, session_, request_info, priority, server_ssl_config, | 108 Job* job = new Job(this, session_, request_info, priority, server_ssl_config, |
| 131 proxy_ssl_config, server, origin_url, net_log.net_log()); | 109 proxy_ssl_config, server, origin_url, net_log.net_log()); |
| 132 request->AttachJob(job); | 110 request->AttachJob(job); |
| 133 | 111 |
| 134 const AlternativeService alternative_service = | 112 const AlternativeService alternative_service = |
| 135 GetAlternativeServiceFor(request_info, delegate); | 113 GetAlternativeServiceFor(request_info, delegate); |
| 136 | 114 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 347 |
| 370 bool HttpStreamFactoryImpl::IsQuicWhitelistedForHost(const std::string& host) { | 348 bool HttpStreamFactoryImpl::IsQuicWhitelistedForHost(const std::string& host) { |
| 371 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) | 349 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) |
| 372 return true; | 350 return true; |
| 373 | 351 |
| 374 return ContainsKey(session_->params().quic_host_whitelist, | 352 return ContainsKey(session_->params().quic_host_whitelist, |
| 375 base::ToLowerASCII(host)); | 353 base::ToLowerASCII(host)); |
| 376 } | 354 } |
| 377 | 355 |
| 378 } // namespace net | 356 } // namespace net |
| OLD | NEW |