summaryrefslogtreecommitdiff
path: root/inc/HTTPClient.php
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2009-11-04 11:01:15 +0100
committerAdrian Lang <lang@cosmocode.de>2009-11-04 11:01:15 +0100
commitc66972f2cb89e65a8bbf8e39d42e8e479f7eb8dc (patch)
tree3d20030c333e987b42ff101ec339f2120f9f5883 /inc/HTTPClient.php
parent1378fb56f6873b93fe002e8aed001e92857b5b5c (diff)
downloadrpg-c66972f2cb89e65a8bbf8e39d42e8e479f7eb8dc.tar.gz
rpg-c66972f2cb89e65a8bbf8e39d42e8e479f7eb8dc.tar.bz2
Emit less E_NOTICEs and E_STRICTs
Changes of behaviour are: * Allow the user name, title & description \e2\80\9c0\e2\80\9d * Default to Port 443 if using HTTPS * Set $INFO['isadmin'] and $INFO['ismanager'] to \e2\80\9cfalse\e2\80\9d even if no user is logged in * Do not pass empty fragment field in the event data for event ACTION_SHOW_REDIRECT * Handle chunked encoding in HTTPClient darcs-hash:20091104100115-e4919-5cf6397d4a457e3f98a8ca49fbdab03f2147721d.gz
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r--inc/HTTPClient.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index 77b227e06..578d7e7cd 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -198,8 +198,8 @@ class HTTPClient {
if(empty($path)) $path = '/';
if(!empty($uri['query'])) $path .= '?'.$uri['query'];
$port = $uri['port'];
- if($uri['user']) $this->user = $uri['user'];
- if($uri['pass']) $this->pass = $uri['pass'];
+ if(isset($uri['user'])) $this->user = $uri['user'];
+ if(isset($uri['pass'])) $this->pass = $uri['pass'];
// proxy setup
if($this->proxy_host){
@@ -366,7 +366,7 @@ class HTTPClient {
//read body (with chunked encoding if needed)
$r_body = '';
- if(preg_match('/transfer\-(en)?coding:\s*chunked\r\n/i',$r_header)){
+ if(preg_match('/transfer\-(en)?coding:\s*chunked\r\n/i',$r_headers)){
do {
unset($chunk_size);
do {
@@ -416,7 +416,8 @@ class HTTPClient {
else
break;
}
- if($this->resp_headers['content-length'] && !$this->resp_headers['transfer-encoding'] &&
+ if(isset($this->resp_headers['content-length']) &&
+ !isset($this->resp_headers['transfer-encoding']) &&
$this->resp_headers['content-length'] == $r_size){
// we read the content-length, finish here
break;
@@ -429,7 +430,9 @@ class HTTPClient {
fclose($socket);
// decode gzip if needed
- if($this->resp_headers['content-encoding'] == 'gzip' && strlen($r_body) > 10 && substr($r_body,0,3)=="\x1f\x8b\x08"){
+ if(isset($this->resp_headers['content-encoding']) &&
+ $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));
}else{
$this->resp_body = $r_body;
@@ -513,12 +516,12 @@ class HTTPClient {
* @author Andreas Goetz <cpuidle@gmx.de>
*/
function _getCookies(){
+ $headers = '';
foreach ($this->cookies as $key => $val){
- if ($headers) $headers .= '; ';
- $headers .= $key.'='.$val;
+ $headers .= "$key=$val; ";
}
-
- if ($headers) $headers = "Cookie: $headers".HTTP_NL;
+ $headers = substr($headers, 0, -2);
+ if ($headers !== '') $headers = "Cookie: $headers".HTTP_NL;
return $headers;
}