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

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: Remove inline virtuals 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
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const HostPortPair& proxy_server, 44 const HostPortPair& proxy_server,
45 HttpAuthCache* http_auth_cache, 45 HttpAuthCache* http_auth_cache,
46 HttpAuthHandlerFactory* http_auth_handler_factory, 46 HttpAuthHandlerFactory* http_auth_handler_factory,
47 bool tunnel, 47 bool tunnel,
48 bool using_spdy, 48 bool using_spdy,
49 bool is_https_proxy); 49 bool is_https_proxy);
50 50
51 // On destruction Disconnect() is called. 51 // On destruction Disconnect() is called.
52 virtual ~HttpProxyClientSocket(); 52 virtual ~HttpProxyClientSocket();
53 53
54 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then
55 // credentials should be added to the HttpAuthController before calling
56 // RestartWithAuth.
57 int RestartWithAuth(OldCompletionCallback* callback);
58
59 const scoped_refptr<HttpAuthController>& auth_controller() {
60 return auth_;
61 }
62
63 bool using_spdy() { 54 bool using_spdy() {
64 return using_spdy_; 55 return using_spdy_;
65 } 56 }
66 57
67 // ProxyClientSocket methods: 58 // ProxyClientSocket methods:
68 virtual const HttpResponseInfo* GetConnectResponseInfo() const; 59 virtual const HttpResponseInfo* GetConnectResponseInfo() const;
69 virtual HttpStream* CreateConnectResponseStream(); 60 virtual HttpStream* CreateConnectResponseStream();
61 virtual int RestartWithAuth(OldCompletionCallback* callback);
62 virtual const scoped_refptr<HttpAuthController>& auth_controller();
70 63
71 // StreamSocket methods: 64 // StreamSocket methods:
72 virtual int Connect(OldCompletionCallback* callback); 65 virtual int Connect(OldCompletionCallback* callback);
73 virtual void Disconnect(); 66 virtual void Disconnect();
74 virtual bool IsConnected() const; 67 virtual bool IsConnected() const;
75 virtual bool IsConnectedAndIdle() const; 68 virtual bool IsConnectedAndIdle() const;
76 virtual const BoundNetLog& NetLog() const; 69 virtual const BoundNetLog& NetLog() const;
77 virtual void SetSubresourceSpeculation(); 70 virtual void SetSubresourceSpeculation();
78 virtual void SetOmniboxSpeculation(); 71 virtual void SetOmniboxSpeculation();
79 virtual bool WasEverUsed() const; 72 virtual bool WasEverUsed() const;
(...skipping 13 matching lines...) Expand all
93 enum State { 86 enum State {
94 STATE_NONE, 87 STATE_NONE,
95 STATE_GENERATE_AUTH_TOKEN, 88 STATE_GENERATE_AUTH_TOKEN,
96 STATE_GENERATE_AUTH_TOKEN_COMPLETE, 89 STATE_GENERATE_AUTH_TOKEN_COMPLETE,
97 STATE_SEND_REQUEST, 90 STATE_SEND_REQUEST,
98 STATE_SEND_REQUEST_COMPLETE, 91 STATE_SEND_REQUEST_COMPLETE,
99 STATE_READ_HEADERS, 92 STATE_READ_HEADERS,
100 STATE_READ_HEADERS_COMPLETE, 93 STATE_READ_HEADERS_COMPLETE,
101 STATE_DRAIN_BODY, 94 STATE_DRAIN_BODY,
102 STATE_DRAIN_BODY_COMPLETE, 95 STATE_DRAIN_BODY_COMPLETE,
103 STATE_TCP_RESTART,
104 STATE_TCP_RESTART_COMPLETE,
105 STATE_DONE, 96 STATE_DONE,
106 }; 97 };
107 98
108 // The size in bytes of the buffer we use to drain the response body that 99 // The size in bytes of the buffer we use to drain the response body that
109 // we want to throw away. The response body is typically a small error 100 // we want to throw away. The response body is typically a small error
110 // page just a few hundred bytes long. 101 // page just a few hundred bytes long.
111 static const int kDrainBodyBufferSize = 1024; 102 static const int kDrainBodyBufferSize = 1024;
112 103
113 int PrepareForAuthRestart(); 104 int PrepareForAuthRestart();
114 int DidDrainBodyForAuthRestart(bool keep_alive); 105 int DidDrainBodyForAuthRestart(bool keep_alive);
115 106
116 int HandleAuthChallenge(); 107 int HandleAuthChallenge();
117 108
118 void LogBlockedTunnelResponse(int response_code) const; 109 void LogBlockedTunnelResponse(int response_code) const;
119 110
120 void DoCallback(int result); 111 void DoCallback(int result);
121 void OnIOComplete(int result); 112 void OnIOComplete(int result);
122 113
123 int DoLoop(int last_io_result); 114 int DoLoop(int last_io_result);
124 int DoGenerateAuthToken(); 115 int DoGenerateAuthToken();
125 int DoGenerateAuthTokenComplete(int result); 116 int DoGenerateAuthTokenComplete(int result);
126 int DoSendRequest(); 117 int DoSendRequest();
127 int DoSendRequestComplete(int result); 118 int DoSendRequestComplete(int result);
128 int DoReadHeaders(); 119 int DoReadHeaders();
129 int DoReadHeadersComplete(int result); 120 int DoReadHeadersComplete(int result);
130 int DoDrainBody(); 121 int DoDrainBody();
131 int DoDrainBodyComplete(int result); 122 int DoDrainBodyComplete(int result);
132 int DoTCPRestart();
133 int DoTCPRestartComplete(int result);
134 123
135 OldCompletionCallbackImpl<HttpProxyClientSocket> io_callback_; 124 OldCompletionCallbackImpl<HttpProxyClientSocket> io_callback_;
136 State next_state_; 125 State next_state_;
137 126
138 // Stores the callback to the layer above, called on completing Connect(). 127 // Stores the callback to the layer above, called on completing Connect().
139 OldCompletionCallback* user_callback_; 128 OldCompletionCallback* user_callback_;
140 129
141 HttpRequestInfo request_; 130 HttpRequestInfo request_;
142 HttpResponseInfo response_; 131 HttpResponseInfo response_;
143 132
(...skipping 18 matching lines...) Expand all
162 HttpRequestHeaders request_headers_; 151 HttpRequestHeaders request_headers_;
163 152
164 const BoundNetLog net_log_; 153 const BoundNetLog net_log_;
165 154
166 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); 155 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket);
167 }; 156 };
168 157
169 } // namespace net 158 } // namespace net
170 159
171 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ 160 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698