diff options
author | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-17 04:44:54 +0000 |
---|---|---|
committer | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-17 04:44:54 +0000 |
commit | 7a9613223462175d8dfc7cd342ebd7020ad1ac0e (patch) | |
tree | f096ff83dc516450d654ce59d16fc1f3078d0714 /net/socket_stream | |
parent | 1f65029c04de2712f17a2e6eed7839949a19fed6 (diff) | |
download | chromium_src-7a9613223462175d8dfc7cd342ebd7020ad1ac0e.zip chromium_src-7a9613223462175d8dfc7cd342ebd7020ad1ac0e.tar.gz chromium_src-7a9613223462175d8dfc7cd342ebd7020ad1ac0e.tar.bz2 |
Check proxy_info_.is_empty()
In case proxy_info_.is_empty(), we can't access proxy_info_.proxy_server()
or so.
BUG=46750
TEST=none
Review URL: http://codereview.chromium.org/2803010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream')
-rw-r--r-- | net/socket_stream/socket_stream.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index a79af32..9e426df 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -430,8 +430,6 @@ int SocketStream::DoResolveProxy() { } int SocketStream::DoResolveProxyComplete(int result) { - next_state_ = STATE_RESOLVE_HOST; - pac_request_ = NULL; if (result != OK) { LOG(ERROR) << "Failed to resolve proxy: " << result; @@ -455,12 +453,20 @@ int SocketStream::DoResolveProxyComplete(int result) { } } + if (proxy_info_.is_empty()) { + // No proxies/direct to choose from. This happens when we don't support any + // of the proxies in the returned list. + return ERR_NO_SUPPORTED_PROXIES; + } + + next_state_ = STATE_RESOLVE_HOST; return OK; } int SocketStream::DoResolveHost() { next_state_ = STATE_RESOLVE_HOST_COMPLETE; + DCHECK(!proxy_info_.is_empty()); if (proxy_info_.is_direct()) proxy_mode_ = kDirectConnection; else if (proxy_info_.proxy_server().is_socks()) @@ -697,6 +703,7 @@ int SocketStream::DoReadTunnelHeadersComplete(int result) { result = HandleAuthChallenge(headers.get()); if (result == ERR_PROXY_AUTH_REQUESTED && auth_handler_.get() && delegate_) { + DCHECK(!proxy_info_.is_empty()); auth_info_ = new AuthChallengeInfo; auth_info_->is_proxy = true; auth_info_->host_and_port = @@ -726,6 +733,7 @@ int SocketStream::DoSOCKSConnect() { HostResolver::RequestInfo req_info(url_.HostNoBrackets(), url_.EffectiveIntPort()); + DCHECK(!proxy_info_.is_empty()); if (proxy_info_.proxy_server().scheme() == ProxyServer::SCHEME_SOCKS5) s = new SOCKS5ClientSocket(s, req_info); else @@ -868,6 +876,7 @@ int SocketStream::DoReadWrite(int result) { } GURL SocketStream::ProxyAuthOrigin() const { + DCHECK(!proxy_info_.is_empty()); return GURL("http://" + proxy_info_.proxy_server().host_and_port()); } |