You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/12 07:21:47 UTC

[15/50] [abbrv] mochiweb commit: updated refs/heads/import-master to 3a54dbf

trimmed trailing whitespace

git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791350 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/846135ee
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/846135ee
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/846135ee

Branch: refs/heads/import-master
Commit: 846135ee052586e64afa06e4b5c1027cd232e163
Parents: b207636
Author: Noah Slater <ns...@apache.org>
Authored: Mon Jul 6 00:33:50 2009 +0000
Committer: Noah Slater <ns...@apache.org>
Committed: Mon Jul 6 00:33:50 2009 +0000

----------------------------------------------------------------------
 mochijson.erl              |  8 ++++----
 mochijson2.erl             | 10 +++++-----
 mochinum.erl               |  8 ++++----
 mochiweb_charref.erl       |  2 +-
 mochiweb_cookies.erl       | 22 +++++++++++-----------
 mochiweb_echo.erl          |  2 +-
 mochiweb_headers.erl       |  4 ++--
 mochiweb_html.erl          |  2 +-
 mochiweb_request.erl       | 22 +++++++++++-----------
 mochiweb_skel.erl          |  6 +++---
 mochiweb_socket_server.erl | 14 +++++++-------
 mochiweb_util.erl          |  2 +-
 12 files changed, 51 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochijson.erl
----------------------------------------------------------------------
diff --git a/mochijson.erl b/mochijson.erl
index 0e887a9..029642a 100644
--- a/mochijson.erl
+++ b/mochijson.erl
@@ -145,7 +145,7 @@ json_encode_proplist([], _State) ->
     "{}";
 json_encode_proplist(Props, State) ->
     F = fun ({K, V}, Acc) ->
-                KS = case K of 
+                KS = case K of
                          K when is_atom(K) ->
                              json_encode_string_utf8(atom_to_list(K));
                          K when is_integer(K) ->
@@ -320,12 +320,12 @@ tokenize_string([$\\, $u, C3, C2, C1, C0 | Rest], S, Acc) ->
     % coalesce UTF-16 surrogate pair?
     C = dehex(C0) bor
         (dehex(C1) bsl 4) bor
-        (dehex(C2) bsl 8) bor 
+        (dehex(C2) bsl 8) bor
         (dehex(C3) bsl 12),
     tokenize_string(Rest, ?ADV_COL(S, 6), [C | Acc]);
 tokenize_string([C | Rest], S, Acc) when C >= $\s; C < 16#10FFFF ->
     tokenize_string(Rest, ?ADV_COL(S, 1), [C | Acc]).
