| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_job_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "net/base/host_mapping_rules.h" | 10 #include "net/base/host_mapping_rules.h" |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 // These systems also enforce ports <1024 as restricted ports. So don't | 743 // These systems also enforce ports <1024 as restricted ports. So don't |
| 744 // allow protocol upgrades to user-controllable ports. | 744 // allow protocol upgrades to user-controllable ports. |
| 745 const int kUnrestrictedPort = 1024; | 745 const int kUnrestrictedPort = 1024; |
| 746 if (!session_->params().enable_user_alternate_protocol_ports && | 746 if (!session_->params().enable_user_alternate_protocol_ports && |
| 747 (alternative_service.port >= kUnrestrictedPort && | 747 (alternative_service.port >= kUnrestrictedPort && |
| 748 origin.port() < kUnrestrictedPort)) | 748 origin.port() < kUnrestrictedPort)) |
| 749 continue; | 749 continue; |
| 750 | 750 |
| 751 if (alternative_service.protocol >= NPN_SPDY_MINIMUM_VERSION && | 751 if (alternative_service.protocol >= NPN_SPDY_MINIMUM_VERSION && |
| 752 alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) { | 752 alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) { |
| 753 if (alternative_service.protocol == NPN_SPDY_3_1 && | |
| 754 !HttpStreamFactory::spdy_enabled()) | |
| 755 continue; | |
| 756 | |
| 757 if (origin.host() != alternative_service.host && | 753 if (origin.host() != alternative_service.host && |
| 758 !session_->params() | 754 !session_->params() |
| 759 .enable_http2_alternative_service_with_different_host) { | 755 .enable_http2_alternative_service_with_different_host) { |
| 760 continue; | 756 continue; |
| 761 } | 757 } |
| 762 | 758 |
| 763 // Cache this entry if we don't have a non-broken Alt-Svc yet. | 759 // Cache this entry if we don't have a non-broken Alt-Svc yet. |
| 764 if (first_alternative_service.protocol == | 760 if (first_alternative_service.protocol == |
| 765 UNINITIALIZED_ALTERNATE_PROTOCOL) | 761 UNINITIALIZED_ALTERNATE_PROTOCOL) |
| 766 first_alternative_service = alternative_service; | 762 first_alternative_service = alternative_service; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 first_alternative_service = alternative_service; | 807 first_alternative_service = alternative_service; |
| 812 } | 808 } |
| 813 | 809 |
| 814 // Ask delegate to mark QUIC as broken for the origin. | 810 // Ask delegate to mark QUIC as broken for the origin. |
| 815 if (quic_advertised && quic_all_broken && delegate != nullptr) | 811 if (quic_advertised && quic_all_broken && delegate != nullptr) |
| 816 delegate->OnQuicBroken(); | 812 delegate->OnQuicBroken(); |
| 817 | 813 |
| 818 return first_alternative_service; | 814 return first_alternative_service; |
| 819 } | 815 } |
| 820 } | 816 } |
| OLD | NEW |