couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r659636 - in /incubator/couchdb/trunk/src/mochiweb: mochifmt.erl mochiweb_headers.erl mochiweb_html.erl mochiweb_multipart.erl mochiweb_util.erl
Date Fri, 23 May 2008 19:27:53 GMT
Author: cmlenz
Date: Fri May 23 12:27:52 2008
New Revision: 659636

URL: http://svn.apache.org/viewvc?rev=659636&view=rev
Log:
Patch MochiWeb for compatibility with R11B. This patch has been rejected upstream, but it's
simple enough to just apply here.

Modified:
    incubator/couchdb/trunk/src/mochiweb/mochifmt.erl
    incubator/couchdb/trunk/src/mochiweb/mochiweb_headers.erl
    incubator/couchdb/trunk/src/mochiweb/mochiweb_html.erl
    incubator/couchdb/trunk/src/mochiweb/mochiweb_multipart.erl
    incubator/couchdb/trunk/src/mochiweb/mochiweb_util.erl

Modified: incubator/couchdb/trunk/src/mochiweb/mochifmt.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/mochiweb/mochifmt.erl?rev=659636&r1=659635&r2=659636&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/mochiweb/mochifmt.erl (original)
+++ incubator/couchdb/trunk/src/mochiweb/mochifmt.erl Fri May 23 12:27:52 2008
@@ -297,7 +297,7 @@
 convert2(Arg, #conversion{ctype=upper_hex}) ->
     erlang:integer_to_list(Arg, 16);
 convert2(Arg, #conversion{ctype=hex}) ->
-    string:to_lower(erlang:integer_to_list(Arg, 16));
+    mochiweb_util:to_lower(erlang:integer_to_list(Arg, 16));
 convert2(Arg, #conversion{ctype=char}) when Arg < 16#80 ->
     [Arg];
 convert2(Arg, #conversion{ctype=char}) ->

Modified: incubator/couchdb/trunk/src/mochiweb/mochiweb_headers.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/mochiweb/mochiweb_headers.erl?rev=659636&r1=659635&r2=659636&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/mochiweb/mochiweb_headers.erl (original)
+++ incubator/couchdb/trunk/src/mochiweb/mochiweb_headers.erl Fri May 23 12:27:52 2008
@@ -160,7 +160,7 @@
     V0 ++ ", " ++ V1.
 
 normalize(K) when is_list(K) ->
-    string:to_lower(K);
+    mochiweb_util:to_lower(K);
 normalize(K) when is_atom(K) ->
     normalize(atom_to_list(K));
 normalize(K) when is_binary(K) ->

Modified: incubator/couchdb/trunk/src/mochiweb/mochiweb_html.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/mochiweb/mochiweb_html.erl?rev=659636&r1=659635&r2=659636&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/mochiweb/mochiweb_html.erl (original)
+++ incubator/couchdb/trunk/src/mochiweb/mochiweb_html.erl Fri May 23 12:27:52 2008
@@ -328,7 +328,7 @@
     end.
 
 parse_flag({start_tag, B, _, false}) ->
-    case string:to_lower(binary_to_list(B)) of
+    case mochiweb_util:to_lower(binary_to_list(B)) of
         "script" ->
             script;
         "textarea" ->
@@ -521,7 +521,7 @@
 norm(Tag) when is_binary(Tag) ->
     Tag;
 norm(Tag) ->
-    list_to_binary(string:to_lower(Tag)).
+    list_to_binary(mochiweb_util:to_lower(Tag)).
 
 test_destack() ->
     {<<"a">>, [], []} =

Modified: incubator/couchdb/trunk/src/mochiweb/mochiweb_multipart.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/mochiweb/mochiweb_multipart.erl?rev=659636&r1=659635&r2=659636&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/mochiweb/mochiweb_multipart.erl (original)
+++ incubator/couchdb/trunk/src/mochiweb/mochiweb_multipart.erl Fri May 23 12:27:52 2008
@@ -103,7 +103,7 @@
 split_header(Line) ->
     {Name, [$: | Value]} = lists:splitwith(fun (C) -> C =/= $: end,
                                            binary_to_list(Line)),
-    {string:to_lower(string:strip(Name)),
+    {mochiweb_util:to_lower(string:strip(Name)),
      mochiweb_util:parse_header(Value)}.
 
 read_chunk(Req, Length) when Length > 0 ->

Modified: incubator/couchdb/trunk/src/mochiweb/mochiweb_util.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/mochiweb/mochiweb_util.erl?rev=659636&r1=659635&r2=659636&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/mochiweb/mochiweb_util.erl (original)
+++ incubator/couchdb/trunk/src/mochiweb/mochiweb_util.erl Fri May 23 12:27:52 2008
@@ -11,6 +11,7 @@
 -export([guess_mime/1, parse_header/1]).
 -export([shell_quote/1, cmd/1, cmd_string/1, cmd_port/2]).
 -export([record_to_proplist/2, record_to_proplist/3]).
+-export([to_lower/1]).
 -export([test/0]).
 
 -define(PERCENT, 37).  % $\%
@@ -170,7 +171,7 @@
 urlsplit_scheme([], Acc) ->
     {"", lists:reverse(Acc)};
 urlsplit_scheme(":" ++ Rest, Acc) ->
-    {string:to_lower(lists:reverse(Acc)), Rest};
+    {to_lower(lists:reverse(Acc)), Rest};
 urlsplit_scheme([C | Rest], Acc) ->
     urlsplit_scheme(Rest, [C | Acc]).
 
@@ -322,11 +323,11 @@
                         %% Skip anything with no value
                         Acc;
                     {Name, [$\= | Value]} ->
-                        [{string:to_lower(string:strip(Name)),
+                        [{to_lower(string:strip(Name)),
                           unquote_header(string:strip(Value))} | Acc]
                 end
         end,
-    {string:to_lower(Type),
+    {to_lower(Type),
      lists:foldr(F, [], Parts)}.
 
 unquote_header("\"" ++ Rest) ->
@@ -369,6 +370,20 @@
 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(),



Mime
View raw message