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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "net/socket/ssl_client_socket.h" | 54 #include "net/socket/ssl_client_socket.h" |
55 #include "net/socket/ssl_client_socket_pool.h" | 55 #include "net/socket/ssl_client_socket_pool.h" |
56 #include "net/socket/transport_client_socket_pool.h" | 56 #include "net/socket/transport_client_socket_pool.h" |
57 #include "net/spdy/hpack_huffman_aggregator.h" | 57 #include "net/spdy/hpack_huffman_aggregator.h" |
58 #include "net/spdy/spdy_http_stream.h" | 58 #include "net/spdy/spdy_http_stream.h" |
59 #include "net/spdy/spdy_session.h" | 59 #include "net/spdy/spdy_session.h" |
60 #include "net/spdy/spdy_session_pool.h" | 60 #include "net/spdy/spdy_session_pool.h" |
61 #include "net/ssl/ssl_cert_request_info.h" | 61 #include "net/ssl/ssl_cert_request_info.h" |
62 #include "net/ssl/ssl_connection_status_flags.h" | 62 #include "net/ssl/ssl_connection_status_flags.h" |
63 #include "url/gurl.h" | 63 #include "url/gurl.h" |
| 64 #include "url/url_canon.h" |
64 | 65 |
65 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 66 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
66 #include <algorithm> | 67 #include <algorithm> |
67 #include "net/proxy/proxy_server.h" | 68 #include "net/proxy/proxy_server.h" |
68 #endif | 69 #endif |
69 | 70 |
70 | 71 |
71 using base::Time; | 72 using base::Time; |
72 using base::TimeDelta; | 73 using base::TimeDelta; |
73 | 74 |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 case HttpAuth::AUTH_PROXY: { | 1506 case HttpAuth::AUTH_PROXY: { |
1506 if (!proxy_info_.proxy_server().is_valid() || | 1507 if (!proxy_info_.proxy_server().is_valid() || |
1507 proxy_info_.proxy_server().is_direct()) { | 1508 proxy_info_.proxy_server().is_direct()) { |
1508 return GURL(); // There is no proxy server. | 1509 return GURL(); // There is no proxy server. |
1509 } | 1510 } |
1510 const char* scheme = proxy_info_.is_https() ? "https://" : "http://"; | 1511 const char* scheme = proxy_info_.is_https() ? "https://" : "http://"; |
1511 return GURL(scheme + | 1512 return GURL(scheme + |
1512 proxy_info_.proxy_server().host_port_pair().ToString()); | 1513 proxy_info_.proxy_server().host_port_pair().ToString()); |
1513 } | 1514 } |
1514 case HttpAuth::AUTH_SERVER: | 1515 case HttpAuth::AUTH_SERVER: |
| 1516 if (ForWebSocketHandshake()) { |
| 1517 const GURL& url = request_->url; |
| 1518 url::Replacements<char> ws_to_http; |
| 1519 if (url.SchemeIs("ws")) { |
| 1520 ws_to_http.SetScheme("http", url::Component(0, 4)); |
| 1521 } else { |
| 1522 DCHECK(url.SchemeIs("wss")); |
| 1523 ws_to_http.SetScheme("https", url::Component(0, 5)); |
| 1524 } |
| 1525 return url.ReplaceComponents(ws_to_http); |
| 1526 } |
1515 return request_->url; | 1527 return request_->url; |
1516 default: | 1528 default: |
1517 return GURL(); | 1529 return GURL(); |
1518 } | 1530 } |
1519 } | 1531 } |
1520 | 1532 |
1521 bool HttpNetworkTransaction::ForWebSocketHandshake() const { | 1533 bool HttpNetworkTransaction::ForWebSocketHandshake() const { |
1522 return websocket_handshake_stream_base_create_helper_ && | 1534 return websocket_handshake_stream_base_create_helper_ && |
1523 request_->url.SchemeIsWSOrWSS(); | 1535 request_->url.SchemeIsWSOrWSS(); |
1524 } | 1536 } |
(...skipping 26 matching lines...) Expand all Loading... |
1551 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1563 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1552 state); | 1564 state); |
1553 break; | 1565 break; |
1554 } | 1566 } |
1555 return description; | 1567 return description; |
1556 } | 1568 } |
1557 | 1569 |
1558 #undef STATE_CASE | 1570 #undef STATE_CASE |
1559 | 1571 |
1560 } // namespace net | 1572 } // namespace net |
OLD | NEW |