diff options
author | Loïc Hoguin <[email protected]> | 2011-03-19 14:38:31 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2011-03-19 14:38:31 +0100 |
commit | c9eb3ce5fc8749bae1dd2f828340145e73063c4b (patch) | |
tree | 7c760918285ee143dfb1029881ae7614509299c6 | |
parent | db715a3eb1d5442adf524e85541392a9b4eafe43 (diff) | |
download | cowboy-c9eb3ce5fc8749bae1dd2f828340145e73063c4b.tar.gz cowboy-c9eb3ce5fc8749bae1dd2f828340145e73063c4b.tar.bz2 cowboy-c9eb3ce5fc8749bae1dd2f828340145e73063c4b.zip |
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.
-rw-r--r-- | src/cowboy_http_protocol.erl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl index 0e1eb13..ca23aa9 100644 --- a/src/cowboy_http_protocol.erl +++ b/src/cowboy_http_protocol.erl @@ -67,7 +67,9 @@ request({http_request, Method, {abs_path, AbsPath}, Version}, {Path, Qs} = cowboy_dispatcher:split_path(AbsPath), {ok, Peer} = Transport:peername(Socket), 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. %% @todo We don't want to wait T at each header... |