Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Respond with a 400 if Request-URI is invalid

  • Loading branch information...
commit ffa34b285928bf5225a81fb6b347b39c727d0cc3 1 parent c4ee89e
@rnewson rnewson authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/mochiweb/mochiweb_http.erl
View
8 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 ->
Please sign in to comment.
Something went wrong with that request. Please try again.