mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Don't crash on errors while receiving headers; throw an error 500 instead.
The server shouldn't crash the request process when we have an error while receiving headers. A case where this could happen is if the header line is too long. See also bfrog's report on ticket #3 on github.
This commit is contained in:
parent
d8a2fcf258
commit
0fad6c6fde
1 changed files with 3 additions and 1 deletions
|
@ -128,7 +128,9 @@ header({http_header, _I, Field, _R, Value}, Req, State) ->
|
||||||
header(http_eoh, #http_req{host=undefined}, State) ->
|
header(http_eoh, #http_req{host=undefined}, State) ->
|
||||||
error_terminate(400, State);
|
error_terminate(400, State);
|
||||||
header(http_eoh, Req, State) ->
|
header(http_eoh, Req, State) ->
|
||||||
handler_init(Req, State).
|
handler_init(Req, State);
|
||||||
|
header({http_error, _String}, _Req, State) ->
|
||||||
|
error_terminate(500, State).
|
||||||
|
|
||||||
-spec handler_init(Req::#http_req{}, State::#state{}) -> ok.
|
-spec handler_init(Req::#http_req{}, State::#state{}) -> ok.
|
||||||
handler_init(Req, State=#state{
|
handler_init(Req, State=#state{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue