couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [1/2] git commit: Respond with a 400 if Request-URI is invalid
Date Tue, 25 Dec 2012 10:57:43 GMT
Updated Branches:
  refs/heads/malformed_request_line [created] ffa34b285


Respond with a 400 if Request-URI is invalid


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ffa34b28
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ffa34b28
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ffa34b28

Branch: refs/heads/malformed_request_line
Commit: ffa34b285928bf5225a81fb6b347b39c727d0cc3
Parents: c4ee89e
Author: Robert Newson <rnewson@apache.org>
Authored: Tue Dec 25 10:57:25 2012 +0000
Committer: Robert Newson <rnewson@apache.org>
Committed: Tue Dec 25 10:57:25 2012 +0000

----------------------------------------------------------------------
 src/mochiweb/mochiweb_http.erl |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ffa34b28/src/mochiweb/mochiweb_http.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb/mochiweb_http.erl b/src/mochiweb/mochiweb_http.erl
index 23a4752..72bf8a6 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
->


Mime
View raw message