Skip to content

Invalid request causes infinite loop on http.server #233

Open
@1WHISKY

Description

@1WHISKY

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions