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

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

Issue 367963007: Preserve transport errors for OpenSSL sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sleevi comments; also fix last-minute bug introduced in patch set 2 (oops) Created 6 years, 5 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 | « no previous file | net/socket/ssl_client_socket_openssl.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SSL_CLIENT_SOCKET_OPENSSL_H_ 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 // CertVerifyCallback is called to verify the server's certificates. We do 141 // CertVerifyCallback is called to verify the server's certificates. We do
142 // verification after the handshake so this function only enforces that the 142 // verification after the handshake so this function only enforces that the
143 // certificates don't change during renegotiation. 143 // certificates don't change during renegotiation.
144 int CertVerifyCallback(X509_STORE_CTX *store_ctx); 144 int CertVerifyCallback(X509_STORE_CTX *store_ctx);
145 145
146 // Callback from the SSL layer to check which NPN protocol we are supporting 146 // Callback from the SSL layer to check which NPN protocol we are supporting
147 int SelectNextProtoCallback(unsigned char** out, unsigned char* outlen, 147 int SelectNextProtoCallback(unsigned char** out, unsigned char* outlen,
148 const unsigned char* in, unsigned int inlen); 148 const unsigned char* in, unsigned int inlen);
149 149
150 // Called during an operation on |transport_bio_|'s peer. Checks saved
151 // transport error state and, if appropriate, returns an error through
152 // OpenSSL's error system.
153 long MaybeReplayTransportError(BIO *bio,
154 int cmd,
155 const char *argp, int argi, long argl,
156 long retvalue);
157
158 // Callback from the SSL layer when an operation is performed on
159 // |transport_bio_|'s peer.
160 static long BIOCallback(BIO *bio,
161 int cmd,
162 const char *argp, int argi, long argl,
163 long retvalue);
164
150 bool transport_send_busy_; 165 bool transport_send_busy_;
151 bool transport_recv_busy_; 166 bool transport_recv_busy_;
152 bool transport_recv_eof_;
153 167
154 scoped_refptr<DrainableIOBuffer> send_buffer_; 168 scoped_refptr<DrainableIOBuffer> send_buffer_;
155 scoped_refptr<IOBuffer> recv_buffer_; 169 scoped_refptr<IOBuffer> recv_buffer_;
156 170
157 CompletionCallback user_connect_callback_; 171 CompletionCallback user_connect_callback_;
158 CompletionCallback user_read_callback_; 172 CompletionCallback user_read_callback_;
159 CompletionCallback user_write_callback_; 173 CompletionCallback user_write_callback_;
160 174
161 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; 175 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_;
162 176
163 // Used by Read function. 177 // Used by Read function.
164 scoped_refptr<IOBuffer> user_read_buf_; 178 scoped_refptr<IOBuffer> user_read_buf_;
165 int user_read_buf_len_; 179 int user_read_buf_len_;
166 180
167 // Used by Write function. 181 // Used by Write function.
168 scoped_refptr<IOBuffer> user_write_buf_; 182 scoped_refptr<IOBuffer> user_write_buf_;
169 int user_write_buf_len_; 183 int user_write_buf_len_;
170 184
171 // Used by DoPayloadRead() when attempting to fill the caller's buffer with 185 // Used by DoPayloadRead() when attempting to fill the caller's buffer with
172 // as much data as possible without blocking. 186 // as much data as possible without blocking.
173 // If DoPayloadRead() encounters an error after having read some data, stores 187 // If DoPayloadRead() encounters an error after having read some data, stores
174 // the result to return on the *next* call to DoPayloadRead(). A value > 0 188 // the result to return on the *next* call to DoPayloadRead(). A value > 0
175 // indicates there is no pending result, otherwise 0 indicates EOF and < 0 189 // indicates there is no pending result, otherwise 0 indicates EOF and < 0
176 // indicates an error. 190 // indicates an error.
177 int pending_read_error_; 191 int pending_read_error_;
178 192
193 // Used by TransportReadComplete() to signify an error reading from the
194 // transport socket. A value of OK indicates the socket is still
195 // readable. EOFs are mapped to ERR_CONNECTION_CLOSED.
196 int transport_read_error_;
197
179 // Used by TransportWriteComplete() and TransportReadComplete() to signify an 198 // Used by TransportWriteComplete() and TransportReadComplete() to signify an
180 // error writing to the transport socket. A value of OK indicates no error. 199 // error writing to the transport socket. A value of OK indicates no error.
181 int transport_write_error_; 200 int transport_write_error_;
182 201
183 // Set when handshake finishes. 202 // Set when handshake finishes.
184 scoped_ptr<PeerCertificateChain> server_cert_chain_; 203 scoped_ptr<PeerCertificateChain> server_cert_chain_;
185 scoped_refptr<X509Certificate> server_cert_; 204 scoped_refptr<X509Certificate> server_cert_;
186 CertVerifyResult server_cert_verify_result_; 205 CertVerifyResult server_cert_verify_result_;
187 bool completed_handshake_; 206 bool completed_handshake_;
188 207
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // True if channel ID extension was negotiated. 258 // True if channel ID extension was negotiated.
240 bool channel_id_xtn_negotiated_; 259 bool channel_id_xtn_negotiated_;
241 // The request handle for |server_bound_cert_service_|. 260 // The request handle for |server_bound_cert_service_|.
242 ServerBoundCertService::RequestHandle channel_id_request_handle_; 261 ServerBoundCertService::RequestHandle channel_id_request_handle_;
243 BoundNetLog net_log_; 262 BoundNetLog net_log_;
244 }; 263 };
245 264
246 } // namespace net 265 } // namespace net
247 266
248 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ 267 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
OLDNEW
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698