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

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

Issue 9316101: Revert 118950 - Allow chrome to handle 407 auth challenges to CONNECT requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 | « net/http/http_proxy_utils.h ('k') | net/http/http_stream_factory_impl_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
OLDNEW
1 // Copyright (c) 2012 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/http/http_proxy_utils.h" 5 #include "net/http/http_proxy_utils.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "net/base/host_port_pair.h" 9 #include "net/base/host_port_pair.h"
10 #include "net/base/net_errors.h"
11 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
12 #include "net/http/http_auth_controller.h"
13 #include "net/http/http_request_info.h" 11 #include "net/http/http_request_info.h"
14 #include "net/http/http_response_headers.h"
15 #include "net/http/http_response_info.h"
16 12
17 namespace net { 13 namespace net {
18 14
19 void BuildTunnelRequest( 15 void BuildTunnelRequest(
20 const HttpRequestInfo& request_info, 16 const HttpRequestInfo& request_info,
21 const HttpRequestHeaders& auth_headers, 17 const HttpRequestHeaders& auth_headers,
22 const HostPortPair& endpoint, 18 const HostPortPair& endpoint,
23 std::string* request_line, 19 std::string* request_line,
24 HttpRequestHeaders* request_headers) { 20 HttpRequestHeaders* request_headers) {
25 // RFC 2616 Section 9 says the Host request-header field MUST accompany all 21 // RFC 2616 Section 9 says the Host request-header field MUST accompany all
26 // HTTP/1.1 requests. Add "Proxy-Connection: keep-alive" for compat with 22 // HTTP/1.1 requests. Add "Proxy-Connection: keep-alive" for compat with
27 // HTTP/1.0 proxies such as Squid (required for NTLM authentication). 23 // HTTP/1.0 proxies such as Squid (required for NTLM authentication).
28 *request_line = StringPrintf( 24 *request_line = StringPrintf(
29 "CONNECT %s HTTP/1.1\r\n", endpoint.ToString().c_str()); 25 "CONNECT %s HTTP/1.1\r\n", endpoint.ToString().c_str());
30 request_headers->SetHeader(HttpRequestHeaders::kHost, 26 request_headers->SetHeader(HttpRequestHeaders::kHost,
31 GetHostAndOptionalPort(request_info.url)); 27 GetHostAndOptionalPort(request_info.url));
32 request_headers->SetHeader(HttpRequestHeaders::kProxyConnection, 28 request_headers->SetHeader(HttpRequestHeaders::kProxyConnection,
33 "keep-alive"); 29 "keep-alive");
34 30
35 std::string user_agent; 31 std::string user_agent;
36 if (request_info.extra_headers.GetHeader(HttpRequestHeaders::kUserAgent, 32 if (request_info.extra_headers.GetHeader(HttpRequestHeaders::kUserAgent,
37 &user_agent)) 33 &user_agent))
38 request_headers->SetHeader(HttpRequestHeaders::kUserAgent, user_agent); 34 request_headers->SetHeader(HttpRequestHeaders::kUserAgent, user_agent);
39 35
40 request_headers->MergeFrom(auth_headers); 36 request_headers->MergeFrom(auth_headers);
41 } 37 }
42 38
43 int HandleAuthChallenge(HttpAuthController* auth,
44 HttpResponseInfo* response,
45 const BoundNetLog& net_log) {
46 DCHECK(response->headers);
47
48 int rv = auth->HandleAuthChallenge(response->headers, false, true, net_log);
49 response->auth_challenge = auth->auth_info();
50 if (rv == OK)
51 return ERR_PROXY_AUTH_REQUESTED;
52 return rv;
53 }
54
55 } // namespace net 39 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_utils.h ('k') | net/http/http_stream_factory_impl_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698