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

Side by Side Diff: net/http/http_network_transaction.cc

Issue 118316: Send the "Proxy-Connection: keep-alive" header with HTTP CONNECT... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/field_trial.h" 9 #include "base/field_trial.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 *request_headers += "\r\n"; 97 *request_headers += "\r\n";
98 } 98 }
99 99
100 // The HTTP CONNECT method for establishing a tunnel connection is documented 100 // The HTTP CONNECT method for establishing a tunnel connection is documented
101 // in draft-luotonen-web-proxy-tunneling-01.txt and RFC 2817, Sections 5.2 and 101 // in draft-luotonen-web-proxy-tunneling-01.txt and RFC 2817, Sections 5.2 and
102 // 5.3. 102 // 5.3.
103 void BuildTunnelRequest(const HttpRequestInfo* request_info, 103 void BuildTunnelRequest(const HttpRequestInfo* request_info,
104 const std::string& authorization_headers, 104 const std::string& authorization_headers,
105 std::string* request_headers) { 105 std::string* request_headers) {
106 // RFC 2616 Section 9 says the Host request-header field MUST accompany all 106 // RFC 2616 Section 9 says the Host request-header field MUST accompany all
107 // HTTP/1.1 requests. 107 // HTTP/1.1 requests. Add "Proxy-Connection: keep-alive" for compat with
108 *request_headers = StringPrintf("CONNECT %s HTTP/1.1\r\nHost: %s\r\n", 108 // HTTP/1.0 proxies such as Squid (required for NTLM authentication).
109 *request_headers = StringPrintf(
110 "CONNECT %s HTTP/1.1\r\nHost: %s\r\nProxy-Connection: keep-alive\r\n",
109 GetHostAndPort(request_info->url).c_str(), 111 GetHostAndPort(request_info->url).c_str(),
110 GetHostAndOptionalPort(request_info->url).c_str()); 112 GetHostAndOptionalPort(request_info->url).c_str());
111 113
112 if (!request_info->user_agent.empty()) 114 if (!request_info->user_agent.empty())
113 StringAppendF(request_headers, "User-Agent: %s\r\n", 115 StringAppendF(request_headers, "User-Agent: %s\r\n",
114 request_info->user_agent.c_str()); 116 request_info->user_agent.c_str());
115 117
116 if (!authorization_headers.empty()) { 118 if (!authorization_headers.empty()) {
117 *request_headers += authorization_headers; 119 *request_headers += authorization_headers;
118 } 120 }
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 host_and_port = proxy_info_.proxy_server().host_and_port(); 1613 host_and_port = proxy_info_.proxy_server().host_and_port();
1612 } else { 1614 } else {
1613 DCHECK(target == HttpAuth::AUTH_SERVER); 1615 DCHECK(target == HttpAuth::AUTH_SERVER);
1614 host_and_port = GetHostAndPort(request_->url); 1616 host_and_port = GetHostAndPort(request_->url);
1615 } 1617 }
1616 auth_info->host_and_port = ASCIIToWide(host_and_port); 1618 auth_info->host_and_port = ASCIIToWide(host_and_port);
1617 response_.auth_challenge = auth_info; 1619 response_.auth_challenge = auth_info;
1618 } 1620 }
1619 1621
1620 } // namespace net 1622 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698