Skip to content
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

Invalid request causes infinite loop on http.server #233

Open
1WHISKY opened this issue Feb 10, 2025 · 0 comments
Open

Invalid request causes infinite loop on http.server #233

1WHISKY opened this issue Feb 10, 2025 · 0 comments

Comments

@1WHISKY
Copy link

1WHISKY commented Feb 10, 2025

Sending a malformed request to any http.server will cause it to indefinitely call the onstream function.
How to replicate:

  1. run any http.server e.g. examples/server_hello.lua
  2. create the request: echo -e -n "GET / HTTP/1.1\r\n\r\n\r\n" > request
    The file will look like this:
$ hexdump -C request 
00000000  47 45 54 20 2f 20 48 54  54 50 2f 31 2e 31 0d 0a  |GET / HTTP/1.1..|
00000010  0d 0a 0d 0a                                       |....|
  1. send the request: nc 127.0.0.1 80 < request

The request will show up in the lua stdout and the server will respond as usual.
However you will see that the connection in netcat has not been closed yet.
If you now terminate netcat by pressing ctrl+c the server will indefinitely call the onstream callback.

Unfortunately I could not find a way to prevent this or block the request from outside the module.
To me it looks like the server is still waiting for data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant