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

Unified Diff: net/http/http_proxy_client_socket.cc

Issue 4935001: Allow a non-200 (or non-407) response for a CONNECT request from an HTTPS pro... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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/http/http_proxy_client_socket.h ('k') | net/http/http_proxy_client_socket_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_proxy_client_socket.cc
===================================================================
--- net/http/http_proxy_client_socket.cc (revision 68026)
+++ net/http/http_proxy_client_socket.cc (working copy)
@@ -12,6 +12,8 @@
#include "net/base/io_buffer.h"
#include "net/base/net_log.h"
#include "net/base/net_util.h"
+#include "net/http/connect_response_http_stream.h"
+#include "net/http/http_basic_stream.h"
#include "net/http/http_net_log_params.h"
#include "net/http/http_network_session.h"
#include "net/http/http_proxy_utils.h"
@@ -31,7 +33,8 @@
HttpAuthCache* http_auth_cache,
HttpAuthHandlerFactory* http_auth_handler_factory,
bool tunnel,
- bool using_spdy)
+ bool using_spdy,
+ bool is_https_proxy)
: ALLOW_THIS_IN_INITIALIZER_LIST(
io_callback_(this, &HttpProxyClientSocket::OnIOComplete)),
next_state_(STATE_NONE),
@@ -46,6 +49,7 @@
: NULL),
tunnel_(tunnel),
using_spdy_(using_spdy),
+ is_https_proxy_(is_https_proxy),
net_log_(transport_socket->socket()->NetLog()) {
// Synthesize the bits of a request that we actually use.
request_.url = request_url;
@@ -59,6 +63,12 @@
Disconnect();
}
+HttpStream* HttpProxyClientSocket::GetConnectResponseStream() {
+ return new HttpBasicStream(http_stream_parser_.release(),
+ transport_.release());
+}
+
+
int HttpProxyClientSocket::Connect(CompletionCallback* callback) {
DCHECK(transport_.get());
DCHECK(transport_->socket());
@@ -145,7 +155,8 @@
}
void HttpProxyClientSocket::Disconnect() {
- transport_->socket()->Disconnect();
+ if (transport_.get())
+ transport_->socket()->Disconnect();
// Reset other states to make sure they aren't mistakenly used later.
// These are the states initialized by Connect().
@@ -405,14 +416,18 @@
return HandleAuthChallenge();
default:
- // For all other status codes, we conservatively fail the CONNECT
- // request.
- // We lose something by doing this. We have seen proxy 403, 404, and
- // 501 response bodies that contain a useful error message. For
- // example, Squid uses a 404 response to report the DNS error: "The
- // domain name does not exist."
- LogBlockedTunnelResponse(response_.headers->response_code());
- return ERR_TUNNEL_CONNECTION_FAILED;
+ if (is_https_proxy_) {
+ return ERR_HTTPS_PROXY_TUNNEL_CONNECTION_RESPONSE;
+ } else {
vandebo (ex-Chrome) 2010/12/11 02:47:49 You don't need the else part because of the return
Ryan Hamilton 2010/12/13 19:41:12 Done.
+ // For all other status codes, we conservatively fail the CONNECT
+ // request.
+ // We lose something by doing this. We have seen proxy 403, 404, and
+ // 501 response bodies that contain a useful error message. For
+ // example, Squid uses a 404 response to report the DNS error: "The
+ // domain name does not exist."
+ LogBlockedTunnelResponse(response_.headers->response_code());
+ return ERR_TUNNEL_CONNECTION_FAILED;
+ }
}
}
« no previous file with comments | « net/http/http_proxy_client_socket.h ('k') | net/http/http_proxy_client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698