You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2022/08/14 12:34:31 UTC
[couchdb-mochiweb] branch upstream-3.1.0 created (now bd0c848)
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a change to branch upstream-3.1.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git
at bd0c848 fix release date
This branch includes the following new commits:
new 927cd19 Fix typo in atom
new a46b10a Merge pull request #245 from big-r81/patch-1
new 38aadf3 Remove leading and trailing whitespaces
new 16c43ef Merge pull request #247 from big-r81/patch-2
new 48c0cdd v3.1.0
new 6d22721 Merge pull request #248 from mochi/follow-up-247
new bd0c848 fix release date
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb-mochiweb] 02/07: Merge pull request #245 from big-r81/patch-1
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch upstream-3.1.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git
commit a46b10a600ae93f5c0cda034ecd42791bfb56845
Merge: 845803a 927cd19
Author: Bob Ippolito <bo...@redivi.com>
AuthorDate: Thu Aug 11 06:21:53 2022 -0700
Merge pull request #245 from big-r81/patch-1
src/mochiweb_headers.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[couchdb-mochiweb] 04/07: Merge pull request #247 from big-r81/patch-2
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch upstream-3.1.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git
commit 16c43ef4132608fa4109ed3518beb3f240b116c7
Merge: a46b10a 38aadf3
Author: Bob Ippolito <bo...@redivi.com>
AuthorDate: Sat Aug 13 20:19:07 2022 -0600
Merge pull request #247 from big-r81/patch-2
Remove leading and trailing whitespaces
src/mochiweb_headers.erl | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
[couchdb-mochiweb] 07/07: fix release date
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch upstream-3.1.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git
commit bd0c848040b57513c824b58f1c0c5e6d3d045dea
Author: Bob Ippolito <bo...@redivi.com>
AuthorDate: Sat Aug 13 20:35:05 2022 -0600
fix release date
---
CHANGES.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGES.md b/CHANGES.md
index e851ce3..bb76d79 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,4 +1,4 @@
-Version 3.1.0 released 2022-08-21
+Version 3.1.0 released 2022-08-13
* Leading and trailing whitespace in header values are now trimmed
for better RFC 7230 compliance.
[couchdb-mochiweb] 06/07: Merge pull request #248 from mochi/follow-up-247
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch upstream-3.1.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git
commit 6d22721b51166cf8bac3f74f40d48073950595a9
Merge: 16c43ef 48c0cdd
Author: Bob Ippolito <bo...@redivi.com>
AuthorDate: Sat Aug 13 20:33:15 2022 -0600
Merge pull request #248 from mochi/follow-up-247
v3.1.0
CHANGES.md | 7 +++++++
src/mochiweb.app.src | 2 +-
src/mochiweb_headers.erl | 9 ++++++++-
3 files changed, 16 insertions(+), 2 deletions(-)
[couchdb-mochiweb] 03/07: Remove leading and trailing whitespaces
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch upstream-3.1.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git
commit 38aadf35a346c49222b387d319a0e590640850e4
Author: Ronny <ro...@apache.org>
AuthorDate: Thu Aug 11 15:47:29 2022 +0200
Remove leading and trailing whitespaces
from field-values to be RFC 7230 compliant.
---
src/mochiweb_headers.erl | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/mochiweb_headers.erl b/src/mochiweb_headers.erl
index 0276aee..d9bc3af 100644
--- a/src/mochiweb_headers.erl
+++ b/src/mochiweb_headers.erl
@@ -174,7 +174,7 @@ lookup(K, T) ->
%% @doc Insert the pair into the headers if it does not already exist.
default(K, V, T) ->
K1 = normalize(K),
- V1 = any_to_list(V),
+ V1 = trim_leading_and_trailing_ws(any_to_list(V)),
try gb_trees:insert(K1, {K, V1}, T)
catch
error:{key_exists, _} ->
@@ -185,7 +185,7 @@ default(K, V, T) ->
%% @doc Insert the pair into the headers, replacing any pre-existing key.
enter(K, V, T) ->
K1 = normalize(K),
- V1 = any_to_list(V),
+ V1 = trim_leading_and_trailing_ws(any_to_list(V)),
gb_trees:enter(K1, {K, V1}, T).
%% @spec insert(key(), value(), headers()) -> headers()
@@ -193,7 +193,7 @@ enter(K, V, T) ->
%% A merge is done with Value = V0 ++ ", " ++ V1.
insert(K, V, T) ->
K1 = normalize(K),
- V1 = any_to_list(V),
+ V1 = trim_leading_and_trailing_ws(any_to_list(V)),
try gb_trees:insert(K1, {K, V1}, T)
catch
error:{key_exists, _} ->
@@ -215,6 +215,9 @@ tokenize_header_value(undefined) ->
tokenize_header_value(V) ->
reversed_tokens(trim_and_reverse(V, false), [], []).
+trim_leading_and_trailing_ws(S) ->
+ re:replace(S, "^[ \\t]*|[ \\t]*$", "", [global, {return, list}]).
+
trim_and_reverse([S | Rest], Reversed) when S=:=$ ; S=:=$\n; S=:=$\t ->
trim_and_reverse(Rest, Reversed);
trim_and_reverse(V, false) ->
[couchdb-mochiweb] 01/07: Fix typo in atom
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch upstream-3.1.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git
commit 927cd19426f9c3631186d3322b7331bb7eb6fe68
Author: Ronny <ro...@apache.org>
AuthorDate: Thu Aug 11 10:07:15 2022 +0200
Fix typo in atom
---
src/mochiweb_headers.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mochiweb_headers.erl b/src/mochiweb_headers.erl
index 457758f..0276aee 100644
--- a/src/mochiweb_headers.erl
+++ b/src/mochiweb_headers.erl
@@ -242,7 +242,7 @@ reversed_tokens([C | Rest], Token, Acc) when C=:=$ ;C=:=$\n;C=:=$\t;C=:=$, ->
reversed_tokens([C | Rest], Token, Acc) ->
reversed_tokens(Rest, [C | Token], Acc);
reversed_tokens(_, _, _) ->
- undefeined.
+ undefined.
extract_quoted_string([], _Acc) ->
undefined;
[couchdb-mochiweb] 05/07: v3.1.0
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch upstream-3.1.0
in repository https://gitbox.apache.org/repos/asf/couchdb-mochiweb.git
commit 48c0cddd1045c58de4137f5ad08944118925bfda
Author: Bob Ippolito <bo...@redivi.com>
AuthorDate: Sat Aug 13 20:16:40 2022 -0600
v3.1.0
---
CHANGES.md | 7 +++++++
src/mochiweb.app.src | 2 +-
src/mochiweb_headers.erl | 9 ++++++++-
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 16d14f7..e851ce3 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,10 @@
+Version 3.1.0 released 2022-08-21
+
+* Leading and trailing whitespace in header values are now trimmed
+ for better RFC 7230 compliance.
+ https://github.com/mochi/mochiweb/pull/247
+ https://github.com/mochi/mochiweb/pull/248
+
Version 3.0.0 released 2022-05-09
* rebar3 is now the preferred build tool (finally)
diff --git a/src/mochiweb.app.src b/src/mochiweb.app.src
index 6baf6bf..425e220 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, "3.0.0"},
+ {vsn, "3.1.0"},
{modules, []},
{registered, []},
{env, []},
diff --git a/src/mochiweb_headers.erl b/src/mochiweb_headers.erl
index d9bc3af..afb8a1f 100644
--- a/src/mochiweb_headers.erl
+++ b/src/mochiweb_headers.erl
@@ -216,7 +216,7 @@ tokenize_header_value(V) ->
reversed_tokens(trim_and_reverse(V, false), [], []).
trim_leading_and_trailing_ws(S) ->
- re:replace(S, "^[ \\t]*|[ \\t]*$", "", [global, {return, list}]).
+ trim_and_reverse(trim_and_reverse(S, false), false).
trim_and_reverse([S | Rest], Reversed) when S=:=$ ; S=:=$\n; S=:=$\t ->
trim_and_reverse(Rest, Reversed);
@@ -367,6 +367,13 @@ set_cookie_test() ->
to_list(H)),
ok.
+whitespace_headers_test() ->
+ %% Check RFC 7230 whitespace compliance
+ H = ?MODULE:make([{"X-Auth-Roles", " test, test2,test3, test4, test5 , test6 "}]),
+ ?assertEqual(
+ [{"X-Auth-Roles", "test, test2,test3, test4, test5 , test6"}],
+ to_list(H)).
+
headers_test() ->
H = ?MODULE:make([{hdr, foo}, {"Hdr", "bar"}, {'Hdr', 2}]),
[{hdr, "foo, bar, 2"}] = ?MODULE:to_list(H),