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

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

Issue 123032: Backport r17761 from the trunk to the 172 branch.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/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
« 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 request_headers_ += request_->extra_headers; 340 request_headers_ += request_->extra_headers;
341 request_headers_ += "\r\n"; 341 request_headers_ += "\r\n";
342 } 342 }
343 343
344 // The HTTP CONNECT method for establishing a tunnel connection is documented 344 // The HTTP CONNECT method for establishing a tunnel connection is documented
345 // in draft-luotonen-web-proxy-tunneling-01.txt and RFC 2817, Sections 5.2 and 345 // in draft-luotonen-web-proxy-tunneling-01.txt and RFC 2817, Sections 5.2 and
346 // 5.3. 346 // 5.3.
347 void HttpNetworkTransaction::BuildTunnelRequest() { 347 void HttpNetworkTransaction::BuildTunnelRequest() {
348 // RFC 2616 Section 9 says the Host request-header field MUST accompany all 348 // RFC 2616 Section 9 says the Host request-header field MUST accompany all
349 // HTTP/1.1 requests. 349 // HTTP/1.1 requests. Add "Proxy-Connection: keep-alive" for compat with
350 // HTTP/1.0 proxies such as Squid (required for NTLM authentication).
350 request_headers_ = StringPrintf("CONNECT %s:%d HTTP/1.1\r\n", 351 request_headers_ = StringPrintf("CONNECT %s:%d HTTP/1.1\r\n",
351 request_->url.host().c_str(), request_->url.EffectiveIntPort()); 352 request_->url.host().c_str(), request_->url.EffectiveIntPort());
352 request_headers_ += "Host: " + request_->url.host(); 353 request_headers_ += "Host: " + request_->url.host();
353 if (request_->url.has_port()) 354 if (request_->url.has_port())
354 request_headers_ += ":" + request_->url.port(); 355 request_headers_ += ":" + request_->url.port();
355 request_headers_ += "\r\n"; 356 request_headers_ += "\r\nProxy-Connection: keep-alive\r\n";
356 357
357 if (!request_->user_agent.empty()) 358 if (!request_->user_agent.empty())
358 request_headers_ += "User-Agent: " + request_->user_agent + "\r\n"; 359 request_headers_ += "User-Agent: " + request_->user_agent + "\r\n";
359 360
360 ApplyAuth(); 361 ApplyAuth();
361 362
362 request_headers_ += "\r\n"; 363 request_headers_ += "\r\n";
363 } 364 }
364 365
365 void HttpNetworkTransaction::DoCallback(int rv) { 366 void HttpNetworkTransaction::DoCallback(int rv) {
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 if (target == HttpAuth::AUTH_PROXY) { 1542 if (target == HttpAuth::AUTH_PROXY) {
1542 auth_info->host = ASCIIToWide(proxy_info_.proxy_server().host_and_port()); 1543 auth_info->host = ASCIIToWide(proxy_info_.proxy_server().host_and_port());
1543 } else { 1544 } else {
1544 DCHECK(target == HttpAuth::AUTH_SERVER); 1545 DCHECK(target == HttpAuth::AUTH_SERVER);
1545 auth_info->host = ASCIIToWide(request_->url.host()); 1546 auth_info->host = ASCIIToWide(request_->url.host());
1546 } 1547 }
1547 response_.auth_challenge = auth_info; 1548 response_.auth_challenge = auth_info;
1548 } 1549 }
1549 1550
1550 } // namespace net 1551 } // 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