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

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

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 years, 7 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/socks_client_socket.cc ('k') | net/socket/ssl_client_socket_nss.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 #include "net/socket/ssl_client_socket_mac.h" 5 #include "net/socket/ssl_client_socket_mac.h"
6 6
7 #include <CoreServices/CoreServices.h> 7 #include <CoreServices/CoreServices.h>
8 #include <netdb.h> 8 #include <netdb.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 873
874 // Concatenate the hostname and peer address to use as the peer ID. To 874 // Concatenate the hostname and peer address to use as the peer ID. To
875 // resume a session, we must connect to the same server on the same port 875 // resume a session, we must connect to the same server on the same port
876 // using the same hostname (i.e., localhost and 127.0.0.1 are considered 876 // using the same hostname (i.e., localhost and 127.0.0.1 are considered
877 // different peers, which puts us through certificate validation again 877 // different peers, which puts us through certificate validation again
878 // and catches hostname/certificate name mismatches. 878 // and catches hostname/certificate name mismatches.
879 AddressList address; 879 AddressList address;
880 int rv = transport_->socket()->GetPeerAddress(&address); 880 int rv = transport_->socket()->GetPeerAddress(&address);
881 if (rv != OK) 881 if (rv != OK)
882 return rv; 882 return rv;
883 const struct addrinfo* ai = address.head(); 883 const IPEndPoint& endpoint = address.front();
884 std::string peer_id(host_and_port_.ToString()); 884 std::string peer_id(host_and_port_.ToString());
885 peer_id += std::string(reinterpret_cast<char*>(ai->ai_addr), 885 peer_id += std::string(reinterpret_cast<const char*>(&endpoint.address()[0]),
886 ai->ai_addrlen); 886 endpoint.address().size());
887 // SSLSetPeerID() treats peer_id as a binary blob, and makes its 887 // SSLSetPeerID() treats peer_id as a binary blob, and makes its
888 // own copy. 888 // own copy.
889 status = SSLSetPeerID(ssl_context_, peer_id.data(), peer_id.length()); 889 status = SSLSetPeerID(ssl_context_, peer_id.data(), peer_id.length());
890 if (status) 890 if (status)
891 return NetErrorFromOSStatus(status); 891 return NetErrorFromOSStatus(status);
892 892
893 return OK; 893 return OK;
894 } 894 }
895 895
896 void SSLClientSocketMac::DoConnectCallback(int rv) { 896 void SSLClientSocketMac::DoConnectCallback(int rv) {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 if (rv < 0 && rv != ERR_IO_PENDING) { 1432 if (rv < 0 && rv != ERR_IO_PENDING) {
1433 us->write_io_buf_ = NULL; 1433 us->write_io_buf_ = NULL;
1434 return OSStatusFromNetError(rv); 1434 return OSStatusFromNetError(rv);
1435 } 1435 }
1436 1436
1437 // always lie to our caller 1437 // always lie to our caller
1438 return noErr; 1438 return noErr;
1439 } 1439 }
1440 1440
1441 } // namespace net 1441 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socks_client_socket.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698