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

Unified Diff: net/http/proxy_client_socket.cc

Issue 1063563002: Simplify the interface to ProxyClientSocket::BuildTunnelRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix WebSocketStreamCreateTest.HandleErrTunnelConnectionFailed Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/proxy_client_socket.h ('k') | net/socket/ssl_client_socket_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/proxy_client_socket.cc
diff --git a/net/http/proxy_client_socket.cc b/net/http/proxy_client_socket.cc
index 3c0d12d5cb2ada770a0e8114c867a44c1fe059fd..ab072d106cdd8f4374eddb73edb36e67456d92ad 100644
--- a/net/http/proxy_client_socket.cc
+++ b/net/http/proxy_client_socket.cc
@@ -33,24 +33,23 @@ void CopyHeaderValues(scoped_refptr<HttpResponseHeaders> source,
// static
void ProxyClientSocket::BuildTunnelRequest(
- const HttpRequestInfo& request_info,
- const HttpRequestHeaders& auth_headers,
const HostPortPair& endpoint,
+ const HttpRequestHeaders& auth_headers,
+ const std::string& user_agent,
std::string* request_line,
HttpRequestHeaders* request_headers) {
// RFC 2616 Section 9 says the Host request-header field MUST accompany all
// HTTP/1.1 requests. Add "Proxy-Connection: keep-alive" for compat with
// HTTP/1.0 proxies such as Squid (required for NTLM authentication).
- *request_line = base::StringPrintf(
- "CONNECT %s HTTP/1.1\r\n", endpoint.ToString().c_str());
- request_headers->SetHeader(HttpRequestHeaders::kHost,
- GetHostAndOptionalPort(request_info.url));
+ std::string host_and_port = endpoint.ToString();
+ *request_line =
+ base::StringPrintf("CONNECT %s HTTP/1.1\r\n", host_and_port.c_str());
+ request_headers->SetHeader(HttpRequestHeaders::kHost, endpoint.port() == 443
+ ? endpoint.host()
+ : host_and_port);
request_headers->SetHeader(HttpRequestHeaders::kProxyConnection,
"keep-alive");
-
- std::string user_agent;
- if (request_info.extra_headers.GetHeader(HttpRequestHeaders::kUserAgent,
- &user_agent))
+ if (!user_agent.empty())
request_headers->SetHeader(HttpRequestHeaders::kUserAgent, user_agent);
request_headers->MergeFrom(auth_headers);
@@ -70,7 +69,6 @@ int ProxyClientSocket::HandleProxyAuthChallenge(HttpAuthController* auth,
// static
void ProxyClientSocket::LogBlockedTunnelResponse(int http_status_code,
- const GURL& url,
bool is_https_proxy) {
if (is_https_proxy) {
UMA_HISTOGRAM_CUSTOM_ENUMERATION(
« no previous file with comments | « net/http/proxy_client_socket.h ('k') | net/socket/ssl_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698