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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 using base::TimeDelta; | 72 using base::TimeDelta; |
73 | 73 |
74 namespace net { | 74 namespace net { |
75 | 75 |
76 namespace { | 76 namespace { |
77 | 77 |
78 void ProcessAlternateProtocol( | 78 void ProcessAlternateProtocol( |
79 HttpNetworkSession* session, | 79 HttpNetworkSession* session, |
80 const HttpResponseHeaders& headers, | 80 const HttpResponseHeaders& headers, |
81 const HostPortPair& http_host_port_pair) { | 81 const HostPortPair& http_host_port_pair) { |
82 if (!headers.HasHeader(kAlternateProtocolHeader)) | 82 std::string alternate_protocol_str; |
| 83 |
| 84 if (!headers.EnumerateHeader(NULL, kAlternateProtocolHeader, |
| 85 &alternate_protocol_str)) { |
| 86 // Header is not present. |
83 return; | 87 return; |
84 | |
85 std::vector<std::string> alternate_protocol_values; | |
86 void* iter = NULL; | |
87 std::string alternate_protocol_str; | |
88 while (headers.EnumerateHeader(&iter, kAlternateProtocolHeader, | |
89 &alternate_protocol_str)) { | |
90 alternate_protocol_values.push_back(alternate_protocol_str); | |
91 } | 88 } |
92 | 89 |
93 session->http_stream_factory()->ProcessAlternateProtocol( | 90 session->http_stream_factory()->ProcessAlternateProtocol( |
94 session->http_server_properties(), | 91 session->http_server_properties(), |
95 alternate_protocol_values, | 92 alternate_protocol_str, |
96 http_host_port_pair, | 93 http_host_port_pair, |
97 *session); | 94 *session); |
98 } | 95 } |
99 | 96 |
100 // Returns true if |error| is a client certificate authentication error. | 97 // Returns true if |error| is a client certificate authentication error. |
101 bool IsClientCertificateError(int error) { | 98 bool IsClientCertificateError(int error) { |
102 switch (error) { | 99 switch (error) { |
103 case ERR_BAD_SSL_CLIENT_AUTH_CERT: | 100 case ERR_BAD_SSL_CLIENT_AUTH_CERT: |
104 case ERR_SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED: | 101 case ERR_SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED: |
105 case ERR_SSL_CLIENT_AUTH_CERT_NO_PRIVATE_KEY: | 102 case ERR_SSL_CLIENT_AUTH_CERT_NO_PRIVATE_KEY: |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1581 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1585 state); | 1582 state); |
1586 break; | 1583 break; |
1587 } | 1584 } |
1588 return description; | 1585 return description; |
1589 } | 1586 } |
1590 | 1587 |
1591 #undef STATE_CASE | 1588 #undef STATE_CASE |
1592 | 1589 |
1593 } // namespace net | 1590 } // namespace net |
OLD | NEW |