-
-
Notifications
You must be signed in to change notification settings - Fork 160
Fix checking maximum header size, do not take start of body into account #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix checking maximum header size, do not take start of body into account #88
Conversation
Thanks for filing this PR 👍 Unfortunately it has no tests, see also #82. |
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.
As @clue mentions could you add tests?
src/Server.php
Outdated
@@ -41,6 +41,9 @@ public function __construct(SocketServerInterface $io) | |||
$conn->emit('resume'); | |||
}); | |||
}); | |||
$parser->on('error', function($exception) { | |||
$this->emit('error', [$exception]); | |||
}); |
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.
Not sure why this is in this PR? (It does make sense to do this non the less.)
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.
FYI this has been addressed in #83
5fb8f9e
to
c4c1aec
Compare
added test removed bubble up of error from Server.php, not related to this issue |
Test look good, but now this test is failing
Great, thanks 👍 |
6e3c57d
to
97ac89c
Compare
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.
LGTM 👍
tests/ServerTest.php
Outdated
@@ -81,8 +81,9 @@ public function testParserErrorEmitted() | |||
$conn = new ConnectionStub(); | |||
$io->emit('connection', [$conn]); | |||
|
|||
$data = $this->createGetRequest(); | |||
$data = str_pad($data, 4096 * 4); | |||
$data = chop($this->createGetRequest()); |
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.
This looks okay, but could probably be a bit clearer. What do you think, should this be updated to use a literal request string here instead?
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.
I agree, thanks for the suggestion.
97ac89c
to
5dc78e7
Compare
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.
👍
Fixed check for exceeding maximum header size in RequestHeaderParser::feed()