Browse Source

Reply with error 400 on all bad Request-Lines received.

Loïc Hoguin 14 years ago
parent
commit
7ef67d08fe
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/cowboy_http_protocol.erl

+ 3 - 1
src/cowboy_http_protocol.erl

@@ -69,7 +69,9 @@ request({http_request, Method, {abs_path, AbsPath}, Version},
 	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) ->
 request({http_error, "\r\n"}, State) ->
-	wait_request(State).
+	wait_request(State);
+request({http_error, _Any}, State) ->
+	error_terminate(400, 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...