couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject svn commit: r795278 - in /couchdb/trunk/src/ibrowse: ibrowse.app ibrowse.erl ibrowse_http_client.erl ibrowse_lb.erl ibrowse_lib.erl
Date Fri, 17 Jul 2009 23:58:35 GMT
Author: kocolosk
Date: Fri Jul 17 23:58:35 2009
New Revision: 795278

URL: http://svn.apache.org/viewvc?rev=795278&view=rev
Log:
update ibrowse to 1.5.1+

Modified:
    couchdb/trunk/src/ibrowse/ibrowse.app
    couchdb/trunk/src/ibrowse/ibrowse.erl
    couchdb/trunk/src/ibrowse/ibrowse_http_client.erl
    couchdb/trunk/src/ibrowse/ibrowse_lb.erl
    couchdb/trunk/src/ibrowse/ibrowse_lib.erl

Modified: couchdb/trunk/src/ibrowse/ibrowse.app
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse.app?rev=795278&r1=795277&r2=795278&view=diff
==============================================================================
--- couchdb/trunk/src/ibrowse/ibrowse.app (original)
+++ couchdb/trunk/src/ibrowse/ibrowse.app Fri Jul 17 23:58:35 2009
@@ -1,6 +1,6 @@
 {application, ibrowse,
         [{description, "HTTP client application"},
-         {vsn, "1.5.0"},
+         {vsn, "1.5.1"},
          {modules, [ ibrowse,
 		     ibrowse_http_client,
 		     ibrowse_app,

Modified: couchdb/trunk/src/ibrowse/ibrowse.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse.erl?rev=795278&r1=795277&r2=795278&view=diff
==============================================================================
--- couchdb/trunk/src/ibrowse/ibrowse.erl (original)
+++ couchdb/trunk/src/ibrowse/ibrowse.erl Fri Jul 17 23:58:35 2009
@@ -7,7 +7,7 @@
 %%%-------------------------------------------------------------------
 %% @author Chandrashekhar Mullaparthi <chandrashekhar dot mullaparthi at gmail dot com>
 %% @copyright 2005-2009 Chandrashekhar Mullaparthi
-%% @version 1.5.0
+%% @version 1.5.1
 %% @doc The ibrowse application implements an HTTP 1.1 client. This
 %% module implements the API of the HTTP client. There is one named
 %% process called 'ibrowse' which assists in load balancing and maintaining configuration.
There is one load balancing process per unique webserver. There is
@@ -152,7 +152,7 @@
 %% headerName() = string()
 %% headerValue() = string()
 %% response() = {ok, Status, ResponseHeaders, ResponseBody} | {ibrowse_req_id, req_id() }
| {error, Reason}
-%% req_id = term()
+%% req_id() = term()
 %% ResponseBody = string() | {file, Filename}
 %% Reason = term()
 send_req(Url, Headers, Method) ->
@@ -169,7 +169,7 @@
     send_req(Url, Headers, Method, Body, []).
 
 %% @doc Same as send_req/4.
-%% For a description of SSL Options, look in the ssl manpage. If the
+%% For a description of SSL Options, look in the <a href="http://www.erlang.org/doc/apps/ssl/index.html">ssl</a>
manpage. If the
 %% HTTP Version to use is not specified, the default is 1.1.
 %% <br/>
 %% <p>The <code>host_header</code> option is useful in the case where ibrowse
is
@@ -181,7 +181,15 @@
 %% used to specify what should go in the <code>Host</code> header in
 %% the request.</p>
 %% <ul>
-%% <li>When both the options <code>save_response_to_file</code> and <code>stream_to</code>
+%% <li>The <code>stream_to</code> option can be used to have the HTTP
+%% response streamed to a process as messages as data arrives on the
+%% socket. If the calling process wishes to control the rate at which
+%% data is received from the server, the option <code>{stream_to,
+%% {process(), once}}</code> can be specified. The calling process
+%% will have to invoke <code>ibrowse:stream_next(Request_id)</code> to
+%% receive the next packet.</li>
+%%
+%% <li>When both the options <code>save_response_to_file</code> and <code>stream_to</code>

 %% are specified, the former takes precedence.</li>
 %%
 %% <li>For the <code>save_response_to_file</code> option, the response
body is saved to
@@ -239,13 +247,14 @@
 %%          {content_length, integer()}        |
 %%          {content_type, string()}           |
 %%          {save_response_to_file, srtf()}    |
-%%          {stream_to, process()}             |
+%%          {stream_to, stream_to()}           |
 %%          {http_vsn, {MajorVsn, MinorVsn}}   |
 %%          {host_header, string()}            |
 %%          {inactivity_timeout, integer()}    |
 %%          {connect_timeout, integer()}       |
 %%          {transfer_encoding, {chunked, ChunkSize}}
 %%
+%% stream_to() = process() | {process(), once}
 %% process() = pid() | atom()
 %% username() = string()
 %% password() = string()
@@ -363,10 +372,11 @@
 	    Ret
     end.
 
-ensure_bin(L) when is_list(L) ->
-    list_to_binary(L);
-ensure_bin(B) when is_binary(B) ->
-    B.
+ensure_bin(L) when is_list(L)                     -> list_to_binary(L);
+ensure_bin(B) when is_binary(B)                   -> B;
+ensure_bin(Fun) when is_function(Fun)             -> Fun;
+ensure_bin({Fun}) when is_function(Fun)           -> Fun;
+ensure_bin({Fun, _} = Body) when is_function(Fun) -> Body.
 
 %% @doc Creates a HTTP client process to the specified Host:Port which
 %% is not part of the load balancing pool. This is useful in cases

Modified: couchdb/trunk/src/ibrowse/ibrowse_http_client.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_http_client.erl?rev=795278&r1=795277&r2=795278&view=diff
==============================================================================
--- couchdb/trunk/src/ibrowse/ibrowse_http_client.erl (original)
+++ couchdb/trunk/src/ibrowse/ibrowse_http_client.erl Fri Jul 17 23:58:35 2009
@@ -388,7 +388,7 @@
 	    case TmpFilename of
 		undefined ->
 		    do_reply(State, From, StreamTo, ReqId, Resp_format,
-			     {ok, SC, Headers, lists:reverse(Buf)});
+			     {ok, SC, Headers, Buf});
 		_ ->
 		    file:close(Fd),
 		    do_reply(State, From, StreamTo, ReqId, Resp_format,

Modified: couchdb/trunk/src/ibrowse/ibrowse_lb.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_lb.erl?rev=795278&r1=795277&r2=795278&view=diff
==============================================================================
--- couchdb/trunk/src/ibrowse/ibrowse_lb.erl (original)
+++ couchdb/trunk/src/ibrowse/ibrowse_lb.erl Fri Jul 17 23:58:35 2009
@@ -151,7 +151,13 @@
     ets:match_delete(Tid, {{'_', Pid}, '_'}),
     {noreply, State#state{num_cur_sessions = Cur - 1}};
 
-handle_info({trace, Bool}, State) ->
+handle_info({trace, Bool}, #state{ets_tid = Tid} = State) ->
+    ets:foldl(fun({{_, Pid}, _}, Acc) when is_pid(Pid) ->
+		      catch Pid ! {trace, Bool},
+		      Acc;
+		 (_, Acc) ->
+		      Acc
+	      end, undefined, Tid),
     put(my_trace_flag, Bool),
     {noreply, State};
 

Modified: couchdb/trunk/src/ibrowse/ibrowse_lib.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_lib.erl?rev=795278&r1=795277&r2=795278&view=diff
==============================================================================
--- couchdb/trunk/src/ibrowse/ibrowse_lib.erl (original)
+++ couchdb/trunk/src/ibrowse/ibrowse_lib.erl Fri Jul 17 23:58:35 2009
@@ -49,7 +49,7 @@
 %% @spec url_encode(Str) -> UrlEncodedStr
 %% Str = string()
 %% UrlEncodedStr = string()
-url_encode(Str) when list(Str) ->
+url_encode(Str) when is_list(Str) ->
     url_encode_char(lists:reverse(Str), []).
 
 url_encode_char([X | T], Acc) when X >= $0, X =< $9 ->
@@ -70,7 +70,7 @@
 d2h(N) when N<10 -> N+$0;
 d2h(N) -> N+$a-10.
 
-decode_rfc822_date(String) when list(String) ->
+decode_rfc822_date(String) when is_list(String) ->
     case catch decode_rfc822_date_1(string:tokens(String, ", \t\r\n")) of
 	{'EXIT', _} ->
 	    {error, invalid_date};
@@ -177,9 +177,9 @@
 %% @spec encode_base64(In) -> Out
 %% In = string() | binary()
 %% Out = string() | binary()
-encode_base64(List) when list(List) ->
+encode_base64(List) when is_list(List) ->
     encode_base64_1(list_to_binary(List));
-encode_base64(Bin) when binary(Bin) ->
+encode_base64(Bin) when is_binary(Bin) ->
     List = encode_base64_1(Bin),
     list_to_binary(List).
 
@@ -197,9 +197,9 @@
 %% @spec decode_base64(In) -> Out | exit({error, invalid_input})
 %% In = string() | binary()
 %% Out = string() | binary()
-decode_base64(List) when list(List) ->
+decode_base64(List) when is_list(List) ->
     decode_base64_1(List, []);
-decode_base64(Bin) when binary(Bin) ->
+decode_base64(Bin) when is_binary(Bin) ->
     List = decode_base64_1(binary_to_list(Bin), []),
     list_to_binary(List).
 



Mime
View raw message