-
Notifications
You must be signed in to change notification settings - Fork 158
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
Socket is not released when HTTP parsing fails #49
Comments
ziabary
added a commit
to Targoman/QHttp
that referenced
this issue
Apr 28, 2020
azadkuh#49 If the incoming HTTP header is invalid, which can be as trivial as providing the HTTP method in lowercase instead of uppercase, the socket is never released and it just hangs the entire connection infinitely.
Bug fixed on Targoman fork. Same issue fixed on qhttclient |
Keep in mind that the server will send back an empty response. If you want to report a bad request back to the client, something like this seems to work:
|
paluke
pushed a commit
to paluke/qhttp
that referenced
this issue
Aug 18, 2021
azadkuh#49 If the incoming HTTP header is invalid, which can be as trivial as providing the HTTP method in lowercase instead of uppercase, the socket is never released and it just hangs the entire connection infinitely.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the incoming HTTP header is invalid, which can be as trivial as providing the HTTP method in lowercase instead of uppercase, the socket is never released and it just hangs the entire connection infinitely.
The reason for this is that there are no checks whether the http_parser_execute function actually succeeded or not.
A quick fix for this is to add a simple check in method onReadyRead in qhttpserverconnection_private.hpp:
or even write a hardcoded 400 Bad Request back to the socket, but it probably should be done in a more proper fashion.
The text was updated successfully, but these errors were encountered: