Skip to content
This repository has been archived by the owner on Sep 19, 2019. It is now read-only.

Commit

Permalink
Release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandrashekhar Mullaparthi committed Nov 10, 2010
1 parent 7958fc2 commit 1a08838
Show file tree
Hide file tree
Showing 11 changed files with 429 additions and 101 deletions.
7 changes: 7 additions & 0 deletions Makefile
Expand Up @@ -9,3 +9,10 @@ clean:
install: all
mkdir -p $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/
cp -r ebin $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/

test: all
erl -noshell -pa ebin -s ibrowse -s ibrowse_test unit_tests \
-s ibrowse_test verify_chunked_streaming \
-s ibrowse_test test_chunked_streaming_once \
-s erlang halt

75 changes: 75 additions & 0 deletions README
Expand Up @@ -22,8 +22,83 @@ Version : 2.0.1

Latest version : git://github.com/cmullaparthi/ibrowse.git

CONTRIBUTORS
============
The following people have helped maked ibrowse better by reporting bugs,
supplying patches and also asking for new features. Please write to me if you
have contributed and I've missed you out.

In alphabetical order:

Adam Kocoloski
Andrew Tunnell-Jones
Anthony Molinaro
Benoit Chesneau
Chris Newcombe
Dan Kelley
Derek Upham
Eric Merritt
Erik Reitsma
Filipe David Manana
Geoff Cant
Jeroen Koops
Jo�o Lopes
Karol Skocik
Kostis Sagonas
Matthew Reilly
Oscar Hellstr�m
Paul J. Davis
Peter Kristensen
Ram Krishnan
Richard Cameron
Sean Hinde
Seth Falcon
Steve Vinoski
Thomas Lindgren
Younès Hafri
tholschuh (https://github.com/tholschuh/)

CONTRIBUTIONS & CHANGE HISTORY
==============================
25-10-2010 - v2.1.0
* Fixed build on OpenSolaris. Bug report and patch from
tholschuh.
http://github.com/cmullaparthi/ibrowse/issues/issue/10

* Fixed behaviour of inactivity_timeout option. Reported by
Jo�o Lopes.
http://github.com/cmullaparthi/ibrowse/issues/issue/11

* Prevent atom table pollution when bogus URLs are input to
ibrowse. Bug report by Jo�o Lopes.
http://github.com/cmullaparthi/ibrowse/issues/issue/13

* Automatically do Chunked-Transfer encoding of request body
when the body is generated by a fun. Patch provided by
Filipe David Manana.
http://github.com/cmullaparthi/ibrowse/issues/issue/14

* Depending on input options, ibrowse sometimes included multiple
Content-Length headers. Bug reported by Paul J. Davis
http://github.com/cmullaparthi/ibrowse/issues/issue/15

* Deal with webservers which do not provide a Reason-Phrase on the
response Status-Line. Patch provided by Jeroen Koops.
http://github.com/cmullaparthi/ibrowse/issues/issue/16

* Fixed http://github.com/cmullaparthi/ibrowse/issues/issue/17
This was reported by Filipe David Manana.

* Fixed http://github.com/cmullaparthi/ibrowse/issues/issue/19
This was reported by Dan Kelley and Filipe David Manana.

* Added ibrowse:stream_close/1 to close the connection
associated with a certain response stream. Patch provided by
Jo�o Lopes.

* Prevent port number being included in the Host header when port
443 is intended. Bug reported by Andrew Tunnell-Jones

24-09-2010 - v2.0.1
* Removed a spurious io:format statement

Expand Down
51 changes: 36 additions & 15 deletions doc/ibrowse.html
Expand Up @@ -9,14 +9,14 @@
<hr>

<h1>Module ibrowse</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>The ibrowse application implements an HTTP 1.1 client.
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>The ibrowse application implements an HTTP 1.1 client in erlang.
<p>Copyright © 2005-2010 Chandrashekhar Mullaparthi</p>

<p><b>Version:</b> 2.0.1</p>
<p><b>Version:</b> 2.1.0</p>
<p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
<p><b>Authors:</b> Chandrashekhar Mullaparthi (<a href="mailto:chandrashekhar dot mullaparthi at gmail dot com"><tt>chandrashekhar dot mullaparthi at gmail dot com</tt></a>).</p>

<h2><a name="description">Description</a></h2><p>The ibrowse application implements an HTTP 1.1 client. This
<h2><a name="description">Description</a></h2><p>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,20 +87,24 @@ <h2><a name="index">Function Index</a></h2>
<tr><td valign="top"><a href="#set_dest-3">set_dest/3</a></td><td>Deprecated.</td></tr>
<tr><td valign="top"><a href="#set_max_pipeline_size-3">set_max_pipeline_size/3</a></td><td>Set the maximum pipeline size for each connection to a specific Host:Port.</td></tr>
<tr><td valign="top"><a href="#set_max_sessions-3">set_max_sessions/3</a></td><td>Set the maximum number of connections allowed to a specific Host:Port.</td></tr>
<tr><td valign="top"><a href="#show_dest_status-0">show_dest_status/0</a></td><td></td></tr>
<tr><td valign="top"><a href="#show_dest_status-0">show_dest_status/0</a></td><td>Shows some internal information about load balancing.</td></tr>
<tr><td valign="top"><a href="#show_dest_status-2">show_dest_status/2</a></td><td>Shows some internal information about load balancing to a
specified Host:Port.</td></tr>
<tr><td valign="top"><a href="#spawn_link_worker_process-1">spawn_link_worker_process/1</a></td><td>Same as spawn_worker_process/1 except the the calling process
is linked to the worker process which is spawned.</td></tr>
<tr><td valign="top"><a href="#spawn_link_worker_process-2">spawn_link_worker_process/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#spawn_link_worker_process-2">spawn_link_worker_process/2</a></td><td>Same as spawn_worker_process/2 except the the calling process
is linked to the worker process which is spawned.</td></tr>
<tr><td valign="top"><a href="#spawn_worker_process-1">spawn_worker_process/1</a></td><td>Creates a HTTP client process to the specified Host:Port which
is not part of the load balancing pool.</td></tr>
<tr><td valign="top"><a href="#spawn_worker_process-2">spawn_worker_process/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#spawn_worker_process-2">spawn_worker_process/2</a></td><td>Same as spawn_worker_process/1 but takes as input a Host and Port
instead of a URL.</td></tr>
<tr><td valign="top"><a href="#start-0">start/0</a></td><td>Starts the ibrowse process without linking.</td></tr>
<tr><td valign="top"><a href="#start_link-0">start_link/0</a></td><td>Starts the ibrowse process linked to the calling process.</td></tr>
<tr><td valign="top"><a href="#stop-0">stop/0</a></td><td>Stop the ibrowse process.</td></tr>
<tr><td valign="top"><a href="#stop_worker_process-1">stop_worker_process/1</a></td><td>Terminate a worker process spawned using
spawn_worker_process/2 or spawn_link_worker_process/2.</td></tr>
<tr><td valign="top"><a href="#stream_close-1">stream_close/1</a></td><td>Tell ibrowse to close the connection associated with the
specified stream.</td></tr>
<tr><td valign="top"><a href="#stream_next-1">stream_next/1</a></td><td>Tell ibrowse to stream the next chunk of data to the
caller.</td></tr>
<tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td></td></tr>
Expand Down Expand Up @@ -245,11 +249,15 @@ <h3 class="function"><a name="send_req-5">send_req/5</a></h3>
information as it has, such as HTTP Status Code and HTTP Headers. When this happens, the response
is of the form <code>{error, {Reason, {stat_code, StatusCode}, HTTP_headers}}</code></li>

<li>The <code>inactivity_timeout</code> option is useful when
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>
<li><p>The <code>inactivity_timeout</code> option is useful when
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.</p>

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 @@ -343,7 +351,9 @@ <h3 class="function"><a name="set_max_sessions-3">set_max_sessions/3</a></h3>
<h3 class="function"><a name="show_dest_status-0">show_dest_status/0</a></h3>
<div class="spec">
<p><tt>show_dest_status() -&gt; any()</tt></p>
</div>
</div><p>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.</p>

<h3 class="function"><a name="show_dest_status-2">show_dest_status/2</a></h3>
<div class="spec">
Expand All @@ -362,7 +372,8 @@ <h3 class="function"><a name="spawn_link_worker_process-1">spawn_link_worker_pro
<h3 class="function"><a name="spawn_link_worker_process-2">spawn_link_worker_process/2</a></h3>
<div class="spec">
<p><tt>spawn_link_worker_process(Host::string(), Port::integer()) -&gt; {ok, pid()}</tt></p>
</div>
</div><p>Same as spawn_worker_process/2 except the the calling process
is linked to the worker process which is spawned.</p>

<h3 class="function"><a name="spawn_worker_process-1">spawn_worker_process/1</a></h3>
<div class="spec">
Expand All @@ -383,7 +394,8 @@ <h3 class="function"><a name="spawn_worker_process-1">spawn_worker_process/1</a>
<h3 class="function"><a name="spawn_worker_process-2">spawn_worker_process/2</a></h3>
<div class="spec">
<p><tt>spawn_worker_process(Host::string(), Port::integer()) -&gt; {ok, pid()}</tt></p>
</div>
</div><p>Same as spawn_worker_process/1 but takes as input a Host and Port
instead of a URL.</p>

<h3 class="function"><a name="start-0">start/0</a></h3>
<div class="spec">
Expand All @@ -407,6 +419,15 @@ <h3 class="function"><a name="stop_worker_process-1">stop_worker_process/1</a></
spawn_worker_process/2 or spawn_link_worker_process/2. Requests in
progress will get the error response <pre>{error, closing_on_request}</pre></p>

<h3 class="function"><a name="stream_close-1">stream_close/1</a></h3>
<div class="spec">
<p><tt>stream_close(Req_id::<a href="#type-req_id">req_id()</a>) -&gt; ok | {error, unknown_req_id}</tt></p>
</div><p>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.</p>

<h3 class="function"><a name="stream_next-1">stream_next/1</a></h3>
<div class="spec">
<p><tt>stream_next(Req_id::<a href="#type-req_id">req_id()</a>) -&gt; ok | {error, unknown_req_id}</tt></p>
Expand Down Expand Up @@ -446,6 +467,6 @@ <h3 class="function"><a name="trace_on-2">trace_on/2</a></h3>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, Sep 24 2010, 06:42:36.</i></p>
<p><i>Generated by EDoc, Nov 10 2010, 06:04:33.</i></p>
</body>
</html>
2 changes: 1 addition & 1 deletion ebin/ibrowse.app
@@ -1,6 +1,6 @@
{application, ibrowse,
[{description, "HTTP client application"},
{vsn, "2.0.0"},
{vsn, "2.1.0"},
{modules, [ ibrowse,
ibrowse_http_client,
ibrowse_app,
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Expand Up @@ -24,7 +24,7 @@ $(EBIN)/%.beam: %.erl
${ERLC} $(COMPILER_OPTIONS) $(INCLUDE_DIRS) -o ../ebin $<

$(EBIN)/%.app: %.app.src ../vsn.mk Makefile
sed -e s^%IBROWSE_VSN%^$(IBROWSE_VSN)^ \
sed -e s/%IBROWSE_VSN%/$(IBROWSE_VSN)/ \
$< > $@

clean:
Expand Down
33 changes: 30 additions & 3 deletions src/ibrowse.erl
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

0 comments on commit 1a08838

Please sign in to comment.