aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-03-19 14:38:31 +0100
committerLoïc Hoguin <[email protected]>2011-03-19 14:38:31 +0100
commitc9eb3ce5fc8749bae1dd2f828340145e73063c4b (patch)
tree7c760918285ee143dfb1029881ae7614509299c6 /src
parentdb715a3eb1d5442adf524e85541392a9b4eafe43 (diff)
downloadcowboy-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.
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_http_protocol.erl4
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...