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/http_proxy_client_socket.h" | 5 #include "net/http/http_proxy_client_socket.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "net/http/http_stream_parser.h" | 21 #include "net/http/http_stream_parser.h" |
22 #include "net/http/proxy_connect_redirect_http_stream.h" | 22 #include "net/http/proxy_connect_redirect_http_stream.h" |
23 #include "net/log/net_log.h" | 23 #include "net/log/net_log.h" |
24 #include "net/socket/client_socket_handle.h" | 24 #include "net/socket/client_socket_handle.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 namespace net { | 27 namespace net { |
28 | 28 |
29 HttpProxyClientSocket::HttpProxyClientSocket( | 29 HttpProxyClientSocket::HttpProxyClientSocket( |
30 ClientSocketHandle* transport_socket, | 30 ClientSocketHandle* transport_socket, |
31 const GURL& request_url, | |
32 const std::string& user_agent, | 31 const std::string& user_agent, |
33 const HostPortPair& endpoint, | 32 const HostPortPair& endpoint, |
34 const HostPortPair& proxy_server, | 33 const HostPortPair& proxy_server, |
35 HttpAuthCache* http_auth_cache, | 34 HttpAuthCache* http_auth_cache, |
36 HttpAuthHandlerFactory* http_auth_handler_factory, | 35 HttpAuthHandlerFactory* http_auth_handler_factory, |
37 bool tunnel, | 36 bool tunnel, |
38 bool using_spdy, | 37 bool using_spdy, |
39 NextProto protocol_negotiated, | 38 NextProto protocol_negotiated, |
40 ProxyDelegate* proxy_delegate, | 39 ProxyDelegate* proxy_delegate, |
41 bool is_https_proxy) | 40 bool is_https_proxy) |
(...skipping 11 matching lines...) Expand all Loading... | |
53 : NULL), | 52 : NULL), |
54 tunnel_(tunnel), | 53 tunnel_(tunnel), |
55 using_spdy_(using_spdy), | 54 using_spdy_(using_spdy), |
56 protocol_negotiated_(protocol_negotiated), | 55 protocol_negotiated_(protocol_negotiated), |
57 is_https_proxy_(is_https_proxy), | 56 is_https_proxy_(is_https_proxy), |
58 redirect_has_load_timing_info_(false), | 57 redirect_has_load_timing_info_(false), |
59 proxy_server_(proxy_server), | 58 proxy_server_(proxy_server), |
60 proxy_delegate_(proxy_delegate), | 59 proxy_delegate_(proxy_delegate), |
61 net_log_(transport_socket->socket()->NetLog()) { | 60 net_log_(transport_socket->socket()->NetLog()) { |
62 // Synthesize the bits of a request that we actually use. | 61 // Synthesize the bits of a request that we actually use. |
63 request_.url = request_url; | 62 request_.url = GURL("https://" + endpoint.ToString()); |
ramant (doing other things)
2015/04/06 05:27:53
nit: should we support http and do (is_https_proxy
ramant (doing other things)
2015/04/06 05:34:13
it looks like CONNECT could be used for port 80.
Ryan Hamilton
2015/04/06 14:06:23
So this class in only used when making CONNECT tun
| |
64 request_.method = "GET"; | 63 request_.method = "CONNECT"; |
65 if (!user_agent.empty()) | 64 if (!user_agent.empty()) |
66 request_.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, | 65 request_.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
67 user_agent); | 66 user_agent); |
68 } | 67 } |
69 | 68 |
70 HttpProxyClientSocket::~HttpProxyClientSocket() { | 69 HttpProxyClientSocket::~HttpProxyClientSocket() { |
71 Disconnect(); | 70 Disconnect(); |
72 } | 71 } |
73 | 72 |
74 int HttpProxyClientSocket::RestartWithAuth(const CompletionCallback& callback) { | 73 int HttpProxyClientSocket::RestartWithAuth(const CompletionCallback& callback) { |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 "462784 HttpProxyClientSocket::DoTCPRestartComplete")); | 555 "462784 HttpProxyClientSocket::DoTCPRestartComplete")); |
557 | 556 |
558 if (result != OK) | 557 if (result != OK) |
559 return result; | 558 return result; |
560 | 559 |
561 next_state_ = STATE_GENERATE_AUTH_TOKEN; | 560 next_state_ = STATE_GENERATE_AUTH_TOKEN; |
562 return result; | 561 return result; |
563 } | 562 } |
564 | 563 |
565 } // namespace net | 564 } // namespace net |
OLD | NEW |