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

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

Issue 3066031: Merge 54714 - Recommit 54405 - Fix late binding induced mismatch of Socket an... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Fix merge problems Created 10 years, 4 months 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 16 matching lines...) Expand all
27 class HttpStream; 27 class HttpStream;
28 class IOBuffer;; 28 class IOBuffer;;
29 29
30 class HttpProxyClientSocket : public ClientSocket { 30 class HttpProxyClientSocket : public ClientSocket {
31 public: 31 public:
32 // Takes ownership of |transport_socket|, which should already be connected 32 // Takes ownership of |transport_socket|, which should already be connected
33 // by the time Connect() is called. If tunnel is true then on Connect() 33 // by the time Connect() is called. If tunnel is true then on Connect()
34 // this socket will establish an Http tunnel. 34 // this socket will establish an Http tunnel.
35 HttpProxyClientSocket(ClientSocketHandle* transport_socket, 35 HttpProxyClientSocket(ClientSocketHandle* transport_socket,
36 const GURL& request_url, const HostPortPair& endpoint, 36 const GURL& request_url, const HostPortPair& endpoint,
37 const scoped_refptr<HttpAuthController>& auth, 37 const HostPortPair& proxy_server,
38 const scoped_refptr<HttpNetworkSession>& session,
38 bool tunnel); 39 bool tunnel);
39 40
40 // On destruction Disconnect() is called. 41 // On destruction Disconnect() is called.
41 virtual ~HttpProxyClientSocket(); 42 virtual ~HttpProxyClientSocket();
42 43
43 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then 44 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then
44 // credentials should be added to the HttpAuthController before calling 45 // credentials should be added to the HttpAuthController before calling
45 // RestartWithAuth. 46 // RestartWithAuth.
46 int RestartWithAuth(CompletionCallback* callback); 47 int RestartWithAuth(CompletionCallback* callback);
47 48
48 // Indicates if RestartWithAuth needs to be called. i.e. if Connect 49 const HttpResponseInfo* GetResponseInfo() const {
49 // returned PROXY_AUTH_REQUESTED. Only valid after Connect has been called. 50 return response_.headers ? &response_ : NULL;
50 bool NeedsRestartWithAuth() const; 51 }
51 52
52 const HttpResponseInfo* GetResponseInfo() const { 53 const scoped_refptr<HttpAuthController>& auth_controller() {
53 return response_.headers ? &response_ : NULL; 54 return auth_;
54 } 55 }
55 56
56 // ClientSocket methods: 57 // ClientSocket methods:
57 58
58 // Authenticates to the Http Proxy and then passes data freely. 59 // Authenticates to the Http Proxy and then passes data freely.
59 virtual int Connect(CompletionCallback* callback); 60 virtual int Connect(CompletionCallback* callback);
60 virtual void Disconnect(); 61 virtual void Disconnect();
61 virtual bool IsConnected() const; 62 virtual bool IsConnected() const;
62 virtual bool IsConnectedAndIdle() const; 63 virtual bool IsConnectedAndIdle() const;
63 virtual const BoundNetLog& NetLog() const { return net_log_; } 64 virtual const BoundNetLog& NetLog() const { return net_log_; }
(...skipping 13 matching lines...) Expand all
77 STATE_GENERATE_AUTH_TOKEN, 78 STATE_GENERATE_AUTH_TOKEN,
78 STATE_GENERATE_AUTH_TOKEN_COMPLETE, 79 STATE_GENERATE_AUTH_TOKEN_COMPLETE,
79 STATE_SEND_REQUEST, 80 STATE_SEND_REQUEST,
80 STATE_SEND_REQUEST_COMPLETE, 81 STATE_SEND_REQUEST_COMPLETE,
81 STATE_READ_HEADERS, 82 STATE_READ_HEADERS,
82 STATE_READ_HEADERS_COMPLETE, 83 STATE_READ_HEADERS_COMPLETE,
83 STATE_RESOLVE_CANONICAL_NAME, 84 STATE_RESOLVE_CANONICAL_NAME,
84 STATE_RESOLVE_CANONICAL_NAME_COMPLETE, 85 STATE_RESOLVE_CANONICAL_NAME_COMPLETE,
85 STATE_DRAIN_BODY, 86 STATE_DRAIN_BODY,
86 STATE_DRAIN_BODY_COMPLETE, 87 STATE_DRAIN_BODY_COMPLETE,
88 STATE_TCP_RESTART,
89 STATE_TCP_RESTART_COMPLETE,
87 STATE_DONE, 90 STATE_DONE,
88 }; 91 };
89 92
90 // The size in bytes of the buffer we use to drain the response body that 93 // The size in bytes of the buffer we use to drain the response body that
91 // we want to throw away. The response body is typically a small error 94 // we want to throw away. The response body is typically a small error
92 // page just a few hundred bytes long. 95 // page just a few hundred bytes long.
93 enum { kDrainBodyBufferSize = 1024 }; 96 enum { kDrainBodyBufferSize = 1024 };
94 97
95 int PrepareForAuthRestart(); 98 int PrepareForAuthRestart();
96 int DidDrainBodyForAuthRestart(bool keep_alive); 99 int DidDrainBodyForAuthRestart(bool keep_alive);
97 100
98 int HandleAuthChallenge(); 101 int HandleAuthChallenge();
99 102
100 void LogBlockedTunnelResponse(int response_code) const; 103 void LogBlockedTunnelResponse(int response_code) const;
101 104
102 void DoCallback(int result); 105 void DoCallback(int result);
103 void OnIOComplete(int result); 106 void OnIOComplete(int result);
104 107
105 int DoLoop(int last_io_result); 108 int DoLoop(int last_io_result);
106 int DoGenerateAuthToken(); 109 int DoGenerateAuthToken();
107 int DoGenerateAuthTokenComplete(int result); 110 int DoGenerateAuthTokenComplete(int result);
108 int DoSendRequest(); 111 int DoSendRequest();
109 int DoSendRequestComplete(int result); 112 int DoSendRequestComplete(int result);
110 int DoReadHeaders(); 113 int DoReadHeaders();
111 int DoReadHeadersComplete(int result); 114 int DoReadHeadersComplete(int result);
112 int DoDrainBody(); 115 int DoDrainBody();
113 int DoDrainBodyComplete(int result); 116 int DoDrainBodyComplete(int result);
117 int DoTCPRestart();
118 int DoTCPRestartComplete(int result);
114 119
115 CompletionCallbackImpl<HttpProxyClientSocket> io_callback_; 120 CompletionCallbackImpl<HttpProxyClientSocket> io_callback_;
116 State next_state_; 121 State next_state_;
117 122
118 // Stores the callback to the layer above, called on completing Connect(). 123 // Stores the callback to the layer above, called on completing Connect().
119 CompletionCallback* user_callback_; 124 CompletionCallback* user_callback_;
120 125
121 HttpRequestInfo request_; 126 HttpRequestInfo request_;
122 HttpResponseInfo response_; 127 HttpResponseInfo response_;
123 128
(...skipping 12 matching lines...) Expand all
136 std::string request_headers_; 141 std::string request_headers_;
137 142
138 const BoundNetLog net_log_; 143 const BoundNetLog net_log_;
139 144
140 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); 145 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket);
141 }; 146 };
142 147
143 } // namespace net 148 } // namespace net
144 149
145 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ 150 #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