-    
+
 tokenize_number(IoList=[C | _], Mode, S=#decoder{input_encoding=utf8}, Acc)
   when is_list(C); is_binary(C); C >= 16#7f ->
     List = xmerl_ucs:from_utf8(iolist_to_binary(IoList)),
@@ -418,7 +418,7 @@ is_obj({struct, Props}) ->
                 true;
             (_) ->
                 false
-        end,    
+        end,
     lists:all(F, Props).
 
 obj_from_list(Props) ->

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochijson2.erl
----------------------------------------------------------------------
diff --git a/mochijson2.erl b/mochijson2.erl
index 7d7a8af..8b6adb1 100644
--- a/mochijson2.erl
+++ b/mochijson2.erl
@@ -500,7 +500,7 @@ is_obj({Props}) ->
                 true;
             (_) ->
                 false
-        end,    
+        end,
     lists:all(F, Props).
 
 obj_from_list(Props) ->
@@ -586,21 +586,21 @@ e2j_test_vec(utf8) ->
      {[], "[]"},
      {[[]], "[[]]"},
      {[1, <<"foo">>], "[1,\"foo\"]"},
-     
+
      %% json array in a json object
      {obj_from_list([{<<"foo">>, [123]}]),
       "{\"foo\":[123]}"},
-     
+
      %% json object in a json object
      {obj_from_list([{<<"foo">>, obj_from_list([{<<"bar">>, true}])}]),
       "{\"foo\":{\"bar\":true}}"},
-     
+
      %% fold evaluation order
      {obj_from_list([{<<"foo">>, []},
                      {<<"bar">>, obj_from_list([{<<"baz">>, true}])},
                      {<<"alice">>, <<"bob">>}]),
       "{\"foo\":[],\"bar\":{\"baz\":true},\"alice\":\"bob\"}"},
-     
+
      %% json object in a json array
      {[-123, <<"foo">>, obj_from_list([{<<"bar">>, []}]), null],
       "[-123,\"foo\",{\"bar\":[]},null]"}

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochinum.erl
----------------------------------------------------------------------
diff --git a/mochinum.erl b/mochinum.erl
index 4f88f9a..6a86604 100644
--- a/mochinum.erl
+++ b/mochinum.erl
@@ -40,7 +40,7 @@ digits(Float) ->
         _ ->
             R
     end.
-    
+
 %% @spec frexp(F::float()) -> {Frac::float(), Exp::float()}
 %% @doc  Return the fractional and exponent part of an IEEE 754 double,
 %%       equivalent to the libc function of the same name.
@@ -205,7 +205,7 @@ generate(R0, S, MPlus, MMinus, LowOk, HighOk) ->
             end
     end.
 
-unpack(Float) ->    
+unpack(Float) ->
     <<Sign:1, Exp:11, Frac:52>> = <<Float:64/float>>,
     {Sign, Exp, Frac}.
 
@@ -243,7 +243,7 @@ test_int_ceil() ->
     -1 = int_ceil(-1.5),
     -2 = int_ceil(-2.0),
     ok.
-    
+
 test_int_pow() ->
     1 = int_pow(1, 1),
     1 = int_pow(1, 0),
@@ -252,7 +252,7 @@ test_int_pow() ->
     100 = int_pow(10, 2),
     1000 = int_pow(10, 3),
     ok.
-    
+
 test_digits() ->
     "0" = digits(0),
     "0.0" = digits(0.0),

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_charref.erl
----------------------------------------------------------------------
diff --git a/mochiweb_charref.erl b/mochiweb_charref.erl
index 59fd4a4..d037d2f 100644
--- a/mochiweb_charref.erl
+++ b/mochiweb_charref.erl
@@ -26,7 +26,7 @@ charref([$# | L]) ->
     end;
 charref(L) ->
     entity(L).
-    
+
 %% @spec test() -> ok
 %% @doc Run tests for mochiweb_charref.
 test() ->

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_cookies.erl
----------------------------------------------------------------------
diff --git a/mochiweb_cookies.erl b/mochiweb_cookies.erl
index acea12a..b9da37b 100644
--- a/mochiweb_cookies.erl
+++ b/mochiweb_cookies.erl
@@ -29,8 +29,8 @@
 cookie(Key, Value) ->
     cookie(Key, Value, []).
 
-%% @spec cookie(Key::string(), Value::string(), Options::[Option]) -> header() 
-%% where Option = {max_age, integer()} | {local_time, {date(), time()}} 
+%% @spec cookie(Key::string(), Value::string(), Options::[Option]) -> header()
+%% where Option = {max_age, integer()} | {local_time, {date(), time()}}
 %%                | {domain, string()} | {path, string()}
 %%                | {secure, true | false}
 %%
@@ -118,9 +118,9 @@ age_to_cookie_date(Age, LocalTime) ->
 %% @spec parse_cookie(string()) -> [{K::string(), V::string()}]
 %% @doc Parse the contents of a Cookie header field, ignoring cookie
 %% attributes, and return a simple property list.
-parse_cookie("") -> 
+parse_cookie("") ->
     [];
-parse_cookie(Cookie) -> 
+parse_cookie(Cookie) ->
     parse_cookie(Cookie, []).
 
 %% @spec test() -> ok
@@ -133,8 +133,8 @@ test() ->
 %% Internal API
 
 parse_cookie([], Acc) ->
-    lists:reverse(Acc); 
-parse_cookie(String, Acc) -> 
+    lists:reverse(Acc);
+parse_cookie(String, Acc) ->
     {{Token, Value}, Rest} = read_pair(String),
     Acc1 = case Token of
                "" ->
@@ -173,7 +173,7 @@ read_quoted([$\\, Any | Rest], Acc) ->
     read_quoted(Rest, [Any | Acc]);
 read_quoted([C | Rest], Acc) ->
     read_quoted(Rest, [C | Acc]).
-    
+
 skip_whitespace(String) ->
     F = fun (C) -> ?IS_WHITESPACE(C) end,
     lists:dropwhile(F, String).
@@ -182,7 +182,7 @@ read_token(String) ->
     F = fun (C) -> not ?IS_SEPARATOR(C) end,
     lists:splitwith(F, String).
 
-skip_past_separator([]) ->    
+skip_past_separator([]) ->
     [];
 skip_past_separator([$; | Rest]) ->
     Rest;
@@ -193,7 +193,7 @@ skip_past_separator([_ | Rest]) ->
 
 parse_cookie_test() ->
     %% RFC example
-    C1 = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; 
+    C1 = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\";
     Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\";
     Shipping=\"FedEx\"; $Path=\"/acme\"",
     [
@@ -231,8 +231,8 @@ cookie_test() ->
     C1 = cookie(<<"Customer">>, <<"WILE_E_COYOTE">>, [{path, <<"/acme">>}]),
 
     {"Set-Cookie","=NoKey; Version=1"} = cookie("", "NoKey", []),
-        
-        LocalTime = calendar:universal_time_to_local_time({{2007, 5, 15}, {13, 45, 33}}), 
+
+        LocalTime = calendar:universal_time_to_local_time({{2007, 5, 15}, {13, 45, 33}}),
     C2 = {"Set-Cookie",
           "Customer=WILE_E_COYOTE; "
           "Version=1; "

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_echo.erl
----------------------------------------------------------------------
diff --git a/mochiweb_echo.erl b/mochiweb_echo.erl
index f0c455a..f32d680 100644
--- a/mochiweb_echo.erl
+++ b/mochiweb_echo.erl
@@ -9,7 +9,7 @@
 
 stop() ->
     mochiweb_socket_server:stop(?MODULE).
-    
+
 start() ->
     mochiweb_socket_server:start([{name, ?MODULE},
                                   {port, 6789},

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_headers.erl
----------------------------------------------------------------------
diff --git a/mochiweb_headers.erl b/mochiweb_headers.erl
index 4c0a2d7..b29ff31 100644
--- a/mochiweb_headers.erl
+++ b/mochiweb_headers.erl
@@ -19,7 +19,7 @@
 %% @doc Run tests for this module.
 test() ->
     H = ?MODULE:make([{hdr, foo}, {"Hdr", "bar"}, {'Hdr', 2}]),
-    [{hdr, "foo, bar, 2"}] = ?MODULE:to_list(H), 
+    [{hdr, "foo, bar, 2"}] = ?MODULE:to_list(H),
     H1 = ?MODULE:insert(taco, grande, H),
     [{hdr, "foo, bar, 2"}, {taco, "grande"}] = ?MODULE:to_list(H1),
     H2 = ?MODULE:make([{"Set-Cookie", "foo"}]),
@@ -69,7 +69,7 @@ default_from_list(List, T) ->
 
 %% @spec to_list(headers()) -> [{key(), string()}]
 %% @doc Return the contents of the headers. The keys will be the exact key
-%%      that was first inserted (e.g. may be an atom or binary, case is 
+%%      that was first inserted (e.g. may be an atom or binary, case is
 %%      preserved).
 to_list(T) ->
     F = fun ({K, {array, L}}, Acc) ->

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_html.erl
----------------------------------------------------------------------
diff --git a/mochiweb_html.erl b/mochiweb_html.erl
index d9a3cf2..05ea638 100644
--- a/mochiweb_html.erl
+++ b/mochiweb_html.erl
@@ -540,7 +540,7 @@ tree([T={comment, _Comment} | Rest], S) ->
     tree(Rest, append_stack_child(T, S));
 tree(L=[{data, _Data, _Whitespace} | _], S) ->
     case tree_data(L, true, []) of
-        {_, true, Rest} -> 
+        {_, true, Rest} ->
             tree(Rest, S);
         {Data, false, Rest} ->
             tree(Rest, append_stack_child(Data, S))

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_request.erl
----------------------------------------------------------------------
diff --git a/mochiweb_request.erl b/mochiweb_request.erl
index 1a2764e..64c4f58 100644
--- a/mochiweb_request.erl
+++ b/mochiweb_request.erl
@@ -173,13 +173,13 @@ recv_body() ->
 recv_body(MaxBody) ->
     % we could use a sane constant for max chunk size
     Body = stream_body(?MAX_RECV_BODY, fun
-        ({0, _ChunkedFooter}, {_LengthAcc, BinAcc}) -> 
+        ({0, _ChunkedFooter}, {_LengthAcc, BinAcc}) ->
             iolist_to_binary(lists:reverse(BinAcc));
         ({Length, Bin}, {LengthAcc, BinAcc}) ->
             NewLength = Length + LengthAcc,
             if NewLength > MaxBody ->
                 exit({body_too_large, chunked});
-            true -> 
+            true ->
                 {NewLength, [Bin | BinAcc]}
             end
         end, {0, []}, MaxBody),
@@ -188,7 +188,7 @@ recv_body(MaxBody) ->
 
 stream_body(MaxChunkSize, ChunkFun, FunState) ->
     stream_body(MaxChunkSize, ChunkFun, FunState, undefined).
-    
+
 stream_body(MaxChunkSize, ChunkFun, FunState, MaxBodyLength) ->
 
     case get_header_value("expect") of
@@ -215,7 +215,7 @@ stream_body(MaxChunkSize, ChunkFun, FunState, MaxBodyLength) ->
                 exit({body_too_large, content_length});
             _ ->
                 stream_unchunked_body(Length, MaxChunkSize, ChunkFun, FunState)
-            end;     
+            end;
         Length ->
             exit({length_not_integer, Length})
     end.
@@ -510,7 +510,7 @@ read_sub_chunks(Length, MaxChunkSize, Fun, FunState) when Length > MaxChunkSize
 
 read_sub_chunks(Length, _MaxChunkSize, Fun, FunState) ->
     Fun({Length, read_chunk(Length)}, FunState).
-    
+
 %% @spec serve_file(Path, DocRoot) -> Response
 %% @doc Serve a file relative to DocRoot.
 serve_file(Path, DocRoot) ->
@@ -723,19 +723,19 @@ test_range() ->
     %% valid, multiple range
     io:format("Testing parse_range_request with valid multiple ranges~n"),
     io:format("1"),
-    [{20, 30}, {50, 100}, {110, 200}] = 
+    [{20, 30}, {50, 100}, {110, 200}] =
         parse_range_request("bytes=20-30,50-100,110-200"),
     io:format("2"),
-    [{20, none}, {50, 100}, {none, 200}] = 
+    [{20, none}, {50, 100}, {none, 200}] =
         parse_range_request("bytes=20-,50-100,-200"),
     io:format(".. ok~n"),
-    
+
     %% no ranges
     io:format("Testing out parse_range_request with no ranges~n"),
     io:format("1"),
     [] = parse_range_request("bytes="),
     io:format(".. ok~n"),
-    
+
     Body = <<"012345678901234567890123456789012345678901234567890123456789">>,
     BodySize = size(Body), %% 60
     BodySize = 60,
@@ -751,7 +751,7 @@ test_range() ->
     io:format("4"),
     {30, 30} = range_skip_length({30, none}, BodySize), %% 30-
     io:format(".. ok ~n"),
-    
+
     %% valid edge cases for range_skip_length
     io:format("Testing out range_skip_length on valid edge case ranges~n"),
     io:format("1"),
@@ -787,4 +787,4 @@ test_range() ->
     invalid_range = range_skip_length({BodySize, none}, BodySize),
     io:format(".. ok ~n"),
     ok.
-    
+

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_skel.erl
----------------------------------------------------------------------
diff --git a/mochiweb_skel.erl b/mochiweb_skel.erl
index a1c37f9..098951b 100644
--- a/mochiweb_skel.erl
+++ b/mochiweb_skel.erl
@@ -7,7 +7,7 @@
 
 skelcopy(DestDir, Name) ->
     ok = ensuredir(DestDir),
-    LDst = case length(filename:dirname(DestDir)) of 
+    LDst = case length(filename:dirname(DestDir)) of
                1 -> %% handle case when dirname returns "/"
                    0;
                N ->
@@ -17,7 +17,7 @@ skelcopy(DestDir, Name) ->
     ok = file:make_symlink(
         filename:join(filename:dirname(code:which(?MODULE)), ".."),
         filename:join([DestDir, Name, "deps", "mochiweb-src"])).
-    
+
 
 %% Internal API
 
@@ -40,7 +40,7 @@ skelcopy(Src, DestDir, Name, LDst) ->
             io:format("~s/~n", [EDst]),
             lists:foreach(fun ("." ++ _) -> ok;
                               (F) ->
-                                  skelcopy(filename:join(Src, F), 
+                                  skelcopy(filename:join(Src, F),
                                            Dir,
                                            Name,
                                            LDst)

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_socket_server.erl
----------------------------------------------------------------------
diff --git a/mochiweb_socket_server.erl b/mochiweb_socket_server.erl
index d4853da..a483c3d 100644
--- a/mochiweb_socket_server.erl
+++ b/mochiweb_socket_server.erl
@@ -106,7 +106,7 @@ ipv6_supported() ->
 
 init(State=#mochiweb_socket_server{ip=Ip, port=Port, backlog=Backlog}) ->
     process_flag(trap_exit, true),
-    BaseOpts = [binary, 
+    BaseOpts = [binary,
                 {reuseaddr, true},
                 {packet, 0},
                 {backlog, Backlog},
@@ -126,7 +126,7 @@ init(State=#mochiweb_socket_server{ip=Ip, port=Port, backlog=Backlog}) ->
     end,
     case gen_tcp_listen(Port, Opts, State) of
         {stop, eacces} ->
-            case Port < 1024 of 
+            case Port < 1024 of
                 true ->
                     case fdsrv:start() of
                         {ok, _} ->
@@ -150,7 +150,7 @@ gen_tcp_listen(Port, Opts, State) ->
     case gen_tcp:listen(Port, Opts) of
         {ok, Listen} ->
             {ok, ListenPort} = inet:port(Listen),
-            {ok, new_acceptor(State#mochiweb_socket_server{listen=Listen, 
+            {ok, new_acceptor(State#mochiweb_socket_server{listen=Listen,
                                                            port=ListenPort})};
         {error, Reason} ->
             {stop, Reason}
@@ -183,11 +183,11 @@ acceptor_loop({Server, Listen, Loop}) ->
                lists:flatten(io_lib:format("~p", [Other]))]),
             exit({error, accept_failed})
     end.
-            
+
 
 do_get(port, #mochiweb_socket_server{port=Port}) ->
     Port.
-    
+
 handle_call({get, Property}, _From, State) ->
     Res = do_get(Property, State),
     {reply, Res, State};
@@ -205,7 +205,7 @@ handle_cast(stop, State) ->
 
 terminate(_Reason, #mochiweb_socket_server{listen=Listen, port=Port}) ->
     gen_tcp:close(Listen),
-    case Port < 1024 of 
+    case Port < 1024 of
         true ->
             catch fdsrv:stop(),
             ok;
@@ -228,7 +228,7 @@ handle_info({'EXIT', Pid, Reason},
     {noreply, new_acceptor(State)};
 handle_info({'EXIT', _LoopPid, Reason},
             State=#mochiweb_socket_server{acceptor=Pid, max=Max}) ->
-    case Reason of 
+    case Reason of
         normal ->
             ok;
         _ ->

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/846135ee/mochiweb_util.erl
----------------------------------------------------------------------
diff --git a/mochiweb_util.erl b/mochiweb_util.erl
index 9a0675f..93c0343 100644
--- a/mochiweb_util.erl
+++ b/mochiweb_util.erl
@@ -418,7 +418,7 @@ record_to_proplist(Record, Fields) ->
     record_to_proplist(Record, Fields, '__record').
 
 %% @spec record_to_proplist(Record, Fields, TypeKey) -> proplist()
-%% @doc Return a proplist of the given Record with each field in the 
+%% @doc Return a proplist of the given Record with each field in the
 %%      Fields list set as a key with the corresponding value in the Record.
 %%      TypeKey is the key that is used to store the record type
 %%      Fields should be obtained by calling record_info(fields, record_type)