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" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "net/base/load_flags.h" | |
12 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
13 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
14 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
15 #include "net/http/http_server_properties.h" | 16 #include "net/http/http_server_properties.h" |
16 #include "net/http/http_stream_factory_impl_job.h" | 17 #include "net/http/http_stream_factory_impl_job.h" |
17 #include "net/http/http_stream_factory_impl_request.h" | 18 #include "net/http/http_stream_factory_impl_request.h" |
18 #include "net/spdy/spdy_http_stream.h" | 19 #include "net/spdy/spdy_http_stream.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
20 | 21 |
21 namespace net { | 22 namespace net { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 Request* request = new Request(request_info.url, | 103 Request* request = new Request(request_info.url, |
103 this, | 104 this, |
104 delegate, | 105 delegate, |
105 websocket_handshake_stream_create_helper, | 106 websocket_handshake_stream_create_helper, |
106 net_log); | 107 net_log); |
107 | 108 |
108 GURL alternate_url; | 109 GURL alternate_url; |
109 AlternateProtocolInfo alternate = | 110 AlternateProtocolInfo alternate = |
110 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); | 111 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); |
111 Job* alternate_job = NULL; | 112 Job* alternate_job = NULL; |
112 if (alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) { | 113 if (alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL && |
114 (request_info.load_flags & LOAD_DISABLE_ALTERNATE_PROTOCOLS) == 0) { | |
113 // Never share connection with other jobs for FTP requests. | 115 // Never share connection with other jobs for FTP requests. |
114 DCHECK(!request_info.url.SchemeIs("ftp")); | 116 DCHECK(!request_info.url.SchemeIs("ftp")); |
115 | 117 |
116 HttpRequestInfo alternate_request_info = request_info; | 118 HttpRequestInfo alternate_request_info = request_info; |
117 alternate_request_info.url = alternate_url; | 119 alternate_request_info.url = alternate_url; |
118 alternate_job = | 120 alternate_job = |
119 new Job(this, session_, alternate_request_info, priority, | 121 new Job(this, session_, alternate_request_info, priority, |
120 server_ssl_config, proxy_ssl_config, net_log.net_log()); | 122 server_ssl_config, proxy_ssl_config, net_log.net_log()); |
121 request->AttachJob(alternate_job); | 123 request->AttachJob(alternate_job); |
122 alternate_job->MarkAsAlternate(request_info.url, alternate); | 124 alternate_job->MarkAsAlternate(request_info.url, alternate); |
(...skipping 23 matching lines...) Expand all Loading... | |
146 int num_streams, | 148 int num_streams, |
147 const HttpRequestInfo& request_info, | 149 const HttpRequestInfo& request_info, |
148 RequestPriority priority, | 150 RequestPriority priority, |
149 const SSLConfig& server_ssl_config, | 151 const SSLConfig& server_ssl_config, |
150 const SSLConfig& proxy_ssl_config) { | 152 const SSLConfig& proxy_ssl_config) { |
151 DCHECK(!for_websockets_); | 153 DCHECK(!for_websockets_); |
152 GURL alternate_url; | 154 GURL alternate_url; |
153 AlternateProtocolInfo alternate = | 155 AlternateProtocolInfo alternate = |
154 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); | 156 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); |
155 Job* job = NULL; | 157 Job* job = NULL; |
156 if (alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) { | 158 if (alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL && |
159 (request_info.load_flags & LOAD_DISABLE_ALTERNATE_PROTOCOLS) == 0) { | |
Ryan Hamilton
2015/02/12 23:48:37
Since this is in two places, could you consider mo
sclittle
2015/02/13 19:32:26
Done.
| |
157 HttpRequestInfo alternate_request_info = request_info; | 160 HttpRequestInfo alternate_request_info = request_info; |
158 alternate_request_info.url = alternate_url; | 161 alternate_request_info.url = alternate_url; |
159 job = new Job(this, session_, alternate_request_info, priority, | 162 job = new Job(this, session_, alternate_request_info, priority, |
160 server_ssl_config, proxy_ssl_config, session_->net_log()); | 163 server_ssl_config, proxy_ssl_config, session_->net_log()); |
161 job->MarkAsAlternate(request_info.url, alternate); | 164 job->MarkAsAlternate(request_info.url, alternate); |
162 } else { | 165 } else { |
163 job = new Job(this, session_, request_info, priority, | 166 job = new Job(this, session_, request_info, priority, |
164 server_ssl_config, proxy_ssl_config, session_->net_log()); | 167 server_ssl_config, proxy_ssl_config, session_->net_log()); |
165 } | 168 } |
166 preconnect_job_set_.insert(job); | 169 preconnect_job_set_.insert(job); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 delete job; | 297 delete job; |
295 } | 298 } |
296 | 299 |
297 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { | 300 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { |
298 preconnect_job_set_.erase(job); | 301 preconnect_job_set_.erase(job); |
299 delete job; | 302 delete job; |
300 OnPreconnectsCompleteInternal(); | 303 OnPreconnectsCompleteInternal(); |
301 } | 304 } |
302 | 305 |
303 } // namespace net | 306 } // namespace net |
OLD | NEW |