Skip to content

Commit

Permalink
Updated ibrowse to version 2.1.0. It contains fixes for the following…
Browse files Browse the repository at this point in the history
  • Loading branch information
fdmanana committed Nov 10, 2010
1 parent 4084b2b commit 61a64a2
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 94 deletions.
2 changes: 1 addition & 1 deletion src/ibrowse/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## License for the specific language governing permissions and limitations under
## the License.

ibrowseebindir = $(localerlanglibdir)/ibrowse-2.0.1/ebin
ibrowseebindir = $(localerlanglibdir)/ibrowse-2.1.0/ebin

ibrowse_file_collection = \
ibrowse.app.in \
Expand Down
2 changes: 1 addition & 1 deletion src/ibrowse/ibrowse.app.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, ibrowse,
[{description, "HTTP client application"},
{vsn, "2.0.1"},
{vsn, "2.1.0"},
{modules, [ ibrowse,
ibrowse_http_client,
ibrowse_app,
Expand Down
33 changes: 30 additions & 3 deletions src/ibrowse/ibrowse.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
%%%-------------------------------------------------------------------
%% @author Chandrashekhar Mullaparthi <chandrashekhar dot mullaparthi at gmail dot com>
%% @copyright 2005-2010 Chandrashekhar Mullaparthi
%% @version 2.0.1
%% @doc The ibrowse application implements an HTTP 1.1 client. This
%% @version 2.1.0
%% @doc The ibrowse application implements an HTTP 1.1 client in erlang. 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
%% one process to handle one TCP connection to a webserver
Expand Down Expand Up @@ -87,6 +87,7 @@
send_req_direct/6,
send_req_direct/7,
stream_next/1,
stream_close/1,
set_max_sessions/3,
set_max_pipeline_size/3,
set_dest/3,
Expand Down Expand Up @@ -201,7 +202,11 @@ send_req(Url, Headers, Method, Body) ->
%% dealing with large response bodies and/or slow links. In these
%% cases, it might be hard to estimate how long a request will take to
%% complete. In such cases, the client might want to timeout if no
%% data has been received on the link for a certain time interval.</li>
%% data has been received on the link for a certain time interval.
%%
%% This value is also used to close connections which are not in use for
%% the specified timeout value.
%% </li>
%%
%% <li>
%% The <code>connect_timeout</code> option is to specify how long the
Expand Down Expand Up @@ -458,6 +463,8 @@ ensure_bin({Fun, _} = Body) when is_function(Fun) -> Body.
spawn_worker_process(Url) ->
ibrowse_http_client:start(Url).

%% @doc Same as spawn_worker_process/1 but takes as input a Host and Port
%% instead of a URL.
%% @spec spawn_worker_process(Host::string(), Port::integer()) -> {ok, pid()}
spawn_worker_process(Host, Port) ->
ibrowse_http_client:start({Host, Port}).
Expand All @@ -468,6 +475,8 @@ spawn_worker_process(Host, Port) ->
spawn_link_worker_process(Url) ->
ibrowse_http_client:start_link(Url).

%% @doc Same as spawn_worker_process/2 except the the calling process
%% is linked to the worker process which is spawned.
%% @spec spawn_link_worker_process(Host::string(), Port::integer()) -> {ok, pid()}
spawn_link_worker_process(Host, Port) ->
ibrowse_http_client:start_link({Host, Port}).
Expand Down Expand Up @@ -524,6 +533,21 @@ stream_next(Req_id) ->
ok
end.

%% @doc Tell ibrowse to close the connection associated with the
%% specified stream. Should be used in conjunction with the
%% <code>stream_to</code> option. Note that all requests in progress on
%% the connection which is serving this Req_id will be aborted, and an
%% error returned.
%% @spec stream_close(Req_id :: req_id()) -> ok | {error, unknown_req_id}
stream_close(Req_id) ->
case ets:lookup(ibrowse_stream, {req_id_pid, Req_id}) of
[] ->
{error, unknown_req_id};
[{_, Pid}] ->
catch Pid ! {stream_close, Req_id},
ok
end.

%% @doc Turn tracing on for the ibrowse process
trace_on() ->
ibrowse ! {trace, true}.
Expand Down Expand Up @@ -553,6 +577,9 @@ all_trace_off() ->
ibrowse ! all_trace_off,
ok.

%% @doc Shows some internal information about load balancing. Info
%% about workers spawned using spawn_worker_process/2 or
%% spawn_link_worker_process/2 is not included.
show_dest_status() ->
Dests = lists:filter(fun({lb_pid, {Host, Port}, _}) when is_list(Host),
is_integer(Port) ->
Expand Down
Loading

0 comments on commit 61a64a2

Please sign in to comment.