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

Unified 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, 5 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction.cc
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index f4df073b4bba5ad905631653d2cba46820c0daa7..8ee9069c5574f0340a9cb3a6b0dd375ece30ded6 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -61,6 +61,7 @@
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "url/gurl.h"
+#include "url/url_canon.h"
#if defined(SPDY_PROXY_AUTH_ORIGIN)
#include <algorithm>
@@ -1545,6 +1546,17 @@ GURL HttpNetworkTransaction::AuthURL(HttpAuth::Target target) const {
proxy_info_.proxy_server().host_port_pair().ToString());
}
case HttpAuth::AUTH_SERVER:
+ if (ForWebSocketHandshake()) {
+ const GURL& url = request_->url;
+ url::Replacements<char> ws_to_http;
+ if (url.SchemeIs("ws")) {
+ ws_to_http.SetScheme("http", url::Component(0, 4));
+ } else {
+ DCHECK(url.SchemeIs("wss"));
+ ws_to_http.SetScheme("https", url::Component(0, 5));
+ }
+ return url.ReplaceComponents(ws_to_http);
+ }
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
return request_->url;
default:
return GURL();
« 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