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

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

Issue 10546162: NetLogEventParameter to Callback refactoring 9. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove comment Created 8 years, 6 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/socket/ssl_client_socket_nss.cc ('k') | net/socket/ssl_client_socket_win.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 // OpenSSL binding for SSLClientSocket. The class layout and general principle 5 // OpenSSL binding for SSLClientSocket. The class layout and general principle
6 // of operation is derived from SSLClientSocketNSS. 6 // of operation is derived from SSLClientSocketNSS.
7 7
8 #include "net/socket/ssl_client_socket_openssl.h" 8 #include "net/socket/ssl_client_socket_openssl.h"
9 9
10 #include <openssl/ssl.h> 10 #include <openssl/ssl.h>
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 // up front. 688 // up front.
689 CompletionCallback c = user_write_callback_; 689 CompletionCallback c = user_write_callback_;
690 user_write_callback_.Reset(); 690 user_write_callback_.Reset();
691 user_write_buf_ = NULL; 691 user_write_buf_ = NULL;
692 user_write_buf_len_ = 0; 692 user_write_buf_len_ = 0;
693 c.Run(rv); 693 c.Run(rv);
694 } 694 }
695 695
696 // StreamSocket implementation. 696 // StreamSocket implementation.
697 int SSLClientSocketOpenSSL::Connect(const CompletionCallback& callback) { 697 int SSLClientSocketOpenSSL::Connect(const CompletionCallback& callback) {
698 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL); 698 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT);
699 699
700 // Set up new ssl object. 700 // Set up new ssl object.
701 if (!Init()) { 701 if (!Init()) {
702 int result = ERR_UNEXPECTED; 702 int result = ERR_UNEXPECTED;
703 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, result); 703 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, result);
704 return result; 704 return result;
705 } 705 }
706 706
707 // Set SSL to client mode. Handshake happens in the loop below. 707 // Set SSL to client mode. Handshake happens in the loop below.
708 SSL_set_connect_state(ssl_); 708 SSL_set_connect_state(ssl_);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 835
836 // If not done, stay in this state 836 // If not done, stay in this state
837 if (net_error == ERR_IO_PENDING) { 837 if (net_error == ERR_IO_PENDING) {
838 GotoState(STATE_HANDSHAKE); 838 GotoState(STATE_HANDSHAKE);
839 } else { 839 } else {
840 LOG(ERROR) << "handshake failed; returned " << rv 840 LOG(ERROR) << "handshake failed; returned " << rv
841 << ", SSL error code " << ssl_error 841 << ", SSL error code " << ssl_error
842 << ", net_error " << net_error; 842 << ", net_error " << net_error;
843 net_log_.AddEvent( 843 net_log_.AddEvent(
844 NetLog::TYPE_SSL_HANDSHAKE_ERROR, 844 NetLog::TYPE_SSL_HANDSHAKE_ERROR,
845 make_scoped_refptr(new SSLErrorParams(net_error, ssl_error))); 845 CreateNetLogSSLErrorCallback(net_error, ssl_error));
846 } 846 }
847 } 847 }
848 return net_error; 848 return net_error;
849 } 849 }
850 850
851 // SelectNextProtoCallback is called by OpenSSL during the handshake. If the 851 // SelectNextProtoCallback is called by OpenSSL during the handshake. If the
852 // server supports NPN, selects a protocol from the list that the server 852 // server supports NPN, selects a protocol from the list that the server
853 // provides. According to third_party/openssl/openssl/ssl/ssl_lib.c, the 853 // provides. According to third_party/openssl/openssl/ssl/ssl_lib.c, the
854 // callback can assume that |in| is syntactically valid. 854 // callback can assume that |in| is syntactically valid.
855 int SSLClientSocketOpenSSL::SelectNextProtoCallback(unsigned char** out, 855 int SSLClientSocketOpenSSL::SelectNextProtoCallback(unsigned char** out,
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_SENT, rv, 1315 net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_SENT, rv,
1316 user_write_buf_->data()); 1316 user_write_buf_->data());
1317 return rv; 1317 return rv;
1318 } 1318 }
1319 1319
1320 int err = SSL_get_error(ssl_, rv); 1320 int err = SSL_get_error(ssl_, rv);
1321 return MapOpenSSLError(err, err_tracer); 1321 return MapOpenSSLError(err, err_tracer);
1322 } 1322 }
1323 1323
1324 } // namespace net 1324 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_nss.cc ('k') | net/socket/ssl_client_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698