You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2017/08/14 15:38:22 UTC

[12/31] mochiweb commit: updated refs/heads/upstream to 23dc119

Remove duplicate slashes from an uri path.

Now Req:get(path) returns a path without duplicate slashes.
E.g. uri path "//foo///bar////" becomes "/foo/bar/".

Signed-off-by: Oleg Nemanov <le...@yandex.ru>


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

Branch: refs/heads/upstream
Commit: ba2ba3e7071886d06ab03e49cb8492151ba8c822
Parents: 3c9b72a
Author: Oleg Nemanov <le...@yandex.ru>
Authored: Wed Apr 27 13:18:03 2016 +0300
Committer: Oleg Nemanov <le...@yandex.ru>
Committed: Wed Apr 27 13:18:03 2016 +0300

----------------------------------------------------------------------
 src/mochiweb_request.erl | 5 +++--
 test/mochiweb_tests.erl  | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ba2ba3e7/src/mochiweb_request.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_request.erl b/src/mochiweb_request.erl
index 39890ce..4fd7d68 100644
--- a/src/mochiweb_request.erl
+++ b/src/mochiweb_request.erl
@@ -136,8 +136,9 @@ get(path, {?MODULE, [_Socket, _Opts, _Method, RawPath, _Version, _Headers]}) ->
         undefined ->
             {Path0, _, _} = mochiweb_util:urlsplit_path(RawPath),
             Path = mochiweb_util:unquote(Path0),
-            put(?SAVE_PATH, Path),
-            Path;
+            Path_n = mochiweb_util:normalize_path(Path),
+            put(?SAVE_PATH, Path_n),
+            Path_n;
         Cached ->
             Cached
     end;

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ba2ba3e7/test/mochiweb_tests.erl
----------------------------------------------------------------------
diff --git a/test/mochiweb_tests.erl b/test/mochiweb_tests.erl
index 0b558ac..22e5b26 100644
--- a/test/mochiweb_tests.erl
+++ b/test/mochiweb_tests.erl
@@ -6,7 +6,7 @@ with_server(Transport, ServerFun, ClientFun) ->
     mochiweb_test_util:with_server(Transport, ServerFun, ClientFun).
 
 request_test() ->
-    R = mochiweb_request:new(z, z, "/foo/bar/baz%20wibble+quux?qs=2", z, []),
+    R = mochiweb_request:new(z, z, "//foo///bar/baz%20wibble+quux?qs=2", z, []),
     "/foo/bar/baz wibble quux" = R:get(path),
     ok.