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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "url/gurl.h" | 67 #include "url/gurl.h" |
68 #include "url/url_canon.h" | 68 #include "url/url_canon.h" |
69 | 69 |
70 namespace net { | 70 namespace net { |
71 | 71 |
72 namespace { | 72 namespace { |
73 | 73 |
74 void ProcessAlternativeServices(HttpNetworkSession* session, | 74 void ProcessAlternativeServices(HttpNetworkSession* session, |
75 const HttpResponseHeaders& headers, | 75 const HttpResponseHeaders& headers, |
76 const HostPortPair& http_host_port_pair) { | 76 const HostPortPair& http_host_port_pair) { |
77 if (session->params().parse_alternative_services && | 77 if (session->params().parse_alternative_services) { |
78 headers.HasHeader(kAlternativeServiceHeader)) { | 78 if (headers.HasHeader(kAlternativeServiceHeader)) { |
79 std::string alternative_service_str; | 79 std::string alternative_service_str; |
80 headers.GetNormalizedHeader(kAlternativeServiceHeader, | 80 headers.GetNormalizedHeader(kAlternativeServiceHeader, |
81 &alternative_service_str); | 81 &alternative_service_str); |
82 session->http_stream_factory()->ProcessAlternativeService( | 82 session->http_stream_factory()->ProcessAlternativeService( |
83 session->http_server_properties(), alternative_service_str, | 83 session->http_server_properties(), alternative_service_str, |
84 http_host_port_pair, *session); | 84 http_host_port_pair, *session); |
85 // If there is an "Alt-Svc" header, then ignore "Alternate-Protocol". | 85 } |
| 86 // If "Alt-Svc" is enabled, then ignore "Alternate-Protocol". |
86 return; | 87 return; |
87 } | 88 } |
88 | 89 |
89 if (!headers.HasHeader(kAlternateProtocolHeader)) | 90 if (!headers.HasHeader(kAlternateProtocolHeader)) |
90 return; | 91 return; |
91 | 92 |
92 std::vector<std::string> alternate_protocol_values; | 93 std::vector<std::string> alternate_protocol_values; |
93 size_t iter = 0; | 94 size_t iter = 0; |
94 std::string alternate_protocol_str; | 95 std::string alternate_protocol_str; |
95 while (headers.EnumerateHeader(&iter, kAlternateProtocolHeader, | 96 while (headers.EnumerateHeader(&iter, kAlternateProtocolHeader, |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 DCHECK(stream_request_); | 1817 DCHECK(stream_request_); |
1817 | 1818 |
1818 // Since the transaction can restart with auth credentials, it may create a | 1819 // Since the transaction can restart with auth credentials, it may create a |
1819 // stream more than once. Accumulate all of the connection attempts across | 1820 // stream more than once. Accumulate all of the connection attempts across |
1820 // those streams by appending them to the vector: | 1821 // those streams by appending them to the vector: |
1821 for (const auto& attempt : stream_request_->connection_attempts()) | 1822 for (const auto& attempt : stream_request_->connection_attempts()) |
1822 connection_attempts_.push_back(attempt); | 1823 connection_attempts_.push_back(attempt); |
1823 } | 1824 } |
1824 | 1825 |
1825 } // namespace net | 1826 } // namespace net |
OLD | NEW |