Chromium Code Reviews| Index: net/spdy/spdy_proxy_client_socket.cc |
| =================================================================== |
| --- net/spdy/spdy_proxy_client_socket.cc (revision 117986) |
| +++ net/spdy/spdy_proxy_client_socket.cc (working copy) |
| @@ -14,8 +14,6 @@ |
| #include "net/base/auth.h" |
| #include "net/base/io_buffer.h" |
| #include "net/base/net_util.h" |
| -#include "net/http/http_auth_cache.h" |
| -#include "net/http/http_auth_handler_factory.h" |
| #include "net/http/http_net_log_params.h" |
| #include "net/http/http_proxy_utils.h" |
| #include "net/http/http_response_headers.h" |
| @@ -29,16 +27,11 @@ |
| const HostPortPair& endpoint, |
| const GURL& url, |
| const HostPortPair& proxy_server, |
| - HttpAuthCache* auth_cache, |
| - HttpAuthHandlerFactory* auth_handler_factory) |
| + HttpAuthController* http_auth_controller) |
| : next_state_(STATE_DISCONNECTED), |
| spdy_stream_(spdy_stream), |
| endpoint_(endpoint), |
| - auth_( |
| - new HttpAuthController(HttpAuth::AUTH_PROXY, |
| - GURL("https://" + proxy_server.ToString()), |
| - auth_cache, |
| - auth_handler_factory)), |
| + auth_(http_auth_controller), |
| user_buffer_(NULL), |
| write_buffer_len_(0), |
| write_bytes_outstanding_(0), |
| @@ -61,6 +54,19 @@ |
| return response_.headers ? &response_ : NULL; |
| } |
| +const |
| +scoped_refptr<HttpAuthController>& SpdyProxyClientSocket::auth_controller() { |
| + return auth_; |
| +} |
| + |
| +int SpdyProxyClientSocket::RestartWithAuth(const CompletionCallback& callback) { |
| + // A SPDY Stream can only handle a single request, so the underlying |
| + // stream may not be reused and a new SpdyProxyClientSocket must be |
| + // created (possibly on top of the same SPDY Session). |
| + next_state_ = STATE_DISCONNECTED; |
| + return OK; |
|
vandebo (ex-Chrome)
2012/01/19 20:12:49
Same thing here - why return OK when the proxy poo
Ryan Hamilton
2012/01/19 23:11:19
Done.
|
| +} |
| + |
| HttpStream* SpdyProxyClientSocket::CreateConnectResponseStream() { |
| DCHECK(response_stream_.get()); |
| return response_stream_.release(); |
| @@ -379,6 +385,16 @@ |
| if (response_.headers->response_code() == 200) { |
| return OK; |
| } else if (response_.headers->response_code() == 407) { |
| + int rv = HandleAuthChallenge(auth_, &response_, net_log_); |
| + if (rv != ERR_PROXY_AUTH_REQUESTED) { |
| + return rv; |
| + } |
| + // SPDY only supports basic and digest auth |
| + if (auth_->auth_info() && |
| + (auth_->auth_info()->scheme == "basic" || |
| + auth_->auth_info()->scheme == "digest")) { |
| + return ERR_PROXY_AUTH_REQUESTED; |
| + } |
| return ERR_TUNNEL_CONNECTION_FAILED; |
| } else { |
| // Immediately hand off our SpdyStream to a newly created SpdyHttpStream |