Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: net/http/http_network_transaction.cc

Issue 336263005: Map WebSocket URL schemes to HTTP URL schemes for auth purposes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace accidentally removed #include <string> Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/data/websocket/connect_to.html ('k') | net/test/spawned_test_server/base_test_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 case HttpAuth::AUTH_PROXY: { 1539 case HttpAuth::AUTH_PROXY: {
1539 if (!proxy_info_.proxy_server().is_valid() || 1540 if (!proxy_info_.proxy_server().is_valid() ||
1540 proxy_info_.proxy_server().is_direct()) { 1541 proxy_info_.proxy_server().is_direct()) {
1541 return GURL(); // There is no proxy server. 1542 return GURL(); // There is no proxy server.
1542 } 1543 }
1543 const char* scheme = proxy_info_.is_https() ? "https://" : "http://"; 1544 const char* scheme = proxy_info_.is_https() ? "https://" : "http://";
1544 return GURL(scheme + 1545 return GURL(scheme +
1545 proxy_info_.proxy_server().host_port_pair().ToString()); 1546 proxy_info_.proxy_server().host_port_pair().ToString());
1546 } 1547 }
1547 case HttpAuth::AUTH_SERVER: 1548 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 }
Ryan Sleevi 2014/07/29 19:54:32 This seems like a violation of SOP. ws://foo.bar
tyoshino (SeeGerritForStatus) 2014/07/30 03:39:54 The default port is the same as HTTP for both secu
Adam Rice 2014/07/30 03:43:34 The issue is ws: both is and isn't the same protoc
1548 return request_->url; 1560 return request_->url;
1549 default: 1561 default:
1550 return GURL(); 1562 return GURL();
1551 } 1563 }
1552 } 1564 }
1553 1565
1554 bool HttpNetworkTransaction::ForWebSocketHandshake() const { 1566 bool HttpNetworkTransaction::ForWebSocketHandshake() const {
1555 return websocket_handshake_stream_base_create_helper_ && 1567 return websocket_handshake_stream_base_create_helper_ &&
1556 request_->url.SchemeIsWSOrWSS(); 1568 request_->url.SchemeIsWSOrWSS();
1557 } 1569 }
(...skipping 26 matching lines...) Expand all
1584 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1596 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1585 state); 1597 state);
1586 break; 1598 break;
1587 } 1599 }
1588 return description; 1600 return description;
1589 } 1601 }
1590 1602
1591 #undef STATE_CASE 1603 #undef STATE_CASE
1592 1604
1593 } // namespace net 1605 } // namespace net
OLDNEW
« no previous file with comments | « net/data/websocket/connect_to.html ('k') | net/test/spawned_test_server/base_test_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698