cvs: pear /HTTP_Request2/Request2/Adapter Socket.php

From: Date: Sun, 03 May 2009 10:46:42 +0000
Subject: cvs: pear /HTTP_Request2/Request2/Adapter Socket.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-56028@lists.php.net to get a copy of this message
avb Sun May 3 10:46:42 2009 UTC Modified files: /pear/HTTP_Request2/Request2/Adapter Socket.php Log: When reusing the socket, ensure that it's still connected (bug #16149) Do not overwrite the custom 'Host' header (bug #16146) http://cvs.php.net/viewvc.cgi/pear/HTTP_Request2/Request2/Adapter/Socket.php?r1=1.11&r2=1.12&diff_format=u Index: pear/HTTP_Request2/Request2/Adapter/Socket.php diff -u pear/HTTP_Request2/Request2/Adapter/Socket.php:1.11 pear/HTTP_Request2/Request2/Adapter/Socket.php:1.12 --- pear/HTTP_Request2/Request2/Adapter/Socket.php:1.11 Fri Apr 3 21:32:48 2009 +++ pear/HTTP_Request2/Request2/Adapter/Socket.php Sun May 3 10:46:42 2009 @@ -37,7 +37,7 @@ * @package HTTP_Request2 * @author Alexey Borzov <avb@php.net> * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Socket.php,v 1.11 2009/04/03 21:32:48 avb Exp $ + * @version CVS: $Id: Socket.php,v 1.12 2009/05/03 10:46:42 avb Exp $ * @link http://pear.php.net/package/HTTP_Request2 */ @@ -260,7 +260,10 @@ unset($this->socket); // We use persistent connections and have a connected socket? - if ($keepAlive && !empty(self::$sockets[$socketKey])) { + // Ensure that the socket is still connected, see bug #16149 + if ($keepAlive && !empty(self::$sockets[$socketKey]) && + !feof(self::$sockets[$socketKey]) + ) { $this->socket =& self::$sockets[$socketKey]; } elseif ($secure && $proxy && !$tunnel) { @@ -733,7 +736,10 @@ if (($port = $url->getPort()) && $port != $defaultPort || $connect) { $host .= ':' . (empty($port)? $defaultPort: $port); } - $headers['host'] = $host; + // Do not overwrite explicitly set 'Host' header, see bug #16146 + if (!isset($headers['host'])) { + $headers['host'] = $host; + } if ($connect) { $requestUrl = $host;

« previous php.pear.cvs (#56028) next »