From ed3655c4c7f9692340f7b54054d35f24a0cc3f68 Mon Sep 17 00:00:00 2001 From: Tom N Harris Date: Fri, 16 Jan 2009 01:15:47 +0100 Subject: Avoid zero-byte reads darcs-hash:20090116001547-6942e-b5bc401c0ef4c36b1b7b8ca7ef708587953ec017.gz --- inc/HTTPClient.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'inc/HTTPClient.php') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 2385b1edd..71844b847 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -333,9 +333,11 @@ class HTTPClient { $byte = fread($socket,1); // readtrailing \n $chunk_size = hexdec($chunk_size); - $this_chunk = fread($socket,$chunk_size); - $r_body .= $this_chunk; - if ($chunk_size) $byte = fread($socket,2); // read trailing \r\n + if ($chunk_size) { + $this_chunk = fread($socket,$chunk_size); + $r_body .= $this_chunk; + $byte = fread($socket,2); // read trailing \r\n + } if($this->max_bodysize && strlen($r_body) > $this->max_bodysize){ $this->error = 'Allowed response size exceeded'; -- cgit v1.2.3