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

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

Issue 874603004: Remove HasAlternateProtocol(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor. Created 5 years, 10 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_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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 job->Preconnect(num_streams); 168 job->Preconnect(num_streams);
169 } 169 }
170 170
171 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { 171 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const {
172 return session_->params().host_mapping_rules; 172 return session_->params().host_mapping_rules;
173 } 173 }
174 174
175 AlternateProtocolInfo HttpStreamFactoryImpl::GetAlternateProtocolRequestFor( 175 AlternateProtocolInfo HttpStreamFactoryImpl::GetAlternateProtocolRequestFor(
176 const GURL& original_url, 176 const GURL& original_url,
177 GURL* alternate_url) { 177 GURL* alternate_url) {
178 const AlternateProtocolInfo kNoAlternateProtocol = 178 const AlternateProtocolInfo kNoAlternateProtocol;
179 AlternateProtocolInfo(0, UNINITIALIZED_ALTERNATE_PROTOCOL, 0);
180 179
181 if (!session_->params().use_alternate_protocols) 180 if (!session_->params().use_alternate_protocols)
182 return kNoAlternateProtocol; 181 return kNoAlternateProtocol;
183 182
184 if (original_url.SchemeIs("ftp")) 183 if (original_url.SchemeIs("ftp"))
185 return kNoAlternateProtocol; 184 return kNoAlternateProtocol;
186 185
187 HostPortPair origin = HostPortPair::FromURL(original_url); 186 HostPortPair origin = HostPortPair::FromURL(original_url);
188
189 HttpServerProperties& http_server_properties = 187 HttpServerProperties& http_server_properties =
190 *session_->http_server_properties(); 188 *session_->http_server_properties();
191 if (!http_server_properties.HasAlternateProtocol(origin)) 189 const AlternateProtocolInfo alternate =
190 http_server_properties.GetAlternateProtocol(origin);
191
192 if (alternate.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
192 return kNoAlternateProtocol; 193 return kNoAlternateProtocol;
193
194 AlternateProtocolInfo alternate =
195 http_server_properties.GetAlternateProtocol(origin);
196 if (alternate.is_broken) { 194 if (alternate.is_broken) {
197 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN); 195 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN);
198 return kNoAlternateProtocol; 196 return kNoAlternateProtocol;
199 } 197 }
200
201 if (!IsAlternateProtocolValid(alternate.protocol)) { 198 if (!IsAlternateProtocolValid(alternate.protocol)) {
202 NOTREACHED(); 199 NOTREACHED();
203 return kNoAlternateProtocol; 200 return kNoAlternateProtocol;
204 } 201 }
205 202
206 // Some shared unix systems may have user home directories (like 203 // Some shared unix systems may have user home directories (like
207 // http://foo.com/~mike) which allow users to emit headers. This is a bad 204 // http://foo.com/~mike) which allow users to emit headers. This is a bad
208 // idea already, but with Alternate-Protocol, it provides the ability for a 205 // idea already, but with Alternate-Protocol, it provides the ability for a
209 // single user on a multi-user system to hijack the alternate protocol. 206 // single user on a multi-user system to hijack the alternate protocol.
210 // These systems also enforce ports <1024 as restricted ports. So don't 207 // These systems also enforce ports <1024 as restricted ports. So don't
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 delete job; 295 delete job;
299 } 296 }
300 297
301 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { 298 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) {
302 preconnect_job_set_.erase(job); 299 preconnect_job_set_.erase(job);
303 delete job; 300 delete job;
304 OnPreconnectsCompleteInternal(); 301 OnPreconnectsCompleteInternal();
305 } 302 }
306 303
307 } // namespace net 304 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698