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

Side by Side Diff: runtime/bin/secure_socket.cc

Issue 14036017: Revert "Add new InternetAddress class with a static lookup function (including IPv6 results)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « runtime/bin/dbg_connection.cc ('k') | runtime/bin/socket.h » ('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 Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/secure_socket.h" 5 #include "bin/secure_socket.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 static_cast<void*>(this)); 553 static_cast<void*>(this));
554 554
555 PRBool as_server = is_server ? PR_TRUE : PR_FALSE; 555 PRBool as_server = is_server ? PR_TRUE : PR_FALSE;
556 status = SSL_ResetHandshake(filter_, as_server); 556 status = SSL_ResetHandshake(filter_, as_server);
557 if (status != SECSuccess) { 557 if (status != SECSuccess) {
558 ThrowPRException("Failed SSL_ResetHandshake call"); 558 ThrowPRException("Failed SSL_ResetHandshake call");
559 } 559 }
560 560
561 // SetPeerAddress 561 // SetPeerAddress
562 PRNetAddr host_address; 562 PRNetAddr host_address;
563 PRAddrInfo* info = PR_GetAddrInfoByName(host_name, 563 char host_entry_buffer[PR_NETDB_BUF_SIZE];
564 PR_AF_UNSPEC, 564 PRHostEnt host_entry;
565 PR_AI_ADDRCONFIG); 565 PRStatus rv = PR_GetHostByName(host_name, host_entry_buffer,
566 if (info == NULL) { 566 PR_NETDB_BUF_SIZE, &host_entry);
567 ThrowPRException("Failed PR_GetAddrInfoByName call"); 567 if (rv != PR_SUCCESS) {
568 ThrowPRException("Failed PR_GetHostByName call");
568 } 569 }
569 570
570 PR_EnumerateAddrInfo(0, info, port, &host_address); 571 int index = PR_EnumerateHostEnt(0, &host_entry, port, &host_address);
571 572 if (index == -1 || index == 0) {
573 ThrowPRException("Failed PR_EnumerateHostEnt call");
574 }
572 memio_SetPeerName(filter_, &host_address); 575 memio_SetPeerName(filter_, &host_address);
573 PR_FreeAddrInfo(info);
574 } 576 }
575 577
576 578
577 void SSLFilter::Handshake() { 579 void SSLFilter::Handshake() {
578 SECStatus status = SSL_ForceHandshake(filter_); 580 SECStatus status = SSL_ForceHandshake(filter_);
579 if (status == SECSuccess) { 581 if (status == SECSuccess) {
580 if (in_handshake_) { 582 if (in_handshake_) {
581 ThrowIfError(Dart_InvokeClosure(handshake_complete_, 0, NULL)); 583 ThrowIfError(Dart_InvokeClosure(handshake_complete_, 0, NULL));
582 in_handshake_ = false; 584 in_handshake_ = false;
583 } 585 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 if (PR_WOULD_BLOCK_ERROR != pr_error) { 709 if (PR_WOULD_BLOCK_ERROR != pr_error) {
708 ThrowPRException("Error reading plaintext from SSLFilter"); 710 ThrowPRException("Error reading plaintext from SSLFilter");
709 } 711 }
710 bytes_processed = 0; 712 bytes_processed = 0;
711 } 713 }
712 break; 714 break;
713 } 715 }
714 } 716 }
715 return bytes_processed; 717 return bytes_processed;
716 } 718 }
OLDNEW
« no previous file with comments | « runtime/bin/dbg_connection.cc ('k') | runtime/bin/socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698