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:23 UTC
[13/31] mochiweb commit: updated refs/heads/upstream to 23dc119
Update CHANGES.md for v2.15.0
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/507f0197
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/507f0197
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/507f0197
Branch: refs/heads/upstream
Commit: 507f0197295d1effdbbd60bfe0eb30e030901161
Parents: ba2ba3e
Author: Bob Ippolito <bo...@redivi.com>
Authored: Sun May 8 17:10:30 2016 -0700
Committer: Bob Ippolito <bo...@redivi.com>
Committed: Sun May 8 17:10:30 2016 -0700
----------------------------------------------------------------------
CHANGES.md | 6 ++++++
src/mochiweb.app.src | 2 +-
src/mochiweb_request.erl | 7 +++----
src/mochiweb_util.erl | 3 ++-
4 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/507f0197/CHANGES.md
----------------------------------------------------------------------
diff --git a/CHANGES.md b/CHANGES.md
index be0659d..fddd3cb 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,9 @@
+Version 2.15.0 released 2016-05-08
+
+* mochiweb_request now normalizes paths such that duplicate slashes are
+ discarded (and thus all path segments except the last are non-empty).
+ https://github.com/mochi/mochiweb/pull/173
+
Version 2.14.0 released 2016-04-11
* mochiweb_html now requires a letter to begin a HTML tag
http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/507f0197/src/mochiweb.app.src
----------------------------------------------------------------------
diff --git a/src/mochiweb.app.src b/src/mochiweb.app.src
index 7b546de..ba86330 100644
--- a/src/mochiweb.app.src
+++ b/src/mochiweb.app.src
@@ -1,7 +1,7 @@
%% This is generated from src/mochiweb.app.src
{application, mochiweb,
[{description, "MochiMedia Web Server"},
- {vsn, "2.14.0"},
+ {vsn, "2.15.0"},
{modules, []},
{registered, []},
{env, []},
http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/507f0197/src/mochiweb_request.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_request.erl b/src/mochiweb_request.erl
index 4fd7d68..302d6bc 100644
--- a/src/mochiweb_request.erl
+++ b/src/mochiweb_request.erl
@@ -135,10 +135,9 @@ get(path, {?MODULE, [_Socket, _Opts, _Method, RawPath, _Version, _Headers]}) ->
case erlang:get(?SAVE_PATH) of
undefined ->
{Path0, _, _} = mochiweb_util:urlsplit_path(RawPath),
- Path = mochiweb_util:unquote(Path0),
- Path_n = mochiweb_util:normalize_path(Path),
- put(?SAVE_PATH, Path_n),
- Path_n;
+ Path = mochiweb_util:normalize_path(mochiweb_util:unquote(Path0)),
+ put(?SAVE_PATH, Path),
+ Path;
Cached ->
Cached
end;
http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/507f0197/src/mochiweb_util.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_util.erl b/src/mochiweb_util.erl
index 22ae8f4..2acd436 100644
--- a/src/mochiweb_util.erl
+++ b/src/mochiweb_util.erl
@@ -590,12 +590,13 @@ make_io(Io) when is_list(Io); is_binary(Io) ->
%% @spec normalize_path(string()) -> string()
%% @doc Remove duplicate slashes from an uri path ("//foo///bar////" becomes
%% "/foo/bar/").
+%% Per RFC 3986, all but the last path segment must be non-empty.
normalize_path(Path) ->
normalize_path(Path, []).
normalize_path([], Acc) ->
lists:reverse(Acc);
-normalize_path("/" ++ Path, "/" ++ _ = Acc) ->
+normalize_path("/" ++ Path, "/" ++ _ = Acc) ->
normalize_path(Path, Acc);
normalize_path([C|Path], Acc) ->
normalize_path(Path, [C|Acc]).