OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/proxy_client_socket.h" | 5 #include "net/http/proxy_client_socket.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "net/base/host_port_pair.h" | 9 #include "net/base/host_port_pair.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if (!user_agent.empty()) | 50 if (!user_agent.empty()) |
51 request_headers->SetHeader(HttpRequestHeaders::kUserAgent, user_agent); | 51 request_headers->SetHeader(HttpRequestHeaders::kUserAgent, user_agent); |
52 | 52 |
53 request_headers->MergeFrom(auth_headers); | 53 request_headers->MergeFrom(auth_headers); |
54 } | 54 } |
55 | 55 |
56 // static | 56 // static |
57 int ProxyClientSocket::HandleProxyAuthChallenge(HttpAuthController* auth, | 57 int ProxyClientSocket::HandleProxyAuthChallenge(HttpAuthController* auth, |
58 HttpResponseInfo* response, | 58 HttpResponseInfo* response, |
59 const BoundNetLog& net_log) { | 59 const BoundNetLog& net_log) { |
60 DCHECK(response->headers.get()); | 60 int rv = auth->HandleAuthChallenge(*response, false, true, net_log); |
61 int rv = auth->HandleAuthChallenge(response->headers, false, true, net_log); | |
62 response->auth_challenge = auth->auth_info(); | 61 response->auth_challenge = auth->auth_info(); |
63 if (rv == OK) | 62 if (rv == OK) |
64 return ERR_PROXY_AUTH_REQUESTED; | 63 return ERR_PROXY_AUTH_REQUESTED; |
65 return rv; | 64 return rv; |
66 } | 65 } |
67 | 66 |
68 // static | 67 // static |
69 void ProxyClientSocket::LogBlockedTunnelResponse(int http_status_code, | 68 void ProxyClientSocket::LogBlockedTunnelResponse(int http_status_code, |
70 bool is_https_proxy) { | 69 bool is_https_proxy) { |
71 if (is_https_proxy) { | 70 if (is_https_proxy) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 location.c_str()); | 126 location.c_str()); |
128 std::string raw_headers = | 127 std::string raw_headers = |
129 HttpUtil::AssembleRawHeaders(fake_response_headers.data(), | 128 HttpUtil::AssembleRawHeaders(fake_response_headers.data(), |
130 fake_response_headers.length()); | 129 fake_response_headers.length()); |
131 response->headers = new HttpResponseHeaders(raw_headers); | 130 response->headers = new HttpResponseHeaders(raw_headers); |
132 | 131 |
133 return true; | 132 return true; |
134 } | 133 } |
135 | 134 |
136 } // namespace net | 135 } // namespace net |
OLD | NEW |