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

Unified Diff: net/http/http_proxy_client_socket.cc

Issue 3391029: Revert 60747 - Add a new class SpdyProxyClientSocket which implements ClientS... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 months 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 | « no previous file | net/http/http_proxy_utils.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 60753)
+++ net/http/http_proxy_client_socket.cc (working copy)
@@ -14,13 +14,42 @@
#include "net/base/net_util.h"
#include "net/http/http_net_log_params.h"
#include "net/http/http_network_session.h"
-#include "net/http/http_proxy_utils.h"
#include "net/http/http_request_info.h"
#include "net/http/http_stream_parser.h"
#include "net/socket/client_socket_handle.h"
namespace net {
+namespace {
+
+// The HTTP CONNECT method for establishing a tunnel connection is documented
+// in draft-luotonen-web-proxy-tunneling-01.txt and RFC 2817, Sections 5.2 and
+// 5.3.
+void BuildTunnelRequest(const HttpRequestInfo* request_info,
+ const HttpRequestHeaders& authorization_headers,
+ const HostPortPair& endpoint,
+ std::string* request_line,
+ HttpRequestHeaders* request_headers) {
+ // RFC 2616 Section 9 says the Host request-header field MUST accompany all
+ // HTTP/1.1 requests. Add "Proxy-Connection: keep-alive" for compat with
+ // HTTP/1.0 proxies such as Squid (required for NTLM authentication).
+ *request_line = base::StringPrintf(
+ "CONNECT %s HTTP/1.1\r\n", endpoint.ToString().c_str());
+ request_headers->SetHeader(HttpRequestHeaders::kHost,
+ GetHostAndOptionalPort(request_info->url));
+ request_headers->SetHeader(HttpRequestHeaders::kProxyConnection,
+ "keep-alive");
+
+ std::string user_agent;
+ if (request_info->extra_headers.GetHeader(HttpRequestHeaders::kUserAgent,
+ &user_agent))
+ request_headers->SetHeader(HttpRequestHeaders::kUserAgent, user_agent);
+
+ request_headers->MergeFrom(authorization_headers);
+}
+
+} // namespace
+
HttpProxyClientSocket::HttpProxyClientSocket(
ClientSocketHandle* transport_socket,
const GURL& request_url,
@@ -329,7 +358,7 @@
auth_->AddAuthorizationHeader(&authorization_headers);
std::string request_line;
HttpRequestHeaders request_headers;
- BuildTunnelRequest(request_, authorization_headers, endpoint_,
+ BuildTunnelRequest(&request_, authorization_headers, endpoint_,
&request_line, &request_headers);
if (net_log_.IsLoggingAll()) {
net_log_.AddEvent(
« no previous file with comments | « no previous file | net/http/http_proxy_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698