| OLD | NEW |
| 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 Loading... |
| 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 NextProto protocol = | 47 AlternateProtocol protocol = |
| 48 NextProtoFromString(alternative_service_entry.protocol_id); | 48 AlternateProtocolFromString(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 == kProtoQUIC && !alternative_service_entry.version.empty()) { | 55 if (protocol == QUIC && !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 Loading... |
| 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 |
| OLD | NEW |