Chromium Code Reviews| 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.h" | 7 #include "base/metrics/histogram.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 HttpUtil::GetStatusCodesForHistogram()); | 65 HttpUtil::GetStatusCodesForHistogram()); |
| 66 } else { | 66 } else { |
| 67 UMA_HISTOGRAM_CUSTOM_ENUMERATION( | 67 UMA_HISTOGRAM_CUSTOM_ENUMERATION( |
| 68 "Net.BlockedTunnelResponse.HttpProxy", | 68 "Net.BlockedTunnelResponse.HttpProxy", |
| 69 HttpUtil::MapStatusCodeForHistogram(http_status_code), | 69 HttpUtil::MapStatusCodeForHistogram(http_status_code), |
| 70 HttpUtil::GetStatusCodesForHistogram()); | 70 HttpUtil::GetStatusCodesForHistogram()); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | 74 // static |
| 75 bool ProxyClientSocket::SanitizeProxyRedirect(HttpResponseInfo* response, | 75 bool ProxyClientSocket::SanitizeProxyAuth(HttpResponseInfo* response) { |
| 76 const GURL& url) { | 76 DCHECK(response && response->headers.get()); |
| 77 response->headers->RemoveHeader("set-cookie"); | |
| 78 return true; | |
|
Ryan Sleevi
2014/12/01 21:28:49
I have trouble convincing myself a blacklist is th
Ryan Hamilton
2014/12/02 01:50:52
Sounds reasonable! You probably want Proxy-Authent
Deprecated (see juliatuttle)
2014/12/02 20:10:21
Yeah, agreed.
Is there a way that is more efficie
Ryan Hamilton
2014/12/02 20:14:25
As far as kludges go, the "assemble new fake raw h
| |
| 79 } | |
| 80 | |
| 81 // static | |
| 82 bool ProxyClientSocket::SanitizeProxyRedirect(HttpResponseInfo* response) { | |
| 77 DCHECK(response && response->headers.get()); | 83 DCHECK(response && response->headers.get()); |
| 78 | 84 |
| 79 std::string location; | 85 std::string location; |
| 80 if (!response->headers->IsRedirect(&location)) | 86 if (!response->headers->IsRedirect(&location)) |
| 81 return false; | 87 return false; |
| 82 | 88 |
| 83 // Return minimal headers; set "Content-length: 0" to ignore response body. | 89 // Return minimal headers; set "Content-Length: 0" to ignore response body. |
| 84 std::string fake_response_headers = | 90 std::string fake_response_headers = |
| 85 base::StringPrintf("HTTP/1.0 302 Found\n" | 91 base::StringPrintf("HTTP/1.1 302 Found\n" |
| 86 "Location: %s\n" | 92 "Location: %s\n" |
| 87 "Content-length: 0\n" | 93 "Content-Length: 0\n" |
| 88 "Connection: close\n" | 94 "Connection: close\n" |
| 89 "\n", | 95 "\n", |
| 90 location.c_str()); | 96 location.c_str()); |
| 91 std::string raw_headers = | 97 std::string raw_headers = |
| 92 HttpUtil::AssembleRawHeaders(fake_response_headers.data(), | 98 HttpUtil::AssembleRawHeaders(fake_response_headers.data(), |
| 93 fake_response_headers.length()); | 99 fake_response_headers.length()); |
| 94 response->headers = new HttpResponseHeaders(raw_headers); | 100 response->headers = new HttpResponseHeaders(raw_headers); |
| 95 | 101 |
| 96 return true; | 102 return true; |
| 97 } | 103 } |
| 98 | 104 |
| 99 } // namespace net | 105 } // namespace net |
| OLD | NEW |