Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Http] Tolerating colons in response start-lines. Cleaning up parsing.

  • Loading branch information...
commit 7b44cc334e8dbaa255f43a548356c77f1118d82c 1 parent c7a2dd8
@mtdowling mtdowling authored
Showing with 6 additions and 10 deletions.
  1. +6 −10 Message/Request.php
View
16 Message/Request.php
@@ -584,16 +584,7 @@ public function receiveResponseHeader($data)
$length = strlen($data);
$data = str_replace($normalize, '', $data);
- if (strpos($data, ':') !== false) {
-
- if (!$this->response) {
- throw new RuntimeException('Received message-header before receiving start-line: ' . $data);
- }
-
- list($header, $value) = explode(':', $data, 2);
- $this->response->addHeader(trim($header), trim($value));
-
- } elseif (strlen($data) > 6) {
+ if (strpos($data, 'HTTP/') === 0) {
list($dummy, $code, $status) = explode(' ', $data, 3);
@@ -614,6 +605,11 @@ public function receiveResponseHeader($data)
'reason_phrase' => $status,
'previous_response' => $previousResponse
));
+
+ } elseif (strpos($data, ':') !== false) {
+
+ list($header, $value) = explode(':', $data, 2);
+ $this->response->addHeader(trim($header), trim($value));
}
return $length;
Please sign in to comment.
Something went wrong with that request. Please try again.