diff options
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r-- | inc/HTTPClient.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index b6feba35a..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 <andi@splitbrain.org> */ @@ -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'; @@ -275,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; } @@ -458,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; } @@ -555,6 +560,7 @@ class HTTPClient { * @author Andreas Gohr <andi@splitbrain.org> */ function _postEncode($data){ + $url = ''; foreach($data as $key => $val){ if($url) $url .= '&'; $url .= urlencode($key).'='.urlencode($val); |