From 939a27d34f022e4a6103d65f34d2337efc1ca012 Mon Sep 17 00:00:00 2001 From: ai Date: Fri, 17 Sep 2010 08:16:24 +0200 Subject: fixed request server port issue in httpclient --- inc/HTTPClient.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/HTTPClient.php') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index b6feba35a..71b6326ef 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -244,6 +244,7 @@ class HTTPClient { // prepare headers $headers = $this->headers; $headers['Host'] = $uri['host']; + if($uri['port']) $headers['Host'].= ':'.$uri['port']; $headers['User-Agent'] = $this->agent; $headers['Referer'] = $this->referer; $headers['Connection'] = 'Close'; -- cgit v1.2.3 From 07d7dfcf87238d920900ca468d9399d80d8b7247 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 24 Sep 2010 09:56:40 +0200 Subject: ignore wrong content-encoding header FS#2037 Some servers send a content-encoding for gzip files but do not encode the content themselves. This is IMHO wrong, this patch detects this and ignores the header. The request will return true but set a warning message in $this->error --- inc/HTTPClient.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'inc/HTTPClient.php') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 71b6326ef..eea01f9d5 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -459,6 +459,10 @@ class HTTPClient { $this->resp_headers['content-encoding'] == 'gzip' && strlen($r_body) > 10 && substr($r_body,0,3)=="\x1f\x8b\x08"){ $this->resp_body = @gzinflate(substr($r_body, 10)); + if($this->resp_body === false){ + $this->error = 'Failed to decompress gzip encoded content'; + $this->resp_body = $r_body; + } }else{ $this->resp_body = $r_body; } -- cgit v1.2.3 From de3eb1d7f990c4cc17722ce3bdff7b9568ab8b9c Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Tue, 28 Sep 2010 16:38:14 +0200 Subject: Small fixes / cleanup --- inc/HTTPClient.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc/HTTPClient.php') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index eea01f9d5..4e64668d5 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -276,7 +276,7 @@ class HTTPClient { // open socket $socket = @fsockopen($server,$port,$errno, $errstr, $this->timeout); if (!$socket){ - $resp->status = '-100'; + $this->status = -100; $this->error = "Could not connect to $server:$port\n$errstr ($errno)"; return false; } @@ -560,6 +560,7 @@ class HTTPClient { * @author Andreas Gohr */ function _postEncode($data){ + $url = ''; foreach($data as $key => $val){ if($url) $url .= '&'; $url .= urlencode($key).'='.urlencode($val); -- cgit v1.2.3 From efdfac804e869e989b8346a0445d488c4d9e5d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 3 Oct 2010 18:22:23 +0300 Subject: - fix phpdoc --- inc/HTTPClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/HTTPClient.php') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 4e64668d5..e68679bde 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -161,7 +161,7 @@ class HTTPClient { * will be correctly encoded and added to the given base URL. * * @param string $url The URL to fetch - * @param string $data Associative array of parameters + * @param array $data Associative array of parameters * @param bool $sloppy304 Return body on 304 not modified * @author Andreas Gohr */ -- cgit v1.2.3