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

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

Issue 2373663002: Unify enum NextProto and enum AlternateProtocol. (Closed)
Patch Set: Fix compile errors. Created 4 years, 1 month 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 26 matching lines...) Expand all
37 if (!SpdyAltSvcWireFormat::ParseHeaderFieldValue( 37 if (!SpdyAltSvcWireFormat::ParseHeaderFieldValue(
38 alternative_service_str, &alternative_service_vector)) { 38 alternative_service_str, &alternative_service_vector)) {
39 return; 39 return;
40 } 40 }
41 41
42 // Convert SpdyAltSvcWireFormat::AlternativeService entries 42 // Convert SpdyAltSvcWireFormat::AlternativeService entries
43 // to net::AlternativeServiceInfo. 43 // to net::AlternativeServiceInfo.
44 AlternativeServiceInfoVector alternative_service_info_vector; 44 AlternativeServiceInfoVector alternative_service_info_vector;
45 for (const SpdyAltSvcWireFormat::AlternativeService& 45 for (const SpdyAltSvcWireFormat::AlternativeService&
46 alternative_service_entry : alternative_service_vector) { 46 alternative_service_entry : alternative_service_vector) {
47 AlternateProtocol protocol = 47 NextProto protocol =
48 AlternateProtocolFromString(alternative_service_entry.protocol_id); 48 NextProtoFromString(alternative_service_entry.protocol_id);
49 if (!IsAlternateProtocolValid(protocol) || 49 if (!IsAlternateProtocolValid(protocol) ||
50 !session->IsProtocolEnabled(protocol) || 50 !session->IsProtocolEnabled(protocol) ||
51 !IsPortValid(alternative_service_entry.port)) { 51 !IsPortValid(alternative_service_entry.port)) {
52 continue; 52 continue;
53 } 53 }
54 // Check if QUIC version is supported. 54 // Check if QUIC version is supported.
55 if (protocol == QUIC && !alternative_service_entry.version.empty()) { 55 if (protocol == kProtoQUIC && !alternative_service_entry.version.empty()) {
56 bool match_found = false; 56 bool match_found = false;
57 for (QuicVersion supported : session->params().quic_supported_versions) { 57 for (QuicVersion supported : session->params().quic_supported_versions) {
58 for (uint16_t advertised : alternative_service_entry.version) { 58 for (uint16_t advertised : alternative_service_entry.version) {
59 if (supported == advertised) { 59 if (supported == advertised) {
60 match_found = true; 60 match_found = true;
61 break; 61 break;
62 } 62 }
63 } 63 }
64 if (match_found) { 64 if (match_found) {
65 break; 65 break;
(...skipping 24 matching lines...) Expand all
90 const url::SchemeHostPort& server) { 90 const url::SchemeHostPort& server) {
91 HostPortPair host_port_pair(server.host(), server.port()); 91 HostPortPair host_port_pair(server.host(), server.port());
92 const HostMappingRules* mapping_rules = GetHostMappingRules(); 92 const HostMappingRules* mapping_rules = GetHostMappingRules();
93 if (mapping_rules) 93 if (mapping_rules)
94 mapping_rules->RewriteHost(&host_port_pair); 94 mapping_rules->RewriteHost(&host_port_pair);
95 return url::SchemeHostPort(server.scheme(), host_port_pair.host(), 95 return url::SchemeHostPort(server.scheme(), host_port_pair.host(),
96 host_port_pair.port()); 96 host_port_pair.port());
97 } 97 }
98 98
99 } // namespace net 99 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_manager_unittest.cc ('k') | net/http/http_stream_factory_impl_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698