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

Unified Diff: net/socket_stream/socket_stream.cc

Issue 398004: Try https proxy for websocket connection. (Closed)
Patch Set: try https proxy Created 11 years, 1 month 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/socket_stream/socket_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket_stream/socket_stream.cc
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index 7227fe900e16566ef8c7726c250e9f215c10d169..5d89416ca834c2b6ed5f613f22c5e84281f261cc 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -47,6 +47,7 @@ SocketStream::SocketStream(const GURL& url, Delegate* delegate)
next_state_(STATE_NONE),
factory_(ClientSocketFactory::GetDefaultFactory()),
proxy_mode_(kDirectConnection),
+ proxy_url_(url),
pac_request_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(
io_callback_(this, &SocketStream::OnIOCompleted)),
@@ -414,7 +415,7 @@ int SocketStream::DoResolveProxy() {
next_state_ = STATE_RESOLVE_PROXY_COMPLETE;
return proxy_service()->ResolveProxy(
- url_, &proxy_info_, &io_callback_, &pac_request_, load_log_);
+ proxy_url_, &proxy_info_, &io_callback_, &pac_request_, load_log_);
}
int SocketStream::DoResolveProxyComplete(int result) {
@@ -427,6 +428,20 @@ int SocketStream::DoResolveProxyComplete(int result) {
delegate_->OnError(this, result);
proxy_info_.UseDirect();
}
+ if (proxy_info_.is_direct()) {
+ // If proxy was not found for original URL (ie. websocket URL),
tyoshino (SeeGerritForStatus) 2009/11/16 07:33:49 i.e.
+ // try again with https URL, like Safari implementation.
+ // Note that we don't want to use http proxy, because we'll use tunnel
+ // proxy using CONNECT method, which is used by https proxy.
+ if (!proxy_url_.SchemeIs("https")) {
+ GURL::Replacements repl;
+ repl.SetSchemeStr("https");
+ proxy_url_ = url_.ReplaceComponents(repl);
+ DLOG(INFO) << "Try https proxy: " << proxy_url_;
+ next_state_ = STATE_RESOLVE_PROXY;
+ return OK;
+ }
+ }
return OK;
}
« no previous file with comments | « net/socket_stream/socket_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698