Skip to content

Requests with no host header crash acceptor #88

@gavinmorrow

Description

@gavinmorrow

If a mist server gets a request without a host header, then the acceptor crashes and the server sends an empty response. The server should instead send a 400 response.

The logs from the server are

WARN Missing HTTP `host` header
EROR label=Supervisor(ChildTerminated) report=[Supervisor(Local(atom.create("glisten_connection_supervisor$1220"))), #(atom.create("errorContext"), ChildTerminated), Reason("Missing HTTP `host` header"), Offender([Pid(//erl(<0.142.0>)), Id(0), Mfargs(#(atom.create("gleam@otp@factory_supervisor"), StartChildCallback, Undefined)), RestartType(Temporary), Significant(False), Shutdown(5000), ChildType(Worker)])]

and the output of curl --verbose --header "Host:" localhost:8000 is

[...]
* Request completely sent off
* Empty reply from server
* Closing connection
curl: (52) Empty reply from server

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