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

Side by Side Diff: net/http/http_proxy_client_socket.h

Issue 8502024: Allow chrome to handle 407 auth challenges to CONNECT requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix typo in unittest Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_proxy_client_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_HTTP_PROXY_CLIENT_SOCKET_H_ 5 #ifndef NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_
6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ 6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const HostPortPair& proxy_server, 43 const HostPortPair& proxy_server,
44 HttpAuthCache* http_auth_cache, 44 HttpAuthCache* http_auth_cache,
45 HttpAuthHandlerFactory* http_auth_handler_factory, 45 HttpAuthHandlerFactory* http_auth_handler_factory,
46 bool tunnel, 46 bool tunnel,
47 bool using_spdy, 47 bool using_spdy,
48 bool is_https_proxy); 48 bool is_https_proxy);
49 49
50 // On destruction Disconnect() is called. 50 // On destruction Disconnect() is called.
51 virtual ~HttpProxyClientSocket(); 51 virtual ~HttpProxyClientSocket();
52 52
53 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then
54 // credentials should be added to the HttpAuthController before calling
55 // RestartWithAuth.
56 int RestartWithAuth(OldCompletionCallback* callback);
57
58 const scoped_refptr<HttpAuthController>& auth_controller() {
59 return auth_;
60 }
61
62 bool using_spdy() { 53 bool using_spdy() {
63 return using_spdy_; 54 return using_spdy_;
64 } 55 }
65 56
66 // ProxyClientSocket methods: 57 // ProxyClientSocket methods:
67 virtual const HttpResponseInfo* GetConnectResponseInfo() const OVERRIDE; 58 virtual const HttpResponseInfo* GetConnectResponseInfo() const OVERRIDE;
68 virtual HttpStream* CreateConnectResponseStream() OVERRIDE; 59 virtual HttpStream* CreateConnectResponseStream() OVERRIDE;
60 virtual int RestartWithAuth(OldCompletionCallback* callback) OVERRIDE;
61 virtual const scoped_refptr<HttpAuthController>& auth_controller() OVERRIDE;
69 62
70 // StreamSocket methods: 63 // StreamSocket methods:
71 virtual int Connect(OldCompletionCallback* callback) OVERRIDE; 64 virtual int Connect(OldCompletionCallback* callback) OVERRIDE;
72 virtual void Disconnect() OVERRIDE; 65 virtual void Disconnect() OVERRIDE;
73 virtual bool IsConnected() const OVERRIDE; 66 virtual bool IsConnected() const OVERRIDE;
74 virtual bool IsConnectedAndIdle() const OVERRIDE; 67 virtual bool IsConnectedAndIdle() const OVERRIDE;
75 virtual const BoundNetLog& NetLog() const OVERRIDE; 68 virtual const BoundNetLog& NetLog() const OVERRIDE;
76 virtual void SetSubresourceSpeculation() OVERRIDE; 69 virtual void SetSubresourceSpeculation() OVERRIDE;
77 virtual void SetOmniboxSpeculation() OVERRIDE; 70 virtual void SetOmniboxSpeculation() OVERRIDE;
78 virtual bool WasEverUsed() const OVERRIDE; 71 virtual bool WasEverUsed() const OVERRIDE;
(...skipping 17 matching lines...) Expand all
96 enum State { 89 enum State {
97 STATE_NONE, 90 STATE_NONE,
98 STATE_GENERATE_AUTH_TOKEN, 91 STATE_GENERATE_AUTH_TOKEN,
99 STATE_GENERATE_AUTH_TOKEN_COMPLETE, 92 STATE_GENERATE_AUTH_TOKEN_COMPLETE,
100 STATE_SEND_REQUEST, 93 STATE_SEND_REQUEST,
101 STATE_SEND_REQUEST_COMPLETE, 94 STATE_SEND_REQUEST_COMPLETE,
102 STATE_READ_HEADERS, 95 STATE_READ_HEADERS,
103 STATE_READ_HEADERS_COMPLETE, 96 STATE_READ_HEADERS_COMPLETE,
104 STATE_DRAIN_BODY, 97 STATE_DRAIN_BODY,
105 STATE_DRAIN_BODY_COMPLETE, 98 STATE_DRAIN_BODY_COMPLETE,
106 STATE_TCP_RESTART,
107 STATE_TCP_RESTART_COMPLETE,
108 STATE_DONE, 99 STATE_DONE,
109 }; 100 };
110 101
111 // The size in bytes of the buffer we use to drain the response body that 102 // The size in bytes of the buffer we use to drain the response body that
112 // we want to throw away. The response body is typically a small error 103 // we want to throw away. The response body is typically a small error
113 // page just a few hundred bytes long. 104 // page just a few hundred bytes long.
114 static const int kDrainBodyBufferSize = 1024; 105 static const int kDrainBodyBufferSize = 1024;
115 106
116 int PrepareForAuthRestart(); 107 int PrepareForAuthRestart();
117 int DidDrainBodyForAuthRestart(bool keep_alive); 108 int DidDrainBodyForAuthRestart(bool keep_alive);
118 109
119 int HandleAuthChallenge();
120
121 void LogBlockedTunnelResponse(int response_code) const; 110 void LogBlockedTunnelResponse(int response_code) const;
122 111
123 void DoCallback(int result); 112 void DoCallback(int result);
124 void OnIOComplete(int result); 113 void OnIOComplete(int result);
125 114
126 int DoLoop(int last_io_result); 115 int DoLoop(int last_io_result);
127 int DoGenerateAuthToken(); 116 int DoGenerateAuthToken();
128 int DoGenerateAuthTokenComplete(int result); 117 int DoGenerateAuthTokenComplete(int result);
129 int DoSendRequest(); 118 int DoSendRequest();
130 int DoSendRequestComplete(int result); 119 int DoSendRequestComplete(int result);
131 int DoReadHeaders(); 120 int DoReadHeaders();
132 int DoReadHeadersComplete(int result); 121 int DoReadHeadersComplete(int result);
133 int DoDrainBody(); 122 int DoDrainBody();
134 int DoDrainBodyComplete(int result); 123 int DoDrainBodyComplete(int result);
135 int DoTCPRestart();
136 int DoTCPRestartComplete(int result);
137 124
138 OldCompletionCallbackImpl<HttpProxyClientSocket> io_callback_; 125 OldCompletionCallbackImpl<HttpProxyClientSocket> io_callback_;
139 State next_state_; 126 State next_state_;
140 127
141 // Stores the callback to the layer above, called on completing Connect(). 128 // Stores the callback to the layer above, called on completing Connect().
142 OldCompletionCallback* user_callback_; 129 OldCompletionCallback* user_callback_;
143 130
144 HttpRequestInfo request_; 131 HttpRequestInfo request_;
145 HttpResponseInfo response_; 132 HttpResponseInfo response_;
146 133
(...skipping 18 matching lines...) Expand all
165 HttpRequestHeaders request_headers_; 152 HttpRequestHeaders request_headers_;
166 153
167 const BoundNetLog net_log_; 154 const BoundNetLog net_log_;
168 155
169 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); 156 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket);
170 }; 157 };
171 158
172 } // namespace net 159 } // namespace net
173 160
174 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ 161 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_proxy_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698