diff options
author | Dominik Eckelmann <deckelmann@gmail.com> | 2012-03-14 12:52:36 +0100 |
---|---|---|
committer | Dominik Eckelmann <deckelmann@gmail.com> | 2012-03-14 12:52:36 +0100 |
commit | 3a6d76070be7220b8e5f7c04443aa923bc8cddf2 (patch) | |
tree | dfd00b5d0c5f58ee313eb376a8cb1ee99512bf83 /inc/HTTPClient.php | |
parent | 03d7247e047c21d2733f837148a1499f56784ae3 (diff) | |
parent | d0caa5642f6e322a026bd5bdac4585ff1b2f40da (diff) | |
download | rpg-3a6d76070be7220b8e5f7c04443aa923bc8cddf2.tar.gz rpg-3a6d76070be7220b8e5f7c04443aa923bc8cddf2.tar.bz2 |
Merge branch 'master' of https://github.com/splitbrain/dokuwiki
Conflicts:
lib/exe/xmlrpc.php
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r-- | inc/HTTPClient.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index fdf95d113..f0470e736 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -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; |