diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2013-07-30 10:50:52 +0200 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2013-07-30 10:50:52 +0200 |
commit | af07997c5ff7cc096965159d90158e3710d2d019 (patch) | |
tree | defaf770e77a679436eb56291185905b547640d0 /inc/HTTPClient.php | |
parent | bdac741579f8c6f00248d5d3ec635d4c2e08fb1e (diff) | |
parent | 7d8a6abbb21979fd77dca10275ebb8e01a04b6e4 (diff) | |
download | rpg-af07997c5ff7cc096965159d90158e3710d2d019.tar.gz rpg-af07997c5ff7cc096965159d90158e3710d2d019.tar.bz2 |
Merge branch 'master' into configmgr_improvements
Conflicts:
inc/auth.php
inc/template.php
lib/plugins/authad/lang/zh/settings.php
lib/plugins/authldap/lang/en/settings.php
lib/plugins/authldap/lang/zh/settings.php
lib/plugins/authmysql/lang/zh/settings.php
lib/plugins/config/settings/config.class.php
lib/plugins/usermanager/admin.php
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r-- | inc/HTTPClient.php | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 772b580b2..0d7b80cf8 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -570,11 +570,6 @@ class HTTPClient { * @author Tom N Harris <tnharris@whoopdedo.org> */ function _sendData($socket, $data, $message) { - // select parameters - $sel_r = null; - $sel_w = array($socket); - $sel_e = null; - // send request $towrite = strlen($data); $written = 0; @@ -586,6 +581,10 @@ class HTTPClient { if(feof($socket)) throw new HTTPClientException("Socket disconnected while writing $message"); + // select parameters + $sel_r = null; + $sel_w = array($socket); + $sel_e = null; // wait for stream ready or timeout (1sec) if(@stream_select($sel_r,$sel_w,$sel_e,1) === false){ usleep(1000); @@ -615,11 +614,6 @@ class HTTPClient { * @author Tom N Harris <tnharris@whoopdedo.org> */ function _readData($socket, $nbytes, $message, $ignore_eof = false) { - // select parameters - $sel_r = array($socket); - $sel_w = null; - $sel_e = null; - $r_data = ''; // Does not return immediately so timeout and eof can be checked if ($nbytes < 0) $nbytes = 0; @@ -637,6 +631,10 @@ class HTTPClient { } if ($to_read > 0) { + // select parameters + $sel_r = array($socket); + $sel_w = null; + $sel_e = null; // wait for stream ready or timeout (1sec) if(@stream_select($sel_r,$sel_w,$sel_e,1) === false){ usleep(1000); @@ -665,21 +663,20 @@ class HTTPClient { * @author Tom N Harris <tnharris@whoopdedo.org> */ function _readLine($socket, $message) { - // select parameters - $sel_r = array($socket); - $sel_w = null; - $sel_e = null; - $r_data = ''; do { $time_used = $this->_time() - $this->start; if ($time_used > $this->timeout) throw new HTTPClientException( - sprintf('Timeout while reading %s (%.3fs)', $message, $time_used), + sprintf('Timeout while reading %s (%.3fs) >%s<', $message, $time_used, $r_data), -100); if(feof($socket)) throw new HTTPClientException("Premature End of File (socket) while reading $message"); + // select parameters + $sel_r = array($socket); + $sel_w = null; + $sel_e = null; // wait for stream ready or timeout (1sec) if(@stream_select($sel_r,$sel_w,$sel_e,1) === false){ usleep(1000); @@ -799,7 +796,7 @@ class HTTPClient { $headers .= "$key=$val; "; } $headers = substr($headers, 0, -2); - if ($headers !== '') $headers = "Cookie: $headers".HTTP_NL; + if ($headers) $headers = "Cookie: $headers".HTTP_NL; return $headers; } |