summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2012-12-25 10:57:25 +0000
committerRobert Newson <rnewson@apache.org>2012-12-25 10:57:25 +0000
commitffa34b285928bf5225a81fb6b347b39c727d0cc3 (patch)
treee7dad57cc957421a3127eb2135e24038b8fbf8df
parentc4ee89eeff31501c5f90493e805324e6d437d8db (diff)
downloadcouchdb-malformed_request_line.tar.gz
Respond with a 400 if Request-URI is invalidmalformed_request_line
-rw-r--r--src/mochiweb/mochiweb_http.erl8
1 files changed, 7 insertions, 1 deletions
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 ->