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

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

Issue 503038: Fix SSL error code for unexpected errSSLClosedGraceful on Mac (Closed)
Patch Set: Created 11 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
« no previous file with comments | « no previous file | no next file » | 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) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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/socket/ssl_client_socket_mac.h" 5 #include "net/socket/ssl_client_socket_mac.h"
6 6
7 #include "base/scoped_cftyperef.h" 7 #include "base/scoped_cftyperef.h"
8 #include "base/singleton.h" 8 #include "base/singleton.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/cert_verifier.h" 10 #include "net/base/cert_verifier.h"
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 next_handshake_state_ = STATE_VERIFY_CERT; 702 next_handshake_state_ = STATE_VERIFY_CERT;
703 if (status == errSSLServerAuthCompletedFlag) { 703 if (status == errSSLServerAuthCompletedFlag) {
704 // Override errSSLServerAuthCompletedFlag as it's not actually an error, 704 // Override errSSLServerAuthCompletedFlag as it's not actually an error,
705 // but rather an indication that we're only half way through the 705 // but rather an indication that we're only half way through the
706 // handshake. 706 // handshake.
707 handshake_interrupted_ = true; 707 handshake_interrupted_ = true;
708 status = noErr; 708 status = noErr;
709 } 709 }
710 } 710 }
711 711
712 if (status == errSSLClosedGraceful) 712 if (status == errSSLClosedGraceful) {
713 // The server unexpectedly closed on us. 713 // The server unexpectedly closed on us.
714 return ERR_UNEXPECTED; 714 return ERR_SSL_PROTOCOL_ERROR;
715 }
715 716
716 int net_error = NetErrorFromOSStatus(status); 717 int net_error = NetErrorFromOSStatus(status);
717 if (status == noErr || IsCertificateError(net_error)) { 718 if (status == noErr || IsCertificateError(net_error)) {
718 server_cert_ = GetServerCert(ssl_context_); 719 server_cert_ = GetServerCert(ssl_context_);
719 if (!server_cert_) 720 if (!server_cert_)
720 return ERR_UNEXPECTED; 721 return ERR_UNEXPECTED;
721 } 722 }
722 return net_error; 723 return net_error;
723 } 724 }
724 725
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 return result; 763 return result;
763 } 764 }
764 765
765 int SSLClientSocketMac::DoHandshakeFinish() { 766 int SSLClientSocketMac::DoHandshakeFinish() {
766 OSStatus status = SSLHandshake(ssl_context_); 767 OSStatus status = SSLHandshake(ssl_context_);
767 768
768 if (status == errSSLWouldBlock) 769 if (status == errSSLWouldBlock)
769 next_handshake_state_ = STATE_HANDSHAKE_FINISH; 770 next_handshake_state_ = STATE_HANDSHAKE_FINISH;
770 771
771 if (status == errSSLClosedGraceful) 772 if (status == errSSLClosedGraceful)
772 return ERR_UNEXPECTED; 773 return ERR_SSL_PROTOCOL_ERROR;
773 774
774 if (status == noErr) { 775 if (status == noErr) {
775 completed_handshake_ = true; 776 completed_handshake_ = true;
776 DCHECK(next_handshake_state_ == STATE_NONE); 777 DCHECK(next_handshake_state_ == STATE_NONE);
777 } 778 }
778 779
779 return NetErrorFromOSStatus(status); 780 return NetErrorFromOSStatus(status);
780 } 781 }
781 782
782 int SSLClientSocketMac::DoPayloadRead() { 783 int SSLClientSocketMac::DoPayloadRead() {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 if (rv < 0 && rv != ERR_IO_PENDING) { 916 if (rv < 0 && rv != ERR_IO_PENDING) {
916 us->write_io_buf_ = NULL; 917 us->write_io_buf_ = NULL;
917 return OSStatusFromNetError(rv); 918 return OSStatusFromNetError(rv);
918 } 919 }
919 920
920 // always lie to our caller 921 // always lie to our caller
921 return noErr; 922 return noErr;
922 } 923 }
923 924
924 } // namespace net 925 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698