Chromium Code Reviews| 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, false, |
|
Ryan Hamilton
2016/02/27 00:21:14
"false" is not super readable here ("what is false
xunjieli
2016/02/29 15:21:37
Done.
| |
| 59 server_ssl_config, | |
| 60 proxy_ssl_config, | |
| 61 delegate, | |
| 62 NULL, | |
| 63 net_log); | 59 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, false, |
| 78 server_ssl_config, | |
| 79 proxy_ssl_config, | |
| 80 delegate, | |
| 81 create_helper, | |
| 82 net_log); | 74 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(request_info, priority, server_ssl_config, |
| 96 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) | 88 proxy_ssl_config, delegate, nullptr, |
| 97 HostPortPair server = HostPortPair::FromURL(request_info.url); | 89 /*for_bidirectional=*/true, 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 bool for_bidirectional, | |
| 123 const BoundNetLog& net_log) { | 101 const BoundNetLog& net_log) { |
| 124 Request* request = new Request(request_info.url, this, delegate, | 102 Request* request = |
| 125 websocket_handshake_stream_create_helper, | 103 new Request(request_info.url, this, delegate, |
| 126 net_log, Request::HTTP_STREAM); | 104 websocket_handshake_stream_create_helper, net_log, |
| 105 for_bidirectional ? Request::BIDIRECTIONAL_STREAM_SPDY_JOB | |
| 106 : Request::HTTP_STREAM); | |
|
Ryan Hamilton
2016/02/27 00:21:14
oh, since you already have an enum, just do that i
xunjieli
2016/02/29 15:21:37
Done. Great idea!
| |
| 127 HostPortPair server = HostPortPair::FromURL(request_info.url); | 107 HostPortPair server = HostPortPair::FromURL(request_info.url); |
| 128 GURL origin_url = ApplyHostMappingRules(request_info.url, &server); | 108 GURL origin_url = ApplyHostMappingRules(request_info.url, &server); |
| 129 | 109 |
| 130 Job* job = new Job(this, session_, request_info, priority, server_ssl_config, | 110 Job* job = new Job(this, session_, request_info, priority, server_ssl_config, |
| 131 proxy_ssl_config, server, origin_url, net_log.net_log()); | 111 proxy_ssl_config, server, origin_url, net_log.net_log()); |
| 132 request->AttachJob(job); | 112 request->AttachJob(job); |
| 133 | 113 |
| 134 const AlternativeService alternative_service = | 114 const AlternativeService alternative_service = |
| 135 GetAlternativeServiceFor(request_info, delegate); | 115 GetAlternativeServiceFor(request_info, delegate); |
| 136 | 116 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 | 349 |
| 370 bool HttpStreamFactoryImpl::IsQuicWhitelistedForHost(const std::string& host) { | 350 bool HttpStreamFactoryImpl::IsQuicWhitelistedForHost(const std::string& host) { |
| 371 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) | 351 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) |
| 372 return true; | 352 return true; |
| 373 | 353 |
| 374 return ContainsKey(session_->params().quic_host_whitelist, | 354 return ContainsKey(session_->params().quic_host_whitelist, |
| 375 base::ToLowerASCII(host)); | 355 base::ToLowerASCII(host)); |
| 376 } | 356 } |
| 377 | 357 |
| 378 } // namespace net | 358 } // namespace net |
| OLD | NEW |