|
@@ 2995-3002 (lines=8) @@
|
| 2992 |
|
while (!isset($lb)) { |
| 2993 |
|
|
| 2994 |
|
// We might EOF during header read. |
| 2995 |
|
if (feof($this->fp)) { |
| 2996 |
|
$this->incoming_payload = $data; |
| 2997 |
|
$this->debug('found no headers before EOF after length ' . strlen($data)); |
| 2998 |
|
$this->debug("received before EOF:\n" . $data); |
| 2999 |
|
$this->setError('server failed to send headers'); |
| 3000 |
|
|
| 3001 |
|
return false; |
| 3002 |
|
} |
| 3003 |
|
|
| 3004 |
|
$tmp = fgets($this->fp, 256); |
| 3005 |
|
$tmplen = strlen($tmp); |
|
@@ 3008-3015 (lines=8) @@
|
| 3005 |
|
$tmplen = strlen($tmp); |
| 3006 |
|
$this->debug("read line of $tmplen bytes: " . trim($tmp)); |
| 3007 |
|
|
| 3008 |
|
if ($tmplen == 0) { |
| 3009 |
|
$this->incoming_payload = $data; |
| 3010 |
|
$this->debug('socket read of headers timed out after length ' . strlen($data)); |
| 3011 |
|
$this->debug("read before timeout: " . $data); |
| 3012 |
|
$this->setError('socket read of headers timed out'); |
| 3013 |
|
|
| 3014 |
|
return false; |
| 3015 |
|
} |
| 3016 |
|
|
| 3017 |
|
$data .= $tmp; |
| 3018 |
|
$pos = strpos($data,"\r\n\r\n"); |
|
@@ 3082-3089 (lines=8) @@
|
| 3079 |
|
$tmp = fgets($this->fp, 256); |
| 3080 |
|
$tmplen = strlen($tmp); |
| 3081 |
|
$this->debug("read chunk line of $tmplen bytes"); |
| 3082 |
|
if ($tmplen == 0) { |
| 3083 |
|
$this->incoming_payload = $data; |
| 3084 |
|
$this->debug('socket read of chunk length timed out after length ' . strlen($data)); |
| 3085 |
|
$this->debug("read before timeout:\n" . $data); |
| 3086 |
|
$this->setError('socket read of chunk length timed out'); |
| 3087 |
|
|
| 3088 |
|
return false; |
| 3089 |
|
} |
| 3090 |
|
$content_length = hexdec(trim($tmp)); |
| 3091 |
|
$this->debug("chunk length $content_length"); |
| 3092 |
|
} |
|
@@ 3099-3106 (lines=8) @@
|
| 3096 |
|
$tmp = fread($this->fp, $readlen); |
| 3097 |
|
$tmplen = strlen($tmp); |
| 3098 |
|
$this->debug("read buffer of $tmplen bytes"); |
| 3099 |
|
if (($tmplen == 0) && (!feof($this->fp))) { |
| 3100 |
|
$this->incoming_payload = $data; |
| 3101 |
|
$this->debug('socket read of body timed out after length ' . strlen($data)); |
| 3102 |
|
$this->debug("read before timeout:\n" . $data); |
| 3103 |
|
$this->setError('socket read of body timed out'); |
| 3104 |
|
|
| 3105 |
|
return false; |
| 3106 |
|
} |
| 3107 |
|
$strlen += $tmplen; |
| 3108 |
|
$data .= $tmp; |
| 3109 |
|
} |
|
@@ 3114-3121 (lines=8) @@
|
| 3111 |
|
$tmp = fgets($this->fp, 256); |
| 3112 |
|
$tmplen = strlen($tmp); |
| 3113 |
|
$this->debug("read chunk terminator of $tmplen bytes"); |
| 3114 |
|
if ($tmplen == 0) { |
| 3115 |
|
$this->incoming_payload = $data; |
| 3116 |
|
$this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); |
| 3117 |
|
$this->debug("read before timeout:\n" . $data); |
| 3118 |
|
$this->setError('socket read of chunk terminator timed out'); |
| 3119 |
|
|
| 3120 |
|
return false; |
| 3121 |
|
} |
| 3122 |
|
} |
| 3123 |
|
} while ($chunked && ($content_length > 0) && (!feof($this->fp))); |
| 3124 |
|
if (feof($this->fp)) { |