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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 !session.IsProtocolEnabled(protocol)) { | 79 !session.IsProtocolEnabled(protocol)) { |
80 DVLOG(1) << kAlternateProtocolHeader | 80 DVLOG(1) << kAlternateProtocolHeader |
81 << " header has unrecognized protocol: " | 81 << " header has unrecognized protocol: " |
82 << port_protocol_vector[1]; | 82 << port_protocol_vector[1]; |
83 is_valid = false; | 83 is_valid = false; |
84 break; | 84 break; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 if (!is_valid || protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) { | 88 if (!is_valid || protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) { |
89 http_server_properties->ClearAlternativeService(http_host_port_pair); | 89 http_server_properties->ClearAlternativeServices(http_host_port_pair); |
90 return; | 90 return; |
91 } | 91 } |
92 | 92 |
93 HostPortPair host_port(http_host_port_pair); | 93 HostPortPair host_port(http_host_port_pair); |
94 const HostMappingRules* mapping_rules = GetHostMappingRules(); | 94 const HostMappingRules* mapping_rules = GetHostMappingRules(); |
95 if (mapping_rules) | 95 if (mapping_rules) |
96 mapping_rules->RewriteHost(&host_port); | 96 mapping_rules->RewriteHost(&host_port); |
97 | 97 |
98 http_server_properties->SetAlternativeService( | 98 http_server_properties->SetAlternativeService( |
99 host_port, AlternativeService(protocol, "", static_cast<uint16>(port)), | 99 host_port, AlternativeService(protocol, "", static_cast<uint16>(port)), |
(...skipping 10 matching lines...) Expand all Loading... |
110 replacements.SetHost(endpoint->host().c_str(), | 110 replacements.SetHost(endpoint->host().c_str(), |
111 url::Component(0, endpoint->host().size())); | 111 url::Component(0, endpoint->host().size())); |
112 return url.ReplaceComponents(replacements); | 112 return url.ReplaceComponents(replacements); |
113 } | 113 } |
114 return url; | 114 return url; |
115 } | 115 } |
116 | 116 |
117 HttpStreamFactory::HttpStreamFactory() {} | 117 HttpStreamFactory::HttpStreamFactory() {} |
118 | 118 |
119 } // namespace net | 119 } // namespace net |
OLD | NEW |