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

Side by Side Diff: net/spdy/spdy_proxy_client_socket.cc

Issue 8502024: Allow chrome to handle 407 auth challenges to CONNECT requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove inline virtuals Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/spdy/spdy_proxy_client_socket.h" 5 #include "net/spdy/spdy_proxy_client_socket.h"
6 6
7 #include <algorithm> // min 7 #include <algorithm> // min
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 SpdyProxyClientSocket::~SpdyProxyClientSocket() { 58 SpdyProxyClientSocket::~SpdyProxyClientSocket() {
59 Disconnect(); 59 Disconnect();
60 } 60 }
61 61
62 const HttpResponseInfo* SpdyProxyClientSocket::GetConnectResponseInfo() const { 62 const HttpResponseInfo* SpdyProxyClientSocket::GetConnectResponseInfo() const {
63 return response_.headers ? &response_ : NULL; 63 return response_.headers ? &response_ : NULL;
64 } 64 }
65 65
66 int SpdyProxyClientSocket::RestartWithAuth(OldCompletionCallback* callback) {
67 // A SPDY Stream can only handle a single request, so the underlying
68 // stream may not be reused and a new SpdyProxyClientSocket must be
69 // created (possibly on top of the same SPDY Session).
70 next_state_ = STATE_DISCONNECTED;
71 return OK;
72 }
73
74 const
75 scoped_refptr<HttpAuthController>& SpdyProxyClientSocket::auth_controller() {
76 return auth_;
77 }
78
66 HttpStream* SpdyProxyClientSocket::CreateConnectResponseStream() { 79 HttpStream* SpdyProxyClientSocket::CreateConnectResponseStream() {
67 DCHECK(response_stream_.get()); 80 DCHECK(response_stream_.get());
68 return response_stream_.release(); 81 return response_stream_.release();
69 } 82 }
70 83
71 // Sends a SYN_STREAM frame to the proxy with a CONNECT request 84 // Sends a SYN_STREAM frame to the proxy with a CONNECT request
72 // for the specified endpoint. Waits for the server to send back 85 // for the specified endpoint. Waits for the server to send back
73 // a SYN_REPLY frame. OK will be returned if the status is 200. 86 // a SYN_REPLY frame. OK will be returned if the status is 200.
74 // ERR_TUNNEL_CONNECTION_FAILED will be returned for any other status. 87 // ERR_TUNNEL_CONNECTION_FAILED will be returned for any other status.
75 // In any of these cases, Read() may be called to retrieve the HTTP 88 // In any of these cases, Read() may be called to retrieve the HTTP
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 next_state_ = STATE_OPEN; 390 next_state_ = STATE_OPEN;
378 if (net_log_.IsLoggingAllEvents()) { 391 if (net_log_.IsLoggingAllEvents()) {
379 net_log_.AddEvent( 392 net_log_.AddEvent(
380 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 393 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
381 make_scoped_refptr(new NetLogHttpResponseParameter(response_.headers))); 394 make_scoped_refptr(new NetLogHttpResponseParameter(response_.headers)));
382 } 395 }
383 396
384 if (response_.headers->response_code() == 200) { 397 if (response_.headers->response_code() == 200) {
385 return OK; 398 return OK;
386 } else if (response_.headers->response_code() == 407) { 399 } else if (response_.headers->response_code() == 407) {
387 return ERR_TUNNEL_CONNECTION_FAILED; 400 int rv =
cbentzel 2011/11/14 22:11:53 Is there any way to share this with HttpProxyClien
Ryan Hamilton 2011/11/14 23:53:40 Done. I added a new HandleAuthChallenge method to
401 auth_->HandleAuthChallenge(response_.headers, false, true, net_log_);
cbentzel 2011/11/14 22:11:53 Nit: maybe easier to read as int rv = auth_->Han
Ryan Hamilton 2011/11/14 23:53:40 Done. (Heh, and then I moved the code, and it now
402 response_.auth_challenge = auth_->auth_info();
403 if (rv == OK)
404 return ERR_PROXY_AUTH_REQUESTED;
405
406 return rv;
388 } else { 407 } else {
389 // Immediately hand off our SpdyStream to a newly created SpdyHttpStream 408 // Immediately hand off our SpdyStream to a newly created SpdyHttpStream
390 // so that any subsequent SpdyFrames are processed in the context of 409 // so that any subsequent SpdyFrames are processed in the context of
391 // the HttpStream, not the socket. 410 // the HttpStream, not the socket.
392 DCHECK(spdy_stream_); 411 DCHECK(spdy_stream_);
393 SpdyStream* stream = spdy_stream_; 412 SpdyStream* stream = spdy_stream_;
394 spdy_stream_ = NULL; 413 spdy_stream_ = NULL;
395 response_stream_.reset(new SpdyHttpStream(NULL, false)); 414 response_stream_.reset(new SpdyHttpStream(NULL, false));
396 response_stream_->InitializeWithExistingStream(stream); 415 response_stream_->InitializeWithExistingStream(stream);
397 next_state_ = STATE_DISCONNECTED; 416 next_state_ = STATE_DISCONNECTED;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 OnDataReceived(NULL, 0); 529 OnDataReceived(NULL, 0);
511 } 530 }
512 if (write_callback) 531 if (write_callback)
513 write_callback->Run(ERR_CONNECTION_CLOSED); 532 write_callback->Run(ERR_CONNECTION_CLOSED);
514 } 533 }
515 534
516 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) { 535 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) {
517 } 536 }
518 537
519 } // namespace net 538 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698