From ffa34b285928bf5225a81fb6b347b39c727d0cc3 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Tue, 25 Dec 2012 10:57:25 +0000 Subject: Respond with a 400 if Request-URI is invalid --- src/mochiweb/mochiweb_http.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mochiweb/mochiweb_http.erl b/src/mochiweb/mochiweb_http.erl index 23a475270..72bf8a6a7 100644 --- a/src/mochiweb/mochiweb_http.erl +++ b/src/mochiweb/mochiweb_http.erl @@ -102,7 +102,13 @@ loop(Socket, Body) -> request(Socket, Body) -> mochiweb_socket:setopts(Socket, [{active, once}]), receive - {Protocol, _, {http_request, Method, Path, Version}} when Protocol == http orelse Protocol == ssl -> + {Protocol, _, {http_request, Method, {abs_path, _}=Path, Version}} when Protocol == http orelse Protocol == ssl -> + mochiweb_socket:setopts(Socket, [{packet, httph}]), + headers(Socket, {Method, Path, Version}, [], Body, 0); + {Protocol, _, {http_request, Method, {absoluteURI, _, _, _, _}=Path, Version}} when Protocol == http orelse Protocol == ssl -> + mochiweb_socket:setopts(Socket, [{packet, httph}]), + headers(Socket, {Method, Path, Version}, [], Body, 0); + {Protocol, _, {http_request, Method, '*'=Path, Version}} when Protocol == http orelse Protocol == ssl -> mochiweb_socket:setopts(Socket, [{packet, httph}]), headers(Socket, {Method, Path, Version}, [], Body, 0); {Protocol, _, {http_error, "\r\n"}} when Protocol == http orelse Protocol == ssl -> -- cgit v1.2.1