summaryrefslogtreecommitdiff
path: root/inc/HTTPClient.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2008-02-23 19:36:39 +0100
committerAndreas Gohr <andi@splitbrain.org>2008-02-23 19:36:39 +0100
commitace46cb1e1b6ef39341c73d331fcc1294c2c7e77 (patch)
treee78132bede2e0e562619c02aa481bd3bcb9ef998 /inc/HTTPClient.php
parent73038c47e3312b4c62c4a0a05ecd5cdcd5eb95b7 (diff)
downloadrpg-ace46cb1e1b6ef39341c73d331fcc1294c2c7e77.tar.gz
rpg-ace46cb1e1b6ef39341c73d331fcc1294c2c7e77.tar.bz2
cope with non-RFC-conform webservers in HTTPClient FS#1340
This fixes problems in the HTTP client for web servers which separate their response headers with Unix linfeeds only (instead of CRLFs as stated in RFC 2616). darcs-hash:20080223183639-7ad00-057b05a1134cbe2b8edb2d38d5a74912360cd071.gz
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r--inc/HTTPClient.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index 23a376c39..e34027d02 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -228,13 +228,13 @@ class HTTPClient {
$this->error = 'Premature End of File (socket)';
return false;
}
- $r_headers .= fread($socket,1); #FIXME read full lines here?
- }while(!preg_match('/\r\n\r\n$/',$r_headers));
+ $r_headers .= fgets($socket,1024);
+ }while(!preg_match('/\r?\n\r?\n$/',$r_headers));
$this->_debug('response headers',$r_headers);
// check if expected body size exceeds allowance
- if($this->max_bodysize && preg_match('/\r\nContent-Length:\s*(\d+)\r\n/i',$r_headers,$match)){
+ if($this->max_bodysize && preg_match('/\r?\nContent-Length:\s*(\d+)\r?\n/i',$r_headers,$match)){
if($match[1] > $this->max_bodysize){
$this->error = 'Reported content length exceeds allowed response size';
return false;