diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-04-15 13:45:45 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-04-15 13:45:45 +0200 |
commit | ae7c596cf4e6a0a09ebcf01fe8ae98789360c5be (patch) | |
tree | f156252e404e9893922cb5d984fdc646644b6c17 /inc/HTTPClient.php | |
parent | f41c79d730286e8e8c95deb88a4c876e08e278a2 (diff) | |
parent | 026b314868ee80aca644bf4107f78d8e8052b43e (diff) | |
download | rpg-ae7c596cf4e6a0a09ebcf01fe8ae98789360c5be.tar.gz rpg-ae7c596cf4e6a0a09ebcf01fe8ae98789360c5be.tar.bz2 |
Merge branch 'master' into htmlmail
* master: (382 commits)
Romanian language update
Marathi language update
Arabic Language Update
when there's not enough space for images, make sure they stay proportional (might be FS#2480)
added minimal RTL print styles (part of FS#2185)
moved plugins' rtl.css to their style.css counterpart (part of FS#2185)
removed all browser-specific gradients as the recently (in 42ff6730) introduced svg makes them unnecessary
removed comments from accidentally commented lines in tpl_includeFile()
removed obsolete template file
added tpl_includeFile() to core
Make getTitle method in remote interface public
Changed an error code in XML-RPC interface. This error hasn't anything to do with the rest of the -32600 errors.
BG: language update
Korean language update
fixed performance issues with gradient in Firefox (which also added gradient support for IE9) (FS#2447)
deleted very old (and unused) images
added accidentally removed '<?php' back in (was in 57fc5edd)
wrapped X-UA-Compatible meta tag with conditional comments
added explanation to todo in _forms.css
removed problematic 'overflow: hidden' from lists again ('unfixes' FS#1950)
...
Conflicts:
inc/auth.php
inc/load.php
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r-- | inc/HTTPClient.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index fdf95d113..26bee52a7 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -22,11 +22,11 @@ class DokuHTTPClient extends HTTPClient { * * @author Andreas Gohr <andi@splitbrain.org> */ - function DokuHTTPClient(){ + function __construct(){ global $conf; // call parent constructor - $this->HTTPClient(); + parent::__construct(); // set some values from the config $this->proxy_host = $conf['proxy']['host']; @@ -121,7 +121,7 @@ class HTTPClient { * * @author Andreas Gohr <andi@splitbrain.org> */ - function HTTPClient(){ + function __construct(){ $this->agent = 'Mozilla/4.0 (compatible; DokuWiki HTTP Client; '.PHP_OS.')'; $this->timeout = 15; $this->cookies = array(); @@ -338,7 +338,10 @@ class HTTPClient { } // wait for stream ready or timeout (1sec) - if(stream_select($sel_r,$sel_w,$sel_e,1) === false) continue; + if(@stream_select($sel_r,$sel_w,$sel_e,1) === false){ + usleep(1000); + continue; + } // write to stream $ret = fwrite($socket, substr($request,$written,4096)); @@ -577,13 +580,14 @@ class HTTPClient { */ function _parseHeaders($string){ $headers = array(); - if (!preg_match_all('/^\s*([\w-]+)\s*:\s*([\S \t]+)\s*$/m', $string, - $matches, PREG_SET_ORDER)) { - return $headers; - } - foreach($matches as $match){ - list(, $key, $val) = $match; + $lines = explode("\n",$string); + array_shift($lines); //skip first line (status) + foreach($lines as $line){ + list($key, $val) = explode(':',$line,2); + $key = trim($key); + $val = trim($val); $key = strtolower($key); + if(!$key) continue; if(isset($headers[$key])){ if(is_array($headers[$key])){ $headers[$key][] = $val; |