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" | |
65 | 64 |
66 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 65 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
67 #include <algorithm> | 66 #include <algorithm> |
68 #include "net/proxy/proxy_server.h" | 67 #include "net/proxy/proxy_server.h" |
69 #endif | 68 #endif |
70 | 69 |
71 | 70 |
72 using base::Time; | 71 using base::Time; |
73 using base::TimeDelta; | 72 using base::TimeDelta; |
74 | 73 |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 case HttpAuth::AUTH_PROXY: { | 1538 case HttpAuth::AUTH_PROXY: { |
1540 if (!proxy_info_.proxy_server().is_valid() || | 1539 if (!proxy_info_.proxy_server().is_valid() || |
1541 proxy_info_.proxy_server().is_direct()) { | 1540 proxy_info_.proxy_server().is_direct()) { |
1542 return GURL(); // There is no proxy server. | 1541 return GURL(); // There is no proxy server. |
1543 } | 1542 } |
1544 const char* scheme = proxy_info_.is_https() ? "https://" : "http://"; | 1543 const char* scheme = proxy_info_.is_https() ? "https://" : "http://"; |
1545 return GURL(scheme + | 1544 return GURL(scheme + |
1546 proxy_info_.proxy_server().host_port_pair().ToString()); | 1545 proxy_info_.proxy_server().host_port_pair().ToString()); |
1547 } | 1546 } |
1548 case HttpAuth::AUTH_SERVER: | 1547 case HttpAuth::AUTH_SERVER: |
1549 if (ForWebSocketHandshake()) { | |
1550 const GURL& url = request_->url; | |
1551 url::Replacements<char> ws_to_http; | |
1552 if (url.SchemeIs("ws")) { | |
1553 ws_to_http.SetScheme("http", url::Component(0, 4)); | |
1554 } else { | |
1555 DCHECK(url.SchemeIs("wss")); | |
1556 ws_to_http.SetScheme("https", url::Component(0, 5)); | |
1557 } | |
1558 return url.ReplaceComponents(ws_to_http); | |
1559 } | |
1560 return request_->url; | 1548 return request_->url; |
1561 default: | 1549 default: |
1562 return GURL(); | 1550 return GURL(); |
1563 } | 1551 } |
1564 } | 1552 } |
1565 | 1553 |
1566 bool HttpNetworkTransaction::ForWebSocketHandshake() const { | 1554 bool HttpNetworkTransaction::ForWebSocketHandshake() const { |
1567 return websocket_handshake_stream_base_create_helper_ && | 1555 return websocket_handshake_stream_base_create_helper_ && |
1568 request_->url.SchemeIsWSOrWSS(); | 1556 request_->url.SchemeIsWSOrWSS(); |
1569 } | 1557 } |
(...skipping 26 matching lines...) Expand all Loading... |
1596 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1584 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1597 state); | 1585 state); |
1598 break; | 1586 break; |
1599 } | 1587 } |
1600 return description; | 1588 return description; |
1601 } | 1589 } |
1602 | 1590 |
1603 #undef STATE_CASE | 1591 #undef STATE_CASE |
1604 | 1592 |
1605 } // namespace net | 1593 } // namespace net |
OLD | NEW |