--- phpgwapi/inc/class.net_http_client.inc.php 27 Apr 2003 21:49:51 -0000 1.1.2.1 +++ phpgwapi/inc/class.net_http_client.inc.php 20 Nov 2003 09:44:17 -0000 @@ -774,7 +808,7 @@ while (true) { if ($length == 0) { break; } - $data .= fread($this->socket, $length); + $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); @@ -786,7 +820,18 @@ else if ($this->responseHeaders['Content-Length'] ) { $length = $this->responseHeaders['Content-Length']; - $data = fread( $this->socket, $length ); + /* this is for files bigger than 11Kb ?*/ + do { + $buf = @fread ( $this->socket, 8192 ); + /* Putting this here is better than putting == 0 */ + /* It's avoiding a fread on a 0 length data which causes a warning when uses over ssl*/ + if ( strlen($buf) < 8192) + { + $data .= $buf; + break; + } + $data .= $buf; + } while ( True ); if( $this->debug & DBGSOCK ) echo "DBG.SOCK socket_read using Content-Length ($length)\n"; } @@ -806,11 +851,11 @@ break; } if( $status['unread_bytes'] > 0 ) { - $buffer = fread( $this->socket, $status['unread_bytes'] ); + $buffer = @fread( $this->socket, $status['unread_bytes'] ); $counter = 0; } else { $ts=time(); - $buffer = fread( $this->socket, 1024 ); + $buffer = @fread( $this->socket, 1024 ); sleep(0.1); $failureCount++;