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 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 case HttpAuth::AUTH_PROXY: { | 1536 case HttpAuth::AUTH_PROXY: { |
1536 if (!proxy_info_.proxy_server().is_valid() || | 1537 if (!proxy_info_.proxy_server().is_valid() || |
1537 proxy_info_.proxy_server().is_direct()) { | 1538 proxy_info_.proxy_server().is_direct()) { |
1538 return GURL(); // There is no proxy server. | 1539 return GURL(); // There is no proxy server. |
1539 } | 1540 } |
1540 const char* scheme = proxy_info_.is_https() ? "https://" : "http://"; | 1541 const char* scheme = proxy_info_.is_https() ? "https://" : "http://"; |
1541 return GURL(scheme + | 1542 return GURL(scheme + |
1542 proxy_info_.proxy_server().host_port_pair().ToString()); | 1543 proxy_info_.proxy_server().host_port_pair().ToString()); |
1543 } | 1544 } |
1544 case HttpAuth::AUTH_SERVER: | 1545 case HttpAuth::AUTH_SERVER: |
| 1546 if (ForWebSocketHandshake()) { |
| 1547 const GURL& url = request_->url; |
| 1548 url::Replacements<char> ws_to_http; |
| 1549 if (url.SchemeIs("ws")) { |
| 1550 ws_to_http.SetScheme("http", url::Component(0, 4)); |
| 1551 } else { |
| 1552 DCHECK(url.SchemeIs("wss")); |
| 1553 ws_to_http.SetScheme("https", url::Component(0, 5)); |
| 1554 } |
| 1555 return url.ReplaceComponents(ws_to_http); |
| 1556 } |
1545 return request_->url; | 1557 return request_->url; |
1546 default: | 1558 default: |
1547 return GURL(); | 1559 return GURL(); |
1548 } | 1560 } |
1549 } | 1561 } |
1550 | 1562 |
1551 bool HttpNetworkTransaction::ForWebSocketHandshake() const { | 1563 bool HttpNetworkTransaction::ForWebSocketHandshake() const { |
1552 return websocket_handshake_stream_base_create_helper_ && | 1564 return websocket_handshake_stream_base_create_helper_ && |
1553 request_->url.SchemeIsWSOrWSS(); | 1565 request_->url.SchemeIsWSOrWSS(); |
1554 } | 1566 } |
(...skipping 26 matching lines...) Expand all Loading... |
1581 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1593 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1582 state); | 1594 state); |
1583 break; | 1595 break; |
1584 } | 1596 } |
1585 return description; | 1597 return description; |
1586 } | 1598 } |
1587 | 1599 |
1588 #undef STATE_CASE | 1600 #undef STATE_CASE |
1589 | 1601 |
1590 } // namespace net | 1602 } // namespace net |
OLD | NEW |