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

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

Issue 1574423003: Revert of Add a whitelist for QUIC hosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/transport_security_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/strings/string_util.h"
12 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
13 #include "net/http/http_network_session.h" 12 #include "net/http/http_network_session.h"
14 #include "net/http/http_server_properties.h" 13 #include "net/http/http_server_properties.h"
15 #include "net/http/http_stream_factory_impl_job.h" 14 #include "net/http/http_stream_factory_impl_job.h"
16 #include "net/http/http_stream_factory_impl_request.h" 15 #include "net/http/http_stream_factory_impl_request.h"
17 #include "net/http/transport_security_state.h"
18 #include "net/log/net_log.h" 16 #include "net/log/net_log.h"
19 #include "net/quic/quic_server_id.h" 17 #include "net/quic/quic_server_id.h"
20 #include "net/spdy/spdy_http_stream.h" 18 #include "net/spdy/spdy_http_stream.h"
21 #include "url/gurl.h" 19 #include "url/gurl.h"
22 20
23 #if defined(ENABLE_BIDIRECTIONAL_STREAM) 21 #if defined(ENABLE_BIDIRECTIONAL_STREAM)
24 #include "net/spdy/bidirectional_stream_spdy_job.h" 22 #include "net/spdy/bidirectional_stream_spdy_job.h"
25 #endif 23 #endif
26 24
27 namespace net { 25 namespace net {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 278
281 // Check whether there's an existing session to use for this QUIC Alt-Svc. 279 // Check whether there's an existing session to use for this QUIC Alt-Svc.
282 HostPortPair destination = alternative_service.host_port_pair(); 280 HostPortPair destination = alternative_service.host_port_pair();
283 std::string origin_host = 281 std::string origin_host =
284 ApplyHostMappingRules(request_info.url, &destination).host(); 282 ApplyHostMappingRules(request_info.url, &destination).host();
285 QuicServerId server_id(destination, request_info.privacy_mode); 283 QuicServerId server_id(destination, request_info.privacy_mode);
286 if (session_->quic_stream_factory()->CanUseExistingSession( 284 if (session_->quic_stream_factory()->CanUseExistingSession(
287 server_id, request_info.privacy_mode, origin_host)) 285 server_id, request_info.privacy_mode, origin_host))
288 return alternative_service; 286 return alternative_service;
289 287
290 if (!IsQuicWhitelistedForHost(destination.host()))
291 continue;
292
293 // Cache this entry if we don't have a non-broken Alt-Svc yet. 288 // Cache this entry if we don't have a non-broken Alt-Svc yet.
294 if (first_alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) 289 if (first_alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
295 first_alternative_service = alternative_service; 290 first_alternative_service = alternative_service;
296 } 291 }
297 292
298 // Ask delegate to mark QUIC as broken for the origin. 293 // Ask delegate to mark QUIC as broken for the origin.
299 if (quic_advertised && quic_all_broken && delegate != nullptr) 294 if (quic_advertised && quic_all_broken && delegate != nullptr)
300 delegate->OnQuicBroken(); 295 delegate->OnQuicBroken();
301 296
302 return first_alternative_service; 297 return first_alternative_service;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 orphaned_job_set_.erase(job); 358 orphaned_job_set_.erase(job);
364 delete job; 359 delete job;
365 } 360 }
366 361
367 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { 362 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) {
368 preconnect_job_set_.erase(job); 363 preconnect_job_set_.erase(job);
369 delete job; 364 delete job;
370 OnPreconnectsCompleteInternal(); 365 OnPreconnectsCompleteInternal();
371 } 366 }
372 367
373 bool HttpStreamFactoryImpl::IsQuicWhitelistedForHost(const std::string& host) {
374 if (session_->params().transport_security_state->IsGooglePinnedHost(host))
375 return true;
376
377 std::string lower_host = base::ToLowerASCII(host);
378 if (ContainsKey(session_->params().quic_host_whitelist, lower_host))
379 return true;
380
381 return base::EndsWith(lower_host, ".snapchat.com",
382 base::CompareCase::SENSITIVE);
383 }
384
385 } // namespace net 368 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/transport_security_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698