|
@@ 118-128 (lines=11) @@
|
| 115 |
|
protected function readResponseStatusCodeAndHeader() { |
| 116 |
|
$statusCodeAndHeader = ""; |
| 117 |
|
|
| 118 |
|
while (!feof($this->handle)) { |
| 119 |
|
// We use fgets() because it stops reading at first newline or buffer length, depends which one is reached first. |
| 120 |
|
$buffer = fgets($this->handle, self::BUFFER_LENGTH); |
| 121 |
|
|
| 122 |
|
// Adds the buffer to the header. |
| 123 |
|
$statusCodeAndHeader .= $buffer; |
| 124 |
|
|
| 125 |
|
// The header is separated from the body by a newline, so we break when we read it. |
| 126 |
|
if ($buffer == Message::CRLF) |
| 127 |
|
break; |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
return $statusCodeAndHeader; |
| 131 |
|
} |
|
@@ 186-193 (lines=8) @@
|
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
// A chunk response might have some footer, but CouchDB doesn't use them, so we simply ignore them. |
| 186 |
|
while (!feof($this->handle)) { |
| 187 |
|
// We use fgets() because it stops reading at first newline or buffer length, depends which one is reached first. |
| 188 |
|
$buffer = fgets($this->handle, self::BUFFER_LENGTH); |
| 189 |
|
|
| 190 |
|
// The chunk response ends with a newline, so we break when we read it. |
| 191 |
|
if ($buffer == Message::CRLF) |
| 192 |
|
break; |
| 193 |
|
} |
| 194 |
|
|
| 195 |
|
return $body; |
| 196 |
|
} |