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

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

Issue 8609006: Revert 110879 - Allow chrome to handle 407 auth challenges to CONNECT requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
53 bool using_spdy() { 62 bool using_spdy() {
54 return using_spdy_; 63 return using_spdy_;
55 } 64 }
56 65
57 // ProxyClientSocket methods: 66 // ProxyClientSocket methods:
58 virtual const HttpResponseInfo* GetConnectResponseInfo() const OVERRIDE; 67 virtual const HttpResponseInfo* GetConnectResponseInfo() const OVERRIDE;
59 virtual HttpStream* CreateConnectResponseStream() OVERRIDE; 68 virtual HttpStream* CreateConnectResponseStream() OVERRIDE;
60 virtual int RestartWithAuth(OldCompletionCallback* callback) OVERRIDE;
61 virtual const scoped_refptr<HttpAuthController>& auth_controller() OVERRIDE;
62 69
63 // StreamSocket methods: 70 // StreamSocket methods:
64 virtual int Connect(OldCompletionCallback* callback) OVERRIDE; 71 virtual int Connect(OldCompletionCallback* callback) OVERRIDE;
65 virtual void Disconnect() OVERRIDE; 72 virtual void Disconnect() OVERRIDE;
66 virtual bool IsConnected() const OVERRIDE; 73 virtual bool IsConnected() const OVERRIDE;
67 virtual bool IsConnectedAndIdle() const OVERRIDE; 74 virtual bool IsConnectedAndIdle() const OVERRIDE;
68 virtual const BoundNetLog& NetLog() const OVERRIDE; 75 virtual const BoundNetLog& NetLog() const OVERRIDE;
69 virtual void SetSubresourceSpeculation() OVERRIDE; 76 virtual void SetSubresourceSpeculation() OVERRIDE;
70 virtual void SetOmniboxSpeculation() OVERRIDE; 77 virtual void SetOmniboxSpeculation() OVERRIDE;
71 virtual bool WasEverUsed() const OVERRIDE; 78 virtual bool WasEverUsed() const OVERRIDE;
(...skipping 17 matching lines...) Expand all
89 enum State { 96 enum State {
90 STATE_NONE, 97 STATE_NONE,
91 STATE_GENERATE_AUTH_TOKEN, 98 STATE_GENERATE_AUTH_TOKEN,
92 STATE_GENERATE_AUTH_TOKEN_COMPLETE, 99 STATE_GENERATE_AUTH_TOKEN_COMPLETE,
93 STATE_SEND_REQUEST, 100 STATE_SEND_REQUEST,
94 STATE_SEND_REQUEST_COMPLETE, 101 STATE_SEND_REQUEST_COMPLETE,
95 STATE_READ_HEADERS, 102 STATE_READ_HEADERS,
96 STATE_READ_HEADERS_COMPLETE, 103 STATE_READ_HEADERS_COMPLETE,
97 STATE_DRAIN_BODY, 104 STATE_DRAIN_BODY,
98 STATE_DRAIN_BODY_COMPLETE, 105 STATE_DRAIN_BODY_COMPLETE,
106 STATE_TCP_RESTART,
107 STATE_TCP_RESTART_COMPLETE,
99 STATE_DONE, 108 STATE_DONE,
100 }; 109 };
101 110
102 // The size in bytes of the buffer we use to drain the response body that 111 // The size in bytes of the buffer we use to drain the response body that
103 // we want to throw away. The response body is typically a small error 112 // we want to throw away. The response body is typically a small error
104 // page just a few hundred bytes long. 113 // page just a few hundred bytes long.
105 static const int kDrainBodyBufferSize = 1024; 114 static const int kDrainBodyBufferSize = 1024;
106 115
107 int PrepareForAuthRestart(); 116 int PrepareForAuthRestart();
108 int DidDrainBodyForAuthRestart(bool keep_alive); 117 int DidDrainBodyForAuthRestart(bool keep_alive);
109 118
119 int HandleAuthChallenge();
120
110 void LogBlockedTunnelResponse(int response_code) const; 121 void LogBlockedTunnelResponse(int response_code) const;
111 122
112 void DoCallback(int result); 123 void DoCallback(int result);
113 void OnIOComplete(int result); 124 void OnIOComplete(int result);
114 125
115 int DoLoop(int last_io_result); 126 int DoLoop(int last_io_result);
116 int DoGenerateAuthToken(); 127 int DoGenerateAuthToken();
117 int DoGenerateAuthTokenComplete(int result); 128 int DoGenerateAuthTokenComplete(int result);
118 int DoSendRequest(); 129 int DoSendRequest();
119 int DoSendRequestComplete(int result); 130 int DoSendRequestComplete(int result);
120 int DoReadHeaders(); 131 int DoReadHeaders();
121 int DoReadHeadersComplete(int result); 132 int DoReadHeadersComplete(int result);
122 int DoDrainBody(); 133 int DoDrainBody();
123 int DoDrainBodyComplete(int result); 134 int DoDrainBodyComplete(int result);
135 int DoTCPRestart();
136 int DoTCPRestartComplete(int result);
124 137
125 OldCompletionCallbackImpl<HttpProxyClientSocket> io_callback_; 138 OldCompletionCallbackImpl<HttpProxyClientSocket> io_callback_;
126 State next_state_; 139 State next_state_;
127 140
128 // Stores the callback to the layer above, called on completing Connect(). 141 // Stores the callback to the layer above, called on completing Connect().
129 OldCompletionCallback* user_callback_; 142 OldCompletionCallback* user_callback_;
130 143
131 HttpRequestInfo request_; 144 HttpRequestInfo request_;
132 HttpResponseInfo response_; 145 HttpResponseInfo response_;
133 146
(...skipping 18 matching lines...) Expand all
152 HttpRequestHeaders request_headers_; 165 HttpRequestHeaders request_headers_;
153 166
154 const BoundNetLog net_log_; 167 const BoundNetLog net_log_;
155 168
156 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); 169 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket);
157 }; 170 };
158 171
159 } // namespace net 172 } // namespace net
160 173
161 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ 174 #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