Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: net/http/http_stream_factory.cc

Issue 665083009: ABANDONED Handle multiple AlternateProtocols for each HostPortPair. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and a bunch of other changes. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
79 } 79 }
80 80
81 if (protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) 81 if (protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
82 return; 82 return;
83 83
84 HostPortPair host_port(http_host_port_pair); 84 HostPortPair host_port(http_host_port_pair);
85 const HostMappingRules* mapping_rules = GetHostMappingRules(); 85 const HostMappingRules* mapping_rules = GetHostMappingRules();
86 if (mapping_rules) 86 if (mapping_rules)
87 mapping_rules->RewriteHost(&host_port); 87 mapping_rules->RewriteHost(&host_port);
88 88
89 http_server_properties->SetAlternateProtocol( 89 http_server_properties->AddAlternateProtocol(
90 host_port, static_cast<uint16>(port), protocol, probability); 90 host_port, static_cast<uint16>(port), protocol, probability);
Ryan Hamilton 2015/02/27 18:20:48 I don't think this is quite right. Let's say that
Bence 2015/02/27 19:31:41 You are right. So we will have another method for
91 } 91 }
92 92
93 GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url, 93 GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url,
94 HostPortPair* endpoint) { 94 HostPortPair* endpoint) {
95 const HostMappingRules* mapping_rules = GetHostMappingRules(); 95 const HostMappingRules* mapping_rules = GetHostMappingRules();
96 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) { 96 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) {
97 url::Replacements<char> replacements; 97 url::Replacements<char> replacements;
98 const std::string port_str = base::IntToString(endpoint->port()); 98 const std::string port_str = base::IntToString(endpoint->port());
99 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); 99 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size()));
100 replacements.SetHost(endpoint->host().c_str(), 100 replacements.SetHost(endpoint->host().c_str(),
101 url::Component(0, endpoint->host().size())); 101 url::Component(0, endpoint->host().size()));
102 return url.ReplaceComponents(replacements); 102 return url.ReplaceComponents(replacements);
103 } 103 }
104 return url; 104 return url;
105 } 105 }
106 106
107 HttpStreamFactory::HttpStreamFactory() {} 107 HttpStreamFactory::HttpStreamFactory() {}
108 108
109 } // namespace net 109 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698