mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Ignore empty lines when expecting the Request-Line.
In the interest of robustness, servers SHOULD ignore any empty line(s) received where a Request-Line is expected. In other words, if the server is reading the protocol stream at the beginning of a message and receives a CRLF first, it should ignore the CRLF.
This commit is contained in:
parent
db715a3eb1
commit
c9eb3ce5fc
1 changed files with 3 additions and 1 deletions
|
@ -67,7 +67,9 @@ request({http_request, Method, {abs_path, AbsPath}, Version},
|
||||||
{Path, Qs} = cowboy_dispatcher:split_path(AbsPath),
|
{Path, Qs} = cowboy_dispatcher:split_path(AbsPath),
|
||||||
{ok, Peer} = Transport:peername(Socket),
|
{ok, Peer} = Transport:peername(Socket),
|
||||||
wait_header(#http_req{socket=Socket, transport=Transport, method=Method,
|
wait_header(#http_req{socket=Socket, transport=Transport, method=Method,
|
||||||
version=Version, peer=Peer, path=Path, raw_qs=Qs}, State).
|
version=Version, peer=Peer, path=Path, raw_qs=Qs}, State);
|
||||||
|
request({http_error, "\r\n"}, State) ->
|
||||||
|
wait_request(State).
|
||||||
|
|
||||||
-spec wait_header(Req::#http_req{}, State::#state{}) -> ok.
|
-spec wait_header(Req::#http_req{}, State::#state{}) -> ok.
|
||||||
%% @todo We don't want to wait T at each header...
|
%% @todo We don't want to wait T at each header...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue