Back out Mochiweb patch from r659636 to support older Erlang versions, as those are no longer supported by CouchDB anyway.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@806513 13f79535-47bb-0310-9956-ffa450edef68 Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/962088ba Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/962088ba Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/962088ba Branch: refs/heads/import-master Commit: 962088ba8aa3a2a2a1c317ce4f5345d63c17bdec Parents: 94d827c Author: Christopher Lenz <cml...@apache.org> Authored: Fri Aug 21 11:54:24 2009 +0000 Committer: Christopher Lenz <cml...@apache.org> Committed: Fri Aug 21 11:54:24 2009 +0000 ---------------------------------------------------------------------- mochifmt.erl | 2 +- mochiweb_headers.erl | 2 +- mochiweb_html.erl | 4 ++-- mochiweb_multipart.erl | 2 +- mochiweb_util.erl | 21 +++------------------ 5 files changed, 8 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/962088ba/mochifmt.erl ---------------------------------------------------------------------- diff --git a/mochifmt.erl b/mochifmt.erl index 696559d..da0a133 100644 --- a/mochifmt.erl +++ b/mochifmt.erl @@ -297,7 +297,7 @@ convert2(Arg, #conversion{ctype=oct}) -> convert2(Arg, #conversion{ctype=upper_hex}) -> erlang:integer_to_list(Arg, 16); convert2(Arg, #conversion{ctype=hex}) -> - mochiweb_util:to_lower(erlang:integer_to_list(Arg, 16)); + string:to_lower(erlang:integer_to_list(Arg, 16)); convert2(Arg, #conversion{ctype=char}) when Arg < 16#80 -> [Arg]; convert2(Arg, #conversion{ctype=char}) -> http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/962088ba/mochiweb_headers.erl ---------------------------------------------------------------------- diff --git a/mochiweb_headers.erl b/mochiweb_headers.erl index b29ff31..6fcec7c 100644 --- a/mochiweb_headers.erl +++ b/mochiweb_headers.erl @@ -168,7 +168,7 @@ merge(_, V1, V0) -> V0 ++ ", " ++ V1. normalize(K) when is_list(K) -> - mochiweb_util:to_lower(K); + string:to_lower(K); normalize(K) when is_atom(K) -> normalize(atom_to_list(K)); normalize(K) when is_binary(K) -> http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/962088ba/mochiweb_html.erl ---------------------------------------------------------------------- diff --git a/mochiweb_html.erl b/mochiweb_html.erl index 05ea638..0e030c1 100644 --- a/mochiweb_html.erl +++ b/mochiweb_html.erl @@ -330,7 +330,7 @@ tokens(B, S=#decoder{offset=O}, Acc) -> end. parse_flag({start_tag, B, _, false}) -> - case mochiweb_util:to_lower(binary_to_list(B)) of + case string:to_lower(binary_to_list(B)) of "script" -> script; "textarea" -> @@ -551,7 +551,7 @@ norm({Tag, Attrs}) -> norm(Tag) when is_binary(Tag) -> Tag; norm(Tag) -> - list_to_binary(mochiweb_util:to_lower(Tag)). + list_to_binary(string:to_lower(Tag)). test_destack() -> {<<"a">>, [], []} = http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/962088ba/mochiweb_multipart.erl ---------------------------------------------------------------------- diff --git a/mochiweb_multipart.erl b/mochiweb_multipart.erl index 7d42be5..9eb4bad 100644 --- a/mochiweb_multipart.erl +++ b/mochiweb_multipart.erl @@ -103,7 +103,7 @@ parse_headers(Binary, Acc) -> split_header(Line) -> {Name, [$: | Value]} = lists:splitwith(fun (C) -> C =/= $: end, binary_to_list(Line)), - {mochiweb_util:to_lower(string:strip(Name)), + {string:to_lower(string:strip(Name)), mochiweb_util:parse_header(Value)}. read_chunk(Req, Length) when Length > 0 -> http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/962088ba/mochiweb_util.erl ---------------------------------------------------------------------- diff --git a/mochiweb_util.erl b/mochiweb_util.erl index 93c0343..7bf18d1 100644 --- a/mochiweb_util.erl +++ b/mochiweb_util.erl @@ -12,7 +12,6 @@ -export([shell_quote/1, cmd/1, cmd_string/1, cmd_port/2]). -export([record_to_proplist/2, record_to_proplist/3]). -export([safe_relative_path/1, partition/2]). --export([to_lower/1]). -export([test/0]). -define(PERCENT, 37). % $\% @@ -239,7 +238,7 @@ urlsplit_scheme(Url) -> urlsplit_scheme([], Acc) -> {"", lists:reverse(Acc)}; urlsplit_scheme(":" ++ Rest, Acc) -> - {to_lower(lists:reverse(Acc)), Rest}; + {string:to_lower(lists:reverse(Acc)), Rest}; urlsplit_scheme([C | Rest], Acc) -> urlsplit_scheme(Rest, [C | Acc]). @@ -391,11 +390,11 @@ parse_header(String) -> %% Skip anything with no value Acc; {Name, [$\= | Value]} -> - [{to_lower(string:strip(Name)), + [{string:to_lower(string:strip(Name)), unquote_header(string:strip(Value))} | Acc] end end, - {to_lower(Type), + {string:to_lower(Type), lists:foldr(F, [], Parts)}. unquote_header("\"" ++ Rest) -> @@ -438,20 +437,6 @@ shell_quote([C | Rest], Acc) when C =:= $\" orelse C =:= $\` orelse shell_quote([C | Rest], Acc) -> shell_quote(Rest, [C | Acc]). -to_lower_char(C) when is_integer(C), C >= $A, C =< $Z -> - C + 32; -to_lower_char(C) when is_integer(C), C >= 16#C1, C =< 16#D6 -> - C + 32; -to_lower_char(C) when is_integer(C), C >= 16#D8, C =< 16#DE -> - C + 32; -to_lower_char(C) -> - C. - -to_lower(S) when is_list(S) -> - [to_lower_char(C) || C <- S]; -to_lower(C) when is_integer(C) -> - to_lower_char(C). - test() -> test_join(), test_quote_plus(),