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

Side by Side Diff: net/socket/client_socket_handle.h

Issue 4935001: Allow a non-200 (or non-407) response for a CONNECT request from an HTTPS pro... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing the comments from vandebo and willchan Created 10 years 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) 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_SOCKET_CLIENT_SOCKET_HANDLE_H_ 5 #ifndef NET_SOCKET_CLIENT_SOCKET_HANDLE_H_
6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ 6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "net/base/completion_callback.h" 15 #include "net/base/completion_callback.h"
16 #include "net/base/load_states.h" 16 #include "net/base/load_states.h"
17 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
18 #include "net/base/net_log.h" 18 #include "net/base/net_log.h"
19 #include "net/base/request_priority.h" 19 #include "net/base/request_priority.h"
20 #include "net/http/http_response_info.h" 20 #include "net/http/http_response_info.h"
21 #include "net/http/http_stream.h"
22 #include "net/http/proxy_client_socket.h"
21 #include "net/socket/client_socket.h" 23 #include "net/socket/client_socket.h"
22 #include "net/socket/client_socket_pool.h" 24 #include "net/socket/client_socket_pool.h"
23 25
24 namespace net { 26 namespace net {
25 27
26 // A container for a ClientSocket. 28 // A container for a ClientSocket.
27 // 29 //
28 // The handle's |group_name| uniquely identifies the origin and type of the 30 // The handle's |group_name| uniquely identifies the origin and type of the
29 // connection. It is used by the ClientSocketPool to group similar connected 31 // connection. It is used by the ClientSocketPool to group similar connected
30 // client socket objects. 32 // client socket objects.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 104
103 // Used by ClientSocketPool to initialize the ClientSocketHandle. 105 // Used by ClientSocketPool to initialize the ClientSocketHandle.
104 void set_is_reused(bool is_reused) { is_reused_ = is_reused; } 106 void set_is_reused(bool is_reused) { is_reused_ = is_reused; }
105 void set_socket(ClientSocket* s) { socket_.reset(s); } 107 void set_socket(ClientSocket* s) { socket_.reset(s); }
106 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } 108 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; }
107 void set_pool_id(int id) { pool_id_ = id; } 109 void set_pool_id(int id) { pool_id_ = id; }
108 void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; } 110 void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; }
109 void set_ssl_error_response_info(const HttpResponseInfo& ssl_error_state) { 111 void set_ssl_error_response_info(const HttpResponseInfo& ssl_error_state) {
110 ssl_error_response_info_ = ssl_error_state; 112 ssl_error_response_info_ = ssl_error_state;
111 } 113 }
114 void set_https_proxy_tunnel_response_socket(ProxyClientSocket* socket) {
115 https_proxy_tunnel_response_socket_.reset(socket);
116 }
112 void set_pending_http_proxy_connection(ClientSocketHandle* connection) { 117 void set_pending_http_proxy_connection(ClientSocketHandle* connection) {
113 pending_http_proxy_connection_.reset(connection); 118 pending_http_proxy_connection_.reset(connection);
114 } 119 }
115 120
116 // Only valid if there is no |socket_|. 121 // Only valid if there is no |socket_|.
117 bool is_ssl_error() const { 122 bool is_ssl_error() const {
118 DCHECK(socket_.get() == NULL); 123 DCHECK(socket_.get() == NULL);
119 return is_ssl_error_; 124 return is_ssl_error_;
120 } 125 }
121 // On an ERR_PROXY_AUTH_REQUESTED error, the |headers| and |auth_challenge| 126 // On an ERR_PROXY_AUTH_REQUESTED error, the |headers| and |auth_challenge|
122 // fields are filled in. On an ERR_SSL_CLIENT_AUTH_CERT_NEEDED error, 127 // fields are filled in. On an ERR_SSL_CLIENT_AUTH_CERT_NEEDED error,
123 // the |cert_request_info| field is set. 128 // the |cert_request_info| field is set.
124 const HttpResponseInfo& ssl_error_response_info() const { 129 const HttpResponseInfo& ssl_error_response_info() const {
125 return ssl_error_response_info_; 130 return ssl_error_response_info_;
126 } 131 }
132 ProxyClientSocket* release_https_proxy_tunnel_response_socket() {
133 return https_proxy_tunnel_response_socket_.release();
134 }
127 ClientSocketHandle* release_pending_http_proxy_connection() { 135 ClientSocketHandle* release_pending_http_proxy_connection() {
128 return pending_http_proxy_connection_.release(); 136 return pending_http_proxy_connection_.release();
129 } 137 }
130 138
131 // These may only be used if is_initialized() is true. 139 // These may only be used if is_initialized() is true.
132 const std::string& group_name() const { return group_name_; } 140 const std::string& group_name() const { return group_name_; }
133 int id() const { return pool_id_; } 141 int id() const { return pool_id_; }
134 ClientSocket* socket() { return socket_.get(); } 142 ClientSocket* socket() { return socket_.get(); }
135 ClientSocket* release_socket() { return socket_.release(); } 143 ClientSocket* release_socket() { return socket_.release(); }
136 bool is_reused() const { return is_reused_; } 144 bool is_reused() const { return is_reused_; }
(...skipping 28 matching lines...) Expand all
165 ClientSocketPool* pool_; 173 ClientSocketPool* pool_;
166 scoped_ptr<ClientSocket> socket_; 174 scoped_ptr<ClientSocket> socket_;
167 std::string group_name_; 175 std::string group_name_;
168 bool is_reused_; 176 bool is_reused_;
169 CompletionCallbackImpl<ClientSocketHandle> callback_; 177 CompletionCallbackImpl<ClientSocketHandle> callback_;
170 CompletionCallback* user_callback_; 178 CompletionCallback* user_callback_;
171 base::TimeDelta idle_time_; 179 base::TimeDelta idle_time_;
172 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. 180 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation.
173 bool is_ssl_error_; 181 bool is_ssl_error_;
174 HttpResponseInfo ssl_error_response_info_; 182 HttpResponseInfo ssl_error_response_info_;
183 scoped_ptr<ProxyClientSocket> https_proxy_tunnel_response_socket_;
175 scoped_ptr<ClientSocketHandle> pending_http_proxy_connection_; 184 scoped_ptr<ClientSocketHandle> pending_http_proxy_connection_;
176 base::TimeTicks init_time_; 185 base::TimeTicks init_time_;
177 base::TimeDelta setup_time_; 186 base::TimeDelta setup_time_;
178 187
179 NetLog::Source requesting_source_; 188 NetLog::Source requesting_source_;
180 189
181 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle); 190 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle);
182 }; 191 };
183 192
184 // Template function implementation: 193 // Template function implementation:
(...skipping 22 matching lines...) Expand all
207 user_callback_ = callback; 216 user_callback_ = callback;
208 } else { 217 } else {
209 HandleInitCompletion(rv); 218 HandleInitCompletion(rv);
210 } 219 }
211 return rv; 220 return rv;
212 } 221 }
213 222
214 } // namespace net 223 } // namespace net
215 224
216 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ 225 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698