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 #ifndef NET_HTTP_PROXY_CLIENT_SOCKET_H_ | 5 #ifndef NET_HTTP_PROXY_CLIENT_SOCKET_H_ |
6 #define NET_HTTP_PROXY_CLIENT_SOCKET_H_ | 6 #define NET_HTTP_PROXY_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/socket/ssl_client_socket.h" | 10 #include "net/socket/ssl_client_socket.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Returns true of the connection to the proxy is using SPDY. | 50 // Returns true of the connection to the proxy is using SPDY. |
51 virtual bool IsUsingSpdy() const = 0; | 51 virtual bool IsUsingSpdy() const = 0; |
52 | 52 |
53 // Returns the protocol negotiated with the proxy. | 53 // Returns the protocol negotiated with the proxy. |
54 virtual NextProto GetProtocolNegotiated() const = 0; | 54 virtual NextProto GetProtocolNegotiated() const = 0; |
55 | 55 |
56 protected: | 56 protected: |
57 // The HTTP CONNECT method for establishing a tunnel connection is documented | 57 // The HTTP CONNECT method for establishing a tunnel connection is documented |
58 // in draft-luotonen-web-proxy-tunneling-01.txt and RFC 2817, Sections 5.2 | 58 // in draft-luotonen-web-proxy-tunneling-01.txt and RFC 2817, Sections 5.2 |
59 // and 5.3. | 59 // and 5.3. |
60 static void BuildTunnelRequest(const HttpRequestInfo& request_info, | 60 static void BuildTunnelRequest(const HostPortPair& endpoint, |
61 const HttpRequestHeaders& auth_headers, | 61 const HttpRequestHeaders& auth_headers, |
62 const HostPortPair& endpoint, | 62 const std::string& user_agent, |
63 std::string* request_line, | 63 std::string* request_line, |
64 HttpRequestHeaders* request_headers); | 64 HttpRequestHeaders* request_headers); |
65 | 65 |
66 // When an auth challenge (407 response) is received during tunnel | 66 // When an auth challenge (407 response) is received during tunnel |
67 // construction/ this method should be called. | 67 // construction/ this method should be called. |
68 static int HandleProxyAuthChallenge(HttpAuthController* auth, | 68 static int HandleProxyAuthChallenge(HttpAuthController* auth, |
69 HttpResponseInfo* response, | 69 HttpResponseInfo* response, |
70 const BoundNetLog& net_log); | 70 const BoundNetLog& net_log); |
71 | 71 |
72 // Logs (to the log and in a histogram) a blocked CONNECT response. | 72 // Logs (to the log and in a histogram) a blocked CONNECT response. |
73 static void LogBlockedTunnelResponse(int http_response_code, | 73 static void LogBlockedTunnelResponse(int http_response_code, |
74 const GURL& url, | |
75 bool is_https_proxy); | 74 bool is_https_proxy); |
76 | 75 |
77 // When a proxy authentication response is received during tunnel | 76 // When a proxy authentication response is received during tunnel |
78 // construction, this method should be called to strip everything | 77 // construction, this method should be called to strip everything |
79 // but the auth header from the redirect response. If it returns | 78 // but the auth header from the redirect response. If it returns |
80 // false, the response should be discarded and tunnel construction should | 79 // false, the response should be discarded and tunnel construction should |
81 // fail. | 80 // fail. |
82 static bool SanitizeProxyAuth(HttpResponseInfo* response); | 81 static bool SanitizeProxyAuth(HttpResponseInfo* response); |
83 | 82 |
84 // When a redirect (e.g. 302 response) is received during tunnel | 83 // When a redirect (e.g. 302 response) is received during tunnel |
85 // construction, this method should be called to strip everything | 84 // construction, this method should be called to strip everything |
86 // but the Location header from the redirect response. If it returns | 85 // but the Location header from the redirect response. If it returns |
87 // false, the response should be discarded and tunnel construction should | 86 // false, the response should be discarded and tunnel construction should |
88 // fail. | 87 // fail. |
89 static bool SanitizeProxyRedirect(HttpResponseInfo* response); | 88 static bool SanitizeProxyRedirect(HttpResponseInfo* response); |
90 | 89 |
91 private: | 90 private: |
92 DISALLOW_COPY_AND_ASSIGN(ProxyClientSocket); | 91 DISALLOW_COPY_AND_ASSIGN(ProxyClientSocket); |
93 }; | 92 }; |
94 | 93 |
95 } // namespace net | 94 } // namespace net |
96 | 95 |
97 #endif // NET_HTTP_PROXY_CLIENT_SOCKET_H_ | 96 #endif // NET_HTTP_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |