-
Notifications
You must be signed in to change notification settings - Fork 86
Handle 100 continue responses proposal #131
Conversation
The build fails with an error irrelent to the change:
|
src/Response.php
Outdated
} catch (RuntimeException $e) { | ||
array_shift($lines); // skip next empty line | ||
$firstLine = array_shift($lines); // and try again | ||
$response->parseStatusLine($firstLine); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure next line is empty before skipping.
On a quick glance at the specification I do not see anything preventing sending more headers with 100 status code before proceeding with actual response.
Also your extracted method does too much. Extract status line parsing logic but leave the rest out of it.
I would do something like this:
list($version, $status, $reason) = $this->parseStatusLine($firstLine);
if (static::STATUS_CODE_100 === $status) {
$next = array_shift($lines);
if (!empty($next)) {
// throw exception, probably
}
$next = array_shift($lines);
list($version, $status, $reason) = $this->parseStatusLine($next);
}
$response->version = $version;
$response->setStatusCode($status);
$response->setReasonPhrase($reason);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to work without exceptions. Rebased and fixed tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert all changes to tests.
They are using deprecated and removed methods.
I have cherry-picked the relevant commits, ensuring the changes to tests are not propagated. Merged to master for next release. |
Attempt to fix a
100 Continue
responses issue.