diff options
author | Michael Hamann <michael@content-space.de> | 2010-10-10 14:26:22 +0200 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2010-10-10 14:26:22 +0200 |
commit | 762b4c44c691f69d521413d7016314e7f547c102 (patch) | |
tree | 95ab294b1df2f8c7a5efb56762a0f284bec3754e /inc/HTTPClient.php | |
parent | eae17177de8f3f3580af5ea66d126aee0f23227f (diff) | |
parent | 4ea48b361401e136dbfd3339af368ceeb5b27480 (diff) | |
download | rpg-762b4c44c691f69d521413d7016314e7f547c102.tar.gz rpg-762b4c44c691f69d521413d7016314e7f547c102.tar.bz2 |
Merge remote branch 'origin/master' into sitemap
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); |