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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return http_pipelined_host_pool_.PipelineInfoToValue(); | 183 return http_pipelined_host_pool_.PipelineInfoToValue(); |
184 } | 184 } |
185 | 185 |
186 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { | 186 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { |
187 return session_->params().host_mapping_rules; | 187 return session_->params().host_mapping_rules; |
188 } | 188 } |
189 | 189 |
190 PortAlternateProtocolPair HttpStreamFactoryImpl::GetAlternateProtocolRequestFor( | 190 PortAlternateProtocolPair HttpStreamFactoryImpl::GetAlternateProtocolRequestFor( |
191 const GURL& original_url, | 191 const GURL& original_url, |
192 GURL* alternate_url) { | 192 GURL* alternate_url) { |
193 if (!use_alternate_protocols()) | 193 if (!session_->params().use_alternate_protocols) |
194 return kNoAlternateProtocol; | 194 return kNoAlternateProtocol; |
195 | 195 |
196 if (original_url.SchemeIs("ftp")) | 196 if (original_url.SchemeIs("ftp")) |
197 return kNoAlternateProtocol; | 197 return kNoAlternateProtocol; |
198 | 198 |
199 HostPortPair origin = HostPortPair(original_url.HostNoBrackets(), | 199 HostPortPair origin = HostPortPair(original_url.HostNoBrackets(), |
200 original_url.EffectiveIntPort()); | 200 original_url.EffectiveIntPort()); |
201 | 201 |
202 HttpServerProperties& http_server_properties = | 202 HttpServerProperties& http_server_properties = |
203 *session_->http_server_properties(); | 203 *session_->http_server_properties(); |
(...skipping 20 matching lines...) Expand all Loading... |
224 // allow protocol upgrades to user-controllable ports. | 224 // allow protocol upgrades to user-controllable ports. |
225 const int kUnrestrictedPort = 1024; | 225 const int kUnrestrictedPort = 1024; |
226 if (!session_->params().enable_user_alternate_protocol_ports && | 226 if (!session_->params().enable_user_alternate_protocol_ports && |
227 (alternate.port >= kUnrestrictedPort && | 227 (alternate.port >= kUnrestrictedPort && |
228 origin.port() < kUnrestrictedPort)) | 228 origin.port() < kUnrestrictedPort)) |
229 return kNoAlternateProtocol; | 229 return kNoAlternateProtocol; |
230 | 230 |
231 origin.set_port(alternate.port); | 231 origin.set_port(alternate.port); |
232 if (alternate.protocol >= NPN_SPDY_MINIMUM_VERSION && | 232 if (alternate.protocol >= NPN_SPDY_MINIMUM_VERSION && |
233 alternate.protocol <= NPN_SPDY_MAXIMUM_VERSION) { | 233 alternate.protocol <= NPN_SPDY_MAXIMUM_VERSION) { |
234 if (!spdy_enabled()) | 234 if (!HttpStreamFactory::spdy_enabled()) |
235 return kNoAlternateProtocol; | 235 return kNoAlternateProtocol; |
236 | 236 |
237 if (HttpStreamFactory::HasSpdyExclusion(origin)) | 237 if (session_->HasSpdyExclusion(origin)) |
238 return kNoAlternateProtocol; | 238 return kNoAlternateProtocol; |
239 | 239 |
240 *alternate_url = UpgradeUrlToHttps(original_url, alternate.port); | 240 *alternate_url = UpgradeUrlToHttps(original_url, alternate.port); |
241 } else { | 241 } else { |
242 DCHECK_EQ(QUIC, alternate.protocol); | 242 DCHECK_EQ(QUIC, alternate.protocol); |
243 if (!session_->params().enable_quic || | 243 if (!session_->params().enable_quic || |
244 !(original_url.SchemeIs("http") || | 244 !(original_url.SchemeIs("http") || |
245 session_->params().enable_quic_https)) { | 245 session_->params().enable_quic_https)) { |
246 return kNoAlternateProtocol; | 246 return kNoAlternateProtocol; |
247 } | 247 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 it != requests_to_fail.end(); ++it) { | 349 it != requests_to_fail.end(); ++it) { |
350 Request* request = *it; | 350 Request* request = *it; |
351 if (request == request_map_[job]) { | 351 if (request == request_map_[job]) { |
352 continue; | 352 continue; |
353 } | 353 } |
354 request->OnStreamFailed(NULL, status, used_ssl_config); | 354 request->OnStreamFailed(NULL, status, used_ssl_config); |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 } // namespace net | 358 } // namespace net |
OLD | NEW |