[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.net_http_client.inc.php
From: |
Caeies |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.net_http_client.inc.php |
Date: |
Sun, 10 Sep 2006 15:55:07 +0000 |
CVSROOT: /cvsroot/phpgwapi
Module name: phpgwapi
Changes by: Caeies <Caeies> 06/09/10 15:55:07
Modified files:
inc : class.net_http_client.inc.php
Log message:
kill more bugs and E_ALL fixes, string "" replaced
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.net_http_client.inc.php?cvsroot=phpgwapi&r1=1.5&r2=1.6
Patches:
Index: class.net_http_client.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.net_http_client.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- class.net_http_client.inc.php 4 May 2005 13:05:20 -0000 1.5
+++ class.net_http_client.inc.php 10 Sep 2006 15:55:07 -0000 1.6
@@ -274,7 +274,7 @@
function Head( $uri )
{
if( $this->debug & DBGTRACE ) echo "Head( $uri )\n";
- $this->responseHeaders = $this->responseBody = "";
+ $this->responseHeaders = $this->responseBody = '';
$uri = $this->makeUri( $uri );
if( $this->sendCommand( "HEAD $uri
HTTP/$this->protocolVersion" ) )
$this->processReply();
@@ -292,7 +292,7 @@
function Get( $url )
{
if( $this->debug & DBGTRACE ) echo "Get( $url )\n";
- $this->responseHeaders = $this->responseBody = "";
+ $this->responseHeaders = $this->responseBody = '';
$uri = $this->makeUri( $url );
if( $this->sendCommand( "GET $uri
HTTP/$this->protocolVersion" ) )
@@ -309,7 +309,7 @@
function Options( $url )
{
if( $this->debug & DBGTRACE ) echo "Options( $url )\n";
- $this->responseHeaders = $this->responseBody = "";
+ $this->responseHeaders = $this->responseBody = '';
$uri = $this->makeUri( $url );
if( $this->sendCommand( "OPTIONS $uri
HTTP/$this->protocolVersion" ) )
@@ -490,7 +490,7 @@
{
$this->requestBody = '';
if( $this->debug & DBGTRACE ) echo "Propfind( $uri,
$scope )\n";
- $prev_depth=$this->requestHeaders['Depth'];
+ $prev_depth=isset($this->requestHeaders['Depth']) ?
$this->requestHeaders['Depth'] : '';
$this->requestHeaders['Depth'] = $scope;
if( $this->sendCommand( "PROPFIND $uri
HTTP/$this->protocolVersion" ) )
$this->processReply();
@@ -621,7 +621,7 @@
{
if( $this->debug & DBGLOW ) echo "sendCommand( $command
)\n";
$this->responseHeaders = array();
- $this->responseBody = "";
+ $this->responseBody = '';
// connect if necessary
if( $this->socket == false or feof( $this->socket) ) {
@@ -640,7 +640,7 @@
$port = $this->url['port'];
}
}
- if( $port == "" ) $port = 80;
+ if( $port == '' ) $port = 80;
$this->socket = fsockopen( $host, $port,
$this->reply, $this->replyString );
if( $this->debug & DBGSOCK ) echo "connexion(
$host, $port) - $this->socket\n";
if( ! $this->socket ) {
@@ -649,11 +649,11 @@
}
}
- if( $this->requestBody != "" ) {
- $this->addHeader( "Content-Length", strlen(
$this->requestBody ) );
+ if( $this->requestBody != '' ) {
+ $this->addHeader( 'Content-Length', strlen(
$this->requestBody ) );
}
else {
- $this->removeHeader( "Content-Length");
+ $this->removeHeader( 'Content-Length');
}
$this->request = $command;
@@ -664,12 +664,12 @@
}
}
- if( $this->requestBody != "" ) {
+ if( $this->requestBody != '' ) {
$cmd .= CRLF . $this->requestBody;
}
// unset body (in case of successive requests)
- $this->requestBody = "";
+ $this->requestBody = '';
if( $this->debug & DBGOUTDATA ) echo "DBG.OUTDATA
Sending\n$cmd\n";
fputs( $this->socket, $cmd . CRLF );
@@ -745,26 +745,29 @@
$data='';
if( $this->debug & DBGLOW ) echo "processBody()\n";
-
- if (
$this->responseHeaders['Transfer-Encoding']=='chunked' )
+ if ( isset($this->responseHeaders['Transfer-Encoding'])
&& $this->responseHeaders['Transfer-Encoding']=='chunked' )
{
// chunked encoding
if( $this->debug & DBGSOCK ) echo "DBG.SOCK
chunked encoding..\n";
- $length = @fgets($this->socket, 1024);
+ $length = trim(@fgets($this->socket));
$length = hexdec($length);
- while (true) {
- if ($length == 0) { break; }
+ while (!feof($this->socket) && $length != 0) {
$data .= @fread($this->socket,
$length);
if( $this->debug & DBGSOCK )
echo "DBG.SOCK chunked encoding: read $length bytes\n";
- @fgets($this->socket, 1024);
- $length = @fgets($this->socket,
1024);
+ //XXX Caeies For an unkwnon
reason, it seems that asking for $length is not enought :( next empty line :
+ //XXX Perhaps an utf-8 issue ?
+ while(trim($line =
@fgets($this->socket)) != '')
+ {
+ $data .= $line;
+ }
+ //next new length
+ $length =
trim(@fgets($this->socket));
$length = hexdec($length);
}
- @fgets($this->socket, 1024);
}
- else if ($this->responseHeaders['Content-Length'] )
+ else if
(isset($this->responseHeaders['Content-Length']) &&
$this->responseHeaders['Content-Length'] )
{
$length =
$this->responseHeaders['Content-Length'];
/* this is for files bigger than 11Kb ?*/
@@ -777,9 +780,8 @@
{
break;
}
- } while ( True );
+ } while ( !feof($this->socket) );
if( $this->debug & DBGSOCK ) echo "DBG.SOCK
socket_read using Content-Length ($length)\n";
-
}
else {
if( $this->debug & DBGSOCK ) echo "Not chunked,
dont know how big?..\n";
@@ -820,7 +822,7 @@
socket_set_blocking( $this->socket, true );
}
$len = strlen($data);
- if( $this->debug & DBGSOCK ) echo "DBG.SOCK read $len
bytes";
+ if( $this->debug & DBGSOCK ) echo "DBG.SOCK read $len
bytes\n";
return $data;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.net_http_client.inc.php,
Caeies <=