|
@@ -644,6 +644,7 @@ class ResponseReader {
|
|
|
public function read(IConnectionSingle $connection) {
|
|
|
$header = $connection->readLine();
|
|
|
if ($header === '') {
|
|
|
+ $this->throwMalformedResponse('Unexpected empty header');
|
|
|
Utils::onCommunicationException(new MalformedServerResponse(
|
|
|
$connection, 'Unexpected empty header'
|
|
|
));
|
|
@@ -651,13 +652,17 @@ class ResponseReader {
|
|
|
|
|
|
$prefix = $header[0];
|
|
|
if (!isset($this->_prefixHandlers[$prefix])) {
|
|
|
- Utils::onCommunicationException(new MalformedServerResponse(
|
|
|
- $connection, "Unknown prefix '$prefix'"
|
|
|
- ));
|
|
|
+ $this->throwMalformedResponse("Unknown prefix '$prefix'");
|
|
|
}
|
|
|
$handler = $this->_prefixHandlers[$prefix];
|
|
|
return $handler->handle($connection, substr($header, 1));
|
|
|
}
|
|
|
+
|
|
|
+ private function throwMalformedResponse($message) {
|
|
|
+ Utils::onCommunicationException(new MalformedServerResponse(
|
|
|
+ $connection, $message
|
|
|
+ ));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class ResponseError {
|