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

Side by Side Diff: net/base/ssl_client_socket_mac.cc

Issue 43115: Change the bad-certificate handler for SSL (using NSS) to return an... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 #include "net/base/ssl_client_socket_mac.h" 5 #include "net/base/ssl_client_socket_mac.h"
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/base/ssl_info.h" 10 #include "net/base/ssl_info.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 DCHECK(next_state_ == STATE_NONE); 272 DCHECK(next_state_ == STATE_NONE);
273 DCHECK(!user_callback_); 273 DCHECK(!user_callback_);
274 274
275 next_state_ = STATE_CONNECT; 275 next_state_ = STATE_CONNECT;
276 int rv = DoLoop(OK); 276 int rv = DoLoop(OK);
277 if (rv == ERR_IO_PENDING) 277 if (rv == ERR_IO_PENDING)
278 user_callback_ = callback; 278 user_callback_ = callback;
279 return rv; 279 return rv;
280 } 280 }
281 281
282 int SSLClientSocketMac::ReconnectIgnoringLastError(
283 CompletionCallback* callback) {
284 // TODO(darin): implement me!
285 return ERR_FAILED;
286 }
287
288 void SSLClientSocketMac::Disconnect() { 282 void SSLClientSocketMac::Disconnect() {
289 completed_handshake_ = false; 283 completed_handshake_ = false;
290 284
291 if (ssl_context_) { 285 if (ssl_context_) {
292 SSLClose(ssl_context_); 286 SSLClose(ssl_context_);
293 SSLDisposeContext(ssl_context_); 287 SSLDisposeContext(ssl_context_);
294 ssl_context_ = NULL; 288 ssl_context_ = NULL;
295 } 289 }
296 290
297 transport_->Disconnect(); 291 transport_->Disconnect();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 rv = ERR_UNEXPECTED; 438 rv = ERR_UNEXPECTED;
445 NOTREACHED() << "unexpected state"; 439 NOTREACHED() << "unexpected state";
446 break; 440 break;
447 } 441 }
448 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); 442 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
449 return rv; 443 return rv;
450 } 444 }
451 445
452 int SSLClientSocketMac::DoConnect() { 446 int SSLClientSocketMac::DoConnect() {
453 next_state_ = STATE_CONNECT_COMPLETE; 447 next_state_ = STATE_CONNECT_COMPLETE;
454 return transport_->Connect(&io_callback_); 448
449 // The caller has to make sure that the transport socket is connected. If
450 // it isn't, we will eventually fail when trying to negotiate an SSL session.
451 // But we cannot call transport_->Connect(), as we do not know if there is
452 // any proxy negotiation that needs to be performed prior to establishing
453 // the SSL session.
454 return OK;
455 } 455 }
456 456
457 int SSLClientSocketMac::DoConnectComplete(int result) { 457 int SSLClientSocketMac::DoConnectComplete(int result) {
458 if (result < 0) 458 if (result < 0)
459 return result; 459 return result;
460 460
461 OSStatus status = noErr; 461 OSStatus status = noErr;
462 462
463 status = SSLNewContext(false, &ssl_context_); 463 status = SSLNewContext(false, &ssl_context_);
464 if (status) 464 if (status)
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 757
758 if (rv < 0 && rv != ERR_IO_PENDING) { 758 if (rv < 0 && rv != ERR_IO_PENDING) {
759 return OSStatusFromNetError(rv); 759 return OSStatusFromNetError(rv);
760 } 760 }
761 761
762 // always lie to our caller 762 // always lie to our caller
763 return noErr; 763 return noErr;
764 } 764 }
765 765
766 } // namespace net 766 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698