summaryrefslogtreecommitdiff
path: root/inc/HTTPClient.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2010-09-24 09:56:40 +0200
committerAndreas Gohr <andi@splitbrain.org>2010-09-24 09:56:40 +0200
commit07d7dfcf87238d920900ca468d9399d80d8b7247 (patch)
tree3c4f1b1cd33384759d452080718796c312a21948 /inc/HTTPClient.php
parent82e1432c42fd52261e852ba59d7328759661fb5c (diff)
downloadrpg-07d7dfcf87238d920900ca468d9399d80d8b7247.tar.gz
rpg-07d7dfcf87238d920900ca468d9399d80d8b7247.tar.bz2
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
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r--inc/HTTPClient.php4
1 files changed, 4 insertions, 0 deletions
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;
}