From a963a2b38cf571b29543d17edadc46f91caba3aa Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 24 May 2013 14:08:20 -0400
Subject: [PATCH] Fix connecting when host is specified with protocol prefix e.g. ssl://

---
 program/lib/Net/Socket.php |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/program/lib/Net/Socket.php b/program/lib/Net/Socket.php
index e674111..bf1d1bb 100644
--- a/program/lib/Net/Socket.php
+++ b/program/lib/Net/Socket.php
@@ -4,7 +4,7 @@
  *
  * PHP Version 4
  *
- * Copyright (c) 1997-2003 The PHP Group
+ * Copyright (c) 1997-2013 The PHP Group
  *
  * This source file is subject to version 2.0 of the PHP license,
  * that is bundled with this package in the file LICENSE, and is
@@ -23,7 +23,6 @@
  * @author    Chuck Hagenbuch <chuck@horde.org>
  * @copyright 1997-2003 The PHP Group
  * @license   http://www.php.net/license/2_02.txt PHP 2.02
- * @version   CVS: $Id$
  * @link      http://pear.php.net/packages/Net_Socket
  */
 
@@ -100,7 +99,7 @@
      * Connect to the specified port. If called when the socket is
      * already connected, it disconnects and connects again.
      *
-     * @param string  $addr       IP address or host name.
+     * @param string  $addr       IP address or host name (may be with protocol prefix).
      * @param integer $port       TCP port number.
      * @param boolean $persistent (optional) Whether the connection is
      *                            persistent (kept open between requests
@@ -110,7 +109,7 @@
      *
      * @access public
      *
-     * @return boolean | PEAR_Error  True on success or a PEAR_Error on failure.
+     * @return boolean|PEAR_Error  True on success or a PEAR_Error on failure.
      */
     function connect($addr, $port = 0, $persistent = null,
                      $timeout = null, $options = null)
@@ -122,11 +121,10 @@
 
         if (!$addr) {
             return $this->raiseError('$addr cannot be empty');
-        } elseif (strspn($addr, ':.0123456789') == strlen($addr) ||
-                  strstr($addr, '/') !== false) {
+        } else if (strspn($addr, ':.0123456789') == strlen($addr)) {
             $this->addr = strpos($addr, ':') !== false ? '['.$addr.']' : $addr;
         } else {
-            $this->addr = @gethostbyname($addr);
+            $this->addr = $addr;
         }
 
         $this->port = $port % 65536;

--
Gitblit v1.9.1