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.h" | 5 #include "net/http/http_stream_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "net/base/host_mapping_rules.h" | 12 #include "net/base/host_mapping_rules.h" |
13 #include "net/base/host_port_pair.h" | 13 #include "net/base/host_port_pair.h" |
14 #include "net/base/parse_number.h" | 14 #include "net/base/parse_number.h" |
15 #include "net/base/port_util.h" | 15 #include "net/base/port_util.h" |
16 #include "net/http/http_network_session.h" | 16 #include "net/http/http_network_session.h" |
17 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
18 #include "net/quic/quic_protocol.h" | 18 #include "net/quic/quic_protocol.h" |
19 #include "net/spdy/spdy_alt_svc_wire_format.h" | 19 #include "net/spdy/spdy_alt_svc_wire_format.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 | 23 |
24 // WARNING: If you modify or add any static flags, you must keep them in sync | |
25 // with |ResetStaticSettingsToInit|. This is critical for unit test isolation. | |
26 | |
27 // static | |
28 bool HttpStreamFactory::spdy_enabled_ = true; | |
29 | |
30 HttpStreamFactory::~HttpStreamFactory() {} | 24 HttpStreamFactory::~HttpStreamFactory() {} |
31 | 25 |
32 // static | |
33 void HttpStreamFactory::ResetStaticSettingsToInit() { | |
34 spdy_enabled_ = true; | |
35 } | |
36 | |
37 void HttpStreamFactory::ProcessAlternativeServices( | 26 void HttpStreamFactory::ProcessAlternativeServices( |
38 HttpNetworkSession* session, | 27 HttpNetworkSession* session, |
39 const HttpResponseHeaders* headers, | 28 const HttpResponseHeaders* headers, |
40 const url::SchemeHostPort& http_server) { | 29 const url::SchemeHostPort& http_server) { |
41 if (!headers->HasHeader(kAlternativeServiceHeader)) | 30 if (!headers->HasHeader(kAlternativeServiceHeader)) |
42 return; | 31 return; |
43 | 32 |
44 std::string alternative_service_str; | 33 std::string alternative_service_str; |
45 headers->GetNormalizedHeader(kAlternativeServiceHeader, | 34 headers->GetNormalizedHeader(kAlternativeServiceHeader, |
46 &alternative_service_str); | 35 &alternative_service_str); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const url::SchemeHostPort& server) { | 90 const url::SchemeHostPort& server) { |
102 HostPortPair host_port_pair(server.host(), server.port()); | 91 HostPortPair host_port_pair(server.host(), server.port()); |
103 const HostMappingRules* mapping_rules = GetHostMappingRules(); | 92 const HostMappingRules* mapping_rules = GetHostMappingRules(); |
104 if (mapping_rules) | 93 if (mapping_rules) |
105 mapping_rules->RewriteHost(&host_port_pair); | 94 mapping_rules->RewriteHost(&host_port_pair); |
106 return url::SchemeHostPort(server.scheme(), host_port_pair.host(), | 95 return url::SchemeHostPort(server.scheme(), host_port_pair.host(), |
107 host_port_pair.port()); | 96 host_port_pair.port()); |
108 } | 97 } |
109 | 98 |
110 } // namespace net | 99 } // namespace net |
OLD | NEW |