Bläddra i källkod

move to rebar3

pull/137/head
benoitc 9 år sedan
förälder
incheckning
1439ab010b
5 ändrade filer med 167 tillägg och 218 borttagningar
  1. +11
    -11
      .gitignore
  2. +13
    -27
      Makefile
  3. +58
    -143
      doc/ibrowse.html
  4. +84
    -37
      doc/ibrowse_lib.html
  5. +1
    -0
      rebar.lock

+ 11
- 11
.gitignore Visa fil

@ -1,12 +1,12 @@
ebin/
*~
.eunit/
*beam
doc/*.html
doc/*.css
doc/*.png
doc/edoc-info
Emakefile
*.bat
.dialyzer_plt
_build
ebin
*.beam
*.sw*
deps
.DS_Store
erl_crash.dump
.eunit
mime.types
.rebar
*.plt
.rebar

+ 13
- 27
Makefile Visa fil

@ -3,7 +3,7 @@ IBROWSE_VSN = $(shell sed -n 's/.*{vsn,.*"\(.*\)"}.*/\1/p' src/ibrowse.app.src)
DIALYZER_PLT=$(CURDIR)/.dialyzer_plt
DIALYZER_APPS=erts kernel stdlib ssl crypto public_key
REBAR ?= $(shell which rebar)
REBAR ?= $(shell which rebar3)
all: compile
@ -13,35 +13,21 @@ compile:
clean:
$(REBAR) clean
install: compile
mkdir -p $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/
cp -r ebin $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/
eunit_test: all
test:
$(REBAR) eunit
test: all
cd test; erl -pa ../../ibrowse/ebin -make; cd ../; \
erl -noshell -pa test -pa ebin -s ibrowse_test unit_tests \
-s ibrowse_test verify_chunked_streaming \
-s ibrowse_test test_chunked_streaming_once \
-s erlang halt
xref: all
$(REBAR) xref
docs:
erl -noshell \
-eval 'edoc:application(ibrowse, ".", []), init:stop().'
$(DIALYZER_PLT):
@echo Creating dialyzer plt file: $(DIALYZER_PLT)
@echo This may take a minute or two...
@echo
dialyzer --output_plt $(DIALYZER_PLT) --build_plt \
--apps $(DIALYZER_APPS)
dialyzer: $(DIALYZER_PLT)
@echo Running dialyzer...
@echo
dialyzer --fullpath --plt $(DIALYZER_PLT) -Wrace_conditions -Wunmatched_returns -Werror_handling -r ./ebin
$(REBAR) edoc
dialyzer:
$(REBAR) dialyzer
install: compile
mkdir -p $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/
cp -r _build/lib/default/ibrowse/ebin $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/
.PHONY: test docs

+ 58
- 143
doc/ibrowse.html Visa fil

@ -1,6 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module ibrowse</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
@ -10,9 +11,8 @@
<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 in erlang.
<p>Copyright © 2005-2010 Chandrashekhar Mullaparthi</p>
<p>Copyright © 2005-2014 Chandrashekhar Mullaparthi</p>
<p><b>Version:</b> 2.1.2</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>
@ -61,10 +61,13 @@ send_req/4, send_req/5, send_req/6.

</code>
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#all_trace_off-0">all_trace_off/0</a></td><td>Turn Off ALL tracing.</td></tr>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add_config-1">add_config/1</a></td><td>Add additional configuration elements at runtime.</td></tr>
<tr><td valign="top"><a href="#all_trace_off-0">all_trace_off/0</a></td><td>Turn Off ALL tracing.</td></tr>
<tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#get_config_value-1">get_config_value/1</a></td><td>Internal export.</td></tr>
<tr><td valign="top"><a href="#get_config_value-2">get_config_value/2</a></td><td>Internal export.</td></tr>
<tr><td valign="top"><a href="#get_metrics-0">get_metrics/0</a></td><td></td></tr>
<tr><td valign="top"><a href="#get_metrics-2">get_metrics/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_call-3">handle_call/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td></td></tr>
@ -85,19 +88,19 @@ send_req/4, send_req/5, send_req/6.

<tr><td valign="top"><a href="#send_req_direct-7">send_req_direct/7</a></td><td>Same as send_req/6 except that the first argument is the PID
returned by spawn_worker_process/2 or spawn_link_worker_process/2.</td></tr>
<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_attempts-3">set_max_attempts/3</a></td><td>Set the maximum attempts for each connection to a specific Host:Port.</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>Shows some internal information about load balancing.</td></tr>
<tr><td valign="top"><a href="#show_dest_status-1">show_dest_status/1</a></td><td></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>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_link_worker_process-2">spawn_link_worker_process/2</a></td><td>Same as spawn_link_worker_process/1 except with Erlang process options.</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>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="#spawn_worker_process-2">spawn_worker_process/2</a></td><td>Same as spawn_worker_process/1 except with Erlang process options.</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>
@ -118,9 +121,14 @@ send_req/4, send_req/5, send_req/6.

<h2><a name="functions">Function Details</a></h2>
<h3 class="function"><a name="add_config-1">add_config/1</a></h3>
<div class="spec">
<p><tt>add_config(Terms) -&gt; any()</tt></p>
</div><p>Add additional configuration elements at runtime.</p>
<h3 class="function"><a name="all_trace_off-0">all_trace_off/0</a></h3>
<div class="spec">
<p><tt>all_trace_off() -&gt; ok</tt></p>
<p><tt>all_trace_off() -&gt; ok</tt><br></p>
</div><p>Turn Off ALL tracing</p>
<h3 class="function"><a name="code_change-3">code_change/3</a></h3>
@ -138,6 +146,16 @@ send_req/4, send_req/5, send_req/6.

<p><tt>get_config_value(Key, DefVal) -&gt; any()</tt></p>
</div><p>Internal export</p>
<h3 class="function"><a name="get_metrics-0">get_metrics/0</a></h3>
<div class="spec">
<p><tt>get_metrics() -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="get_metrics-2">get_metrics/2</a></h3>
<div class="spec">
<p><tt>get_metrics(Host, Port) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="handle_call-3">handle_call/3</a></h3>
<div class="spec">
<p><tt>handle_call(Request, From, State) -&gt; any()</tt></p>
@ -168,35 +186,20 @@ send_req/4, send_req/5, send_req/6.

<h3 class="function"><a name="rescan_config-1">rescan_config/1</a></h3>
<div class="spec">
<p><tt>rescan_config(File) -&gt; any()</tt></p>
<p><tt>rescan_config(Terms) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="send_req-3">send_req/3</a></h3>
<div class="spec">
<p><tt>send_req(Url::string(), Headers::<a href="#type-headerList">headerList()</a>, Method::<a href="#type-method">method()</a>) -&gt; <a href="#type-response">response()</a></tt>
<ul class="definitions"><li><tt><a name="type-headerList">headerList()</a> = [{<a href="#type-header">header()</a>, <a href="#type-value">value()</a>}]</tt></li>
<li><tt><a name="type-header">header()</a> = atom() | string()</tt></li>
<li><tt><a name="type-value">value()</a> = term()</tt></li>
<li><tt><a name="type-method">method()</a> = get | post | head | options | put | delete | trace | mkcol | propfind | proppatch | lock | unlock | move | copy</tt></li>
<li><tt>Status = string()</tt></li>
<li><tt>ResponseHeaders = [<a href="#type-respHeader">respHeader()</a>]</tt></li>
<li><tt><a name="type-respHeader">respHeader()</a> = {<a href="#type-headerName">headerName()</a>, <a href="#type-headerValue">headerValue()</a>}</tt></li>
<li><tt><a name="type-headerName">headerName()</a> = string()</tt></li>
<li><tt><a name="type-headerValue">headerValue()</a> = string()</tt></li>
<li><tt><a name="type-response">response()</a> = {ok, Status, ResponseHeaders, ResponseBody} | {ibrowse_req_id, <a href="#type-req_id">req_id()</a>} | {error, Reason}</tt></li>
<li><tt><a name="type-req_id">req_id()</a> = term()</tt></li>
<li><tt>ResponseBody = string() | {file, Filename}</tt></li>
<li><tt>Reason = term()</tt></li>
</ul></p>
<ul class="definitions"><li><tt><a name="type-headerList">headerList()</a> = [{<a href="#type-header">header()</a>, <a href="#type-value">value()</a>}]</tt></li><li><tt><a name="type-header">header()</a> = atom() | string() | binary()</tt></li><li><tt><a name="type-value">value()</a> = term()</tt></li><li><tt><a name="type-method">method()</a> = get | post | head | options | put | delete | trace | mkcol | propfind | proppatch | lock | unlock | move | copy</tt></li><li><tt>Status = string()</tt></li><li><tt>ResponseHeaders = [<a href="#type-respHeader">respHeader()</a>]</tt></li><li><tt><a name="type-respHeader">respHeader()</a> = {<a href="#type-headerName">headerName()</a>, <a href="#type-headerValue">headerValue()</a>}</tt></li><li><tt><a name="type-headerName">headerName()</a> = string()</tt></li><li><tt><a name="type-headerValue">headerValue()</a> = string()</tt></li><li><tt><a name="type-response">response()</a> = {ok, Status, ResponseHeaders, ResponseBody} | {ibrowse_req_id, <a href="#type-req_id">req_id()</a>} | {error, Reason}</tt></li><li><tt><a name="type-req_id">req_id()</a> = term()</tt></li><li><tt>ResponseBody = string() | {file, Filename}</tt></li><li><tt>Reason = term()</tt></li></ul></p>
</div><p>This is the basic function to send a HTTP request.
The Status return value indicates the HTTP status code returned by the webserver</p>
<h3 class="function"><a name="send_req-4">send_req/4</a></h3>
<div class="spec">
<p><tt>send_req(Url, Headers, Method::<a href="#type-method">method()</a>, Body::<a href="#type-body">body()</a>) -&gt; <a href="#type-response">response()</a></tt>
<ul class="definitions"><li><tt><a name="type-body">body()</a> = [] | string() | binary() | <a href="#type-fun_arity_0">fun_arity_0()</a> | {<a href="#type-fun_arity_1">fun_arity_1()</a>, <a href="#type-initial_state">initial_state()</a>}</tt></li>
<li><tt><a name="type-initial_state">initial_state()</a> = term()</tt></li>
</ul></p>
<ul class="definitions"><li><tt><a name="type-body">body()</a> = [] | string() | binary() | <a href="#type-fun_arity_0">fun_arity_0()</a> | {<a href="#type-fun_arity_1">fun_arity_1()</a>, <a href="#type-initial_state">initial_state()</a>}</tt></li><li><tt><a name="type-initial_state">initial_state()</a> = term()</tt></li></ul></p>
</div><p>Same as send_req/3.
If a list is specified for the body it has to be a flat list. The body can also be a fun/0 or a fun/1. <br>
If fun/0, the connection handling process will repeatdely call the fun until it returns an error or eof. <pre>Fun() = {ok, Data} | eof</pre><br>
@ -205,106 +208,13 @@ send_req/4, send_req/5, send_req/6.

<h3 class="function"><a name="send_req-5">send_req/5</a></h3>
<div class="spec">
<p><tt>send_req(Url::string(), Headers::<a href="#type-headerList">headerList()</a>, Method::<a href="#type-method">method()</a>, Body::<a href="#type-body">body()</a>, Options::<a href="#type-optionList">optionList()</a>) -&gt; <a href="#type-response">response()</a></tt>
<ul class="definitions"><li><tt><a name="type-optionList">optionList()</a> = [<a href="#type-option">option()</a>]</tt></li>
<li><tt><a name="type-option">option()</a> = {max_sessions, integer()} | {response_format, <a href="#type-response_format">response_format()</a>} | {stream_chunk_size, integer()} | {max_pipeline_size, integer()} | {trace, <a href="#type-boolean">boolean()</a>} | {is_ssl, <a href="#type-boolean">boolean()</a>} | {ssl_options, [SSLOpt]} | {pool_name, atom()} | {proxy_host, string()} | {proxy_port, integer()} | {proxy_user, string()} | {proxy_password, string()} | {use_absolute_uri, <a href="#type-boolean">boolean()</a>} | {basic_auth, {<a href="#type-username">username()</a>, <a href="#type-password">password()</a>}} | {cookie, string()} | {content_length, integer()} | {content_type, string()} | {save_response_to_file, <a href="#type-srtf">srtf()</a>} | {stream_to, <a href="#type-stream_to">stream_to()</a>} | {http_vsn, {MajorVsn, MinorVsn}} | {host_header, string()} | {inactivity_timeout, integer()} | {connect_timeout, integer()} | {socket_options, Sock_opts} | {transfer_encoding, {chunked, ChunkSize}} | {headers_as_is, <a href="#type-boolean">boolean()</a>} | {give_raw_headers, <a href="#type-boolean">boolean()</a>} | {preserve_chunked_encoding, <a href="#type-boolean">boolean()</a>}</tt></li>
<li><tt><a name="type-stream_to">stream_to()</a> = <a href="#type-process">process()</a> | {<a href="#type-process">process()</a>, once}</tt></li>
<li><tt><a name="type-process">process()</a> = pid() | atom()</tt></li>
<li><tt><a name="type-username">username()</a> = string()</tt></li>
<li><tt><a name="type-password">password()</a> = string()</tt></li>
<li><tt>SSLOpt = term()</tt></li>
<li><tt>Sock_opts = [Sock_opt]</tt></li>
<li><tt>Sock_opt = term()</tt></li>
<li><tt>ChunkSize = integer()</tt></li>
<li><tt><a name="type-srtf">srtf()</a> = <a href="#type-boolean">boolean()</a> | <a href="#type-filename">filename()</a></tt></li>
<li><tt><a name="type-filename">filename()</a> = string()</tt></li>
<li><tt><a name="type-response_format">response_format()</a> = list | binary</tt></li>
</ul></p>
</div><p>Same as send_req/4.
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>
<ul>
<li>The <code>host_header</code> option is useful in the case where ibrowse is
connecting to a component such as <a href="http://www.stunnel.org">stunnel</a> which then sets up a
secure connection to a webserver. In this case, the URL supplied to
ibrowse must have the stunnel host/port details, but that won't
make sense to the destination webserver. This option can then be
used to specify what should go in the <code>Host</code> header in
the request.</li>
<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
file only if the status code is in the 200-299 range. If not, the response body is returned
as a string.</li>
<li>Whenever an error occurs in the processing of a request, ibrowse will return as much
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><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
client process should wait for connection establishment. This is
useful in scenarios where connections to servers are usually setup
very fast, but responses might take much longer compared to
connection setup. In such cases, it is better for the calling
process to timeout faster if there is a problem (DNS lookup
delays/failures, network routing issues, etc). The total timeout
value specified for the request will enforced. To illustrate using
an example:
<code>
ibrowse:send_req("http://www.example.com/cgi-bin/request", [], get, [], [{connect_timeout, 100}], 1000).
</code>
In the above invocation, if the connection isn't established within
100 milliseconds, the request will fail with
<code>{error, conn_failed}</code>.<br>
If connection setup succeeds, the total time allowed for the
request to complete will be 1000 milliseconds minus the time taken
for connection setup.
</li>
<li> The <code>socket_options</code> option can be used to set
specific options on the socket. The <code>{active, true | false | once}</code>
and <code>{packet_type, Packet_type}</code> will be filtered out by ibrowse. </li>
<li> The <code>headers_as_is</code> option is to enable the caller
to send headers exactly as specified in the request without ibrowse
adding some of its own. Required for some picky servers apparently. </li>
<li>The <code>give_raw_headers</code> option is to enable the
caller to get access to the raw status line and raw unparsed
headers. Not quite sure why someone would want this, but one of my
users asked for it, so here it is. </li>
<li> The <code>preserve_chunked_encoding</code> option enables the caller
to receive the raw data stream when the Transfer-Encoding of the server
response is Chunked.
</li>
</ul>
</p>
<ul class="definitions"><li><tt><a name="type-optionList">optionList()</a> = [<a href="#type-option">option()</a>]</tt></li><li><tt><a name="type-option">option()</a> = {max_sessions, integer()} | {response_format, <a href="#type-response_format">response_format()</a>} | {stream_chunk_size, integer()} | {max_pipeline_size, integer()} | {trace, boolean()} | {is_ssl, boolean()} | {ssl_options, [SSLOpt]} | {pool_name, atom()} | {proxy_host, string()} | {proxy_port, integer()} | {proxy_user, string()} | {proxy_password, string()} | {use_absolute_uri, boolean()} | {basic_auth, {<a href="#type-username">username()</a>, <a href="#type-password">password()</a>}} | {cookie, string()} | {content_length, integer()} | {content_type, string()} | {save_response_to_file, <a href="#type-srtf">srtf()</a>} | {stream_to, <a href="#type-stream_to">stream_to()</a>} | {http_vsn, {MajorVsn, MinorVsn}} | {host_header, string()} | {inactivity_timeout, integer()} | {connect_timeout, integer()} | {socket_options, Sock_opts} | {transfer_encoding, {chunked, ChunkSize}} | {headers_as_is, boolean()} | {give_raw_headers, boolean()} | {preserve_chunked_encoding, boolean()} | {workaround, head_response_with_body} | {worker_process_options, list()} | {return_raw_request, true} | {max_attempts, integer()}</tt></li><li><tt><a name="type-stream_to">stream_to()</a> = <a href="#type-process">process()</a> | {<a href="#type-process">process()</a>, once}</tt></li><li><tt><a name="type-process">process()</a> = pid() | atom()</tt></li><li><tt><a name="type-username">username()</a> = string()</tt></li><li><tt><a name="type-password">password()</a> = string()</tt></li><li><tt>SSLOpt = term()</tt></li><li><tt>Sock_opts = [Sock_opt]</tt></li><li><tt>Sock_opt = term()</tt></li><li><tt>ChunkSize = integer()</tt></li><li><tt><a name="type-srtf">srtf()</a> = boolean() | <a href="#type-filename">filename()</a> | {append, <a href="#type-filename">filename()</a>}</tt></li><li><tt><a name="type-filename">filename()</a> = string()</tt></li><li><tt><a name="type-response_format">response_format()</a> = list | binary</tt></li></ul></p>
</div><p>Same as send_req/4.</p>
<h3 class="function"><a name="send_req-6">send_req/6</a></h3>
<div class="spec">
<p><tt>send_req(Url, Headers::<a href="#type-headerList">headerList()</a>, Method::<a href="#type-method">method()</a>, Body::<a href="#type-body">body()</a>, Options::<a href="#type-optionList">optionList()</a>, Timeout) -&gt; <a href="#type-response">response()</a></tt>
<ul class="definitions"><li><tt>Timeout = integer() | infinity</tt></li>
</ul></p>
<ul class="definitions"><li><tt>Timeout = integer() | infinity</tt></li></ul></p>
</div><p>Same as send_req/5.
All timeout values are in milliseconds.</p>
@ -338,14 +248,19 @@ data has been received on the link for a certain time interval.

</div><p>Deprecated. Use set_max_sessions/3 and set_max_pipeline_size/3
for achieving the same effect.</p>
<h3 class="function"><a name="set_max_attempts-3">set_max_attempts/3</a></h3>
<div class="spec">
<p><tt>set_max_attempts(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt><br></p>
</div><p>Set the maximum attempts for each connection to a specific Host:Port.</p>
<h3 class="function"><a name="set_max_pipeline_size-3">set_max_pipeline_size/3</a></h3>
<div class="spec">
<p><tt>set_max_pipeline_size(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt></p>
<p><tt>set_max_pipeline_size(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt><br></p>
</div><p>Set the maximum pipeline size for each connection to a specific Host:Port.</p>
<h3 class="function"><a name="set_max_sessions-3">set_max_sessions/3</a></h3>
<div class="spec">
<p><tt>set_max_sessions(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt></p>
<p><tt>set_max_sessions(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt><br></p>
</div><p>Set the maximum number of connections allowed to a specific Host:Port.</p>
<h3 class="function"><a name="show_dest_status-0">show_dest_status/0</a></h3>
@ -355,6 +270,11 @@ data has been received on the link for a certain time interval.

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-1">show_dest_status/1</a></h3>
<div class="spec">
<p><tt>show_dest_status(Url) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="show_dest_status-2">show_dest_status/2</a></h3>
<div class="spec">
<p><tt>show_dest_status(Host, Port) -&gt; any()</tt></p>
@ -365,19 +285,18 @@ data has been received on the link for a certain time interval.

<h3 class="function"><a name="spawn_link_worker_process-1">spawn_link_worker_process/1</a></h3>
<div class="spec">
<p><tt>spawn_link_worker_process(Url::string()) -&gt; {ok, pid()}</tt></p>
<p><tt>spawn_link_worker_process(Url::string() | {Host::string(), Port::integer()}) -&gt; {ok, pid()}</tt><br></p>
</div><p>Same as spawn_worker_process/1 except the the calling process
is linked to the worker process which is spawned.</p>
<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><p>Same as spawn_worker_process/2 except the the calling process
is linked to the worker process which is spawned.</p>
<p><tt>spawn_link_worker_process(Host::string(), Port::integer()) -&gt; {ok, pid()}</tt><br></p>
</div><p>Same as spawn_link_worker_process/1 except with Erlang process options.</p>
<h3 class="function"><a name="spawn_worker_process-1">spawn_worker_process/1</a></h3>
<div class="spec">
<p><tt>spawn_worker_process(Url::string()) -&gt; {ok, pid()}</tt></p>
<p><tt>spawn_worker_process(Url::string() | {Host::string(), Port::integer()}) -&gt; {ok, pid()}</tt><br></p>
</div><p>Creates a HTTP client process to the specified Host:Port which
is not part of the load balancing pool. This is useful in cases
where some requests to a webserver might take a long time whereas
@ -388,14 +307,12 @@ data has been received on the link for a certain time interval.

is setup. The connection attempt is made only when the first
request is sent via any of the send_req_direct/4,5,6,7 functions.<br>
<b>Note:</b> It is the responsibility of the calling process to control
pipeline size on such connections.
</p>
pipeline size on such connections.</p>
<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><p>Same as spawn_worker_process/1 but takes as input a Host and Port
instead of a URL.</p>
<p><tt>spawn_worker_process(Host::string(), Port::integer()) -&gt; {ok, pid()}</tt><br></p>
</div><p>Same as spawn_worker_process/1 except with Erlang process options.</p>
<h3 class="function"><a name="start-0">start/0</a></h3>
<div class="spec">
@ -404,7 +321,7 @@ data has been received on the link for a certain time interval.

<h3 class="function"><a name="start_link-0">start_link/0</a></h3>
<div class="spec">
<p><tt>start_link() -&gt; {ok, pid()}</tt></p>
<p><tt>start_link() -&gt; {ok, pid()}</tt><br></p>
</div><p>Starts the ibrowse process linked to the calling process. Usually invoked by the supervisor ibrowse_sup</p>
<h3 class="function"><a name="stop-0">stop/0</a></h3>
@ -414,14 +331,14 @@ data has been received on the link for a certain time interval.

<h3 class="function"><a name="stop_worker_process-1">stop_worker_process/1</a></h3>
<div class="spec">
<p><tt>stop_worker_process(Conn_pid::pid()) -&gt; ok</tt></p>
<p><tt>stop_worker_process(Conn_pid::pid()) -&gt; ok</tt><br></p>
</div><p>Terminate a worker process spawned using
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>
<p><tt>stream_close(Req_id::<a href="#type-req_id">req_id()</a>) -&gt; ok | {error, unknown_req_id}</tt><br></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
@ -430,7 +347,7 @@ data has been received on the link for a certain time interval.

<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>
<p><tt>stream_next(Req_id::<a href="#type-req_id">req_id()</a>) -&gt; ok | {error, unknown_req_id}</tt><br></p>
</div><p>Tell ibrowse to stream the next chunk of data to the
caller. Should be used in conjunction with the
<code>stream_to</code> option</p>
@ -447,7 +364,7 @@ data has been received on the link for a certain time interval.

<h3 class="function"><a name="trace_off-2">trace_off/2</a></h3>
<div class="spec">
<p><tt>trace_off(Host, Port) -&gt; ok</tt></p>
<p><tt>trace_off(Host, Port) -&gt; ok</tt><br></p>
</div><p>Turn tracing OFF for all connections to the specified HTTP
server.</p>
@ -459,14 +376,12 @@ data has been received on the link for a certain time interval.

<h3 class="function"><a name="trace_on-2">trace_on/2</a></h3>
<div class="spec">
<p><tt>trace_on(Host, Port) -&gt; ok</tt>
<ul class="definitions"><li><tt>Host = string()</tt></li>
<li><tt>Port = integer()</tt></li>
</ul></p>
<ul class="definitions"><li><tt>Host = string()</tt></li><li><tt>Port = integer()</tt></li></ul></p>
</div><p>Turn tracing on for all connections to the specified HTTP
server. Host is whatever is specified as the domain name in the URL</p>
<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, Nov 10 2010, 06:04:33.</i></p>
<p><i>Generated by EDoc, Nov 6 2015, 11:40:24.</i></p>
</body>
</html>

+ 84
- 37
doc/ibrowse_lib.html Visa fil

@ -1,67 +1,114 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module ibrowse_lib</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></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>
<hr>
<h1>Module ibrowse_lib</h1>
Module with a few useful functions.
<ul><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
<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>Module with a few useful functions.
<h2><a name="description">Description</a></h2>Module with a few useful functions
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1"><tr><td valign="top"><a href="#dec2hex-2">dec2hex/2</a></td><td>dec2hex taken from gtk.erl in std dist
M = integer() -- number of hex digits required
N = integer() -- the number to represent as hex.</td></tr>
<tr><td valign="top"><a href="#decode_base64-1">decode_base64/1</a></td><td>Implements the base64 decoding algorithm.</td></tr>
<tr><td valign="top"><a href="#decode_rfc822_date-1">decode_rfc822_date/1</a></td><td/></tr>
<tr><td valign="top"><a href="#drv_ue-1">drv_ue/1</a></td><td/></tr>
<tr><td valign="top"><a href="#drv_ue-2">drv_ue/2</a></td><td/></tr>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#decode_base64-1">decode_base64/1</a></td><td>Implements the base64 decoding algorithm.</td></tr>
<tr><td valign="top"><a href="#decode_rfc822_date-1">decode_rfc822_date/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#do_trace-2">do_trace/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#do_trace-3">do_trace/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#do_trace-3">do_trace/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#encode_base64-1">encode_base64/1</a></td><td>Implements the base64 encoding algorithm.</td></tr>
<tr><td valign="top"><a href="#get_trace_status-2">get_trace_status/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#get_value-2">get_value/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#get_value-3">get_value/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#parse_url-1">parse_url/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#printable_date-0">printable_date/0</a></td><td></td></tr>
<tr><td valign="top"><a href="#printable_date-1">printable_date/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#status_code-1">status_code/1</a></td><td>Given a status code, returns an atom describing the status code.</td></tr>
<tr><td valign="top"><a href="#url_encode-1">url_encode/1</a></td><td>URL-encodes a string based on RFC 1738.</td></tr>
</table>
<h2><a name="functions">Function Details</a></h2>
<h3><a name="dec2hex-2">dec2hex/2</a></h3>
<p><tt>dec2hex(M::integer(), N::integer()) -&gt; string()</tt></p>
<p>dec2hex taken from gtk.erl in std dist
M = integer() -- number of hex digits required
N = integer() -- the number to represent as hex</p>
<h3 class="function"><a name="decode_base64-1">decode_base64/1</a></h3>
<div class="spec">
<p><tt>decode_base64(List::In) -&gt; Out | <a href="#type-exit">exit</a>({error, invalid_input})</tt>
<ul class="definitions"><li><tt>In = string() | binary()</tt></li><li><tt>Out = string() | binary()</tt></li></ul></p>
</div><p>Implements the base64 decoding algorithm. The output data type matches in the input data type.</p>
<h3><a name="decode_base64-1">decode_base64/1</a></h3>
<p><tt>decode_base64(List::In) -&gt; Out | <a href="#type-exit">exit({error, invalid_input})</a></tt>
<ulpan>><li><tt>In = string() | binary()</tt></li><li><tt>Out = string() | binary()</tt></li></ul></p>
<p>Implements the base64 decoding algorithm. The output data type matches in the input data type.</p>
<h3 class="function"><a name="decode_rfc822_date-1">decode_rfc822_date/1</a></h3>
<div class="spec">
<p><tt>decode_rfc822_date(String) -&gt; any()</tt></p>
</div>
<h3><a name="decode_rfc822_date-1">decode_rfc822_date/1</a></h3>
<tt>decode_rfc822_date(String) -&gt; term()
</tt>
<h3 class="function"><a name="do_trace-2">do_trace/2</a></h3>
<div class="spec">
<p><tt>do_trace(Fmt, Args) -&gt; any()</tt></p>
</div>
<h3><a name="drv_ue-1">drv_ue/1</a></h3>
<tt>drv_ue(Str) -&gt; term()
</tt>
<h3 class="function"><a name="do_trace-3">do_trace/3</a></h3>
<div class="spec">
<p><tt>do_trace(X1, Fmt, Args) -&gt; any()</tt></p>
</div>
<h3><a name="drv_ue-2">drv_ue/2</a></h3>
<tt>drv_ue(Str, Port) -&gt; term()
</tt>
<h3 class="function"><a name="do_trace-3">do_trace/3</a></h3>
<div class="spec">
<p><tt>do_trace(X1, Fmt, Args) -&gt; any()</tt></p>
</div>
<h3><a name="encode_base64-1">encode_base64/1</a></h3>
<h3 class="function"><a name="encode_base64-1">encode_base64/1</a></h3>
<div class="spec">
<p><tt>encode_base64(List::In) -&gt; Out</tt>
<ul><li><tt>In = string() | binary()</tt></li><li><tt>Out = string() | binary()</tt></li></ul></p>
<p>Implements the base64 encoding algorithm. The output data type matches in the input data type.</p>
<ul class="definitions"><li><tt>In = string() | binary()</tt></li><li><tt>Out = string() | binary()</tt></li></ul></p>
</div><p>Implements the base64 encoding algorithm. The output data type matches in the input data type.</p>
<h3 class="function"><a name="get_trace_status-2">get_trace_status/2</a></h3>
<div class="spec">
<p><tt>get_trace_status(Host, Port) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="get_value-2">get_value/2</a></h3>
<div class="spec">
<p><tt>get_value(Tag, TVL) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="get_value-3">get_value/3</a></h3>
<div class="spec">
<p><tt>get_value(Tag, TVL, DefVal) -&gt; any()</tt></p>
</div>
<h3><a name="status_code-1">status_code/1</a></h3>
<h3 class="function"><a name="parse_url-1">parse_url/1</a></h3>
<div class="spec">
<p><tt>parse_url(Url) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="printable_date-0">printable_date/0</a></h3>
<div class="spec">
<p><tt>printable_date() -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="printable_date-1">printable_date/1</a></h3>
<div class="spec">
<p><tt>printable_date(Now) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="status_code-1">status_code/1</a></h3>
<div class="spec">
<p><tt>status_code(StatusCode::<a href="#type-status_code">status_code()</a>) -&gt; StatusDescription</tt>
<ul><li><tt><a name="type-status_code">status_code()</a> = string() | integer()</tt></li><li><tt>StatusDescription = atom()</tt></li></ul></p>
<p>Given a status code, returns an atom describing the status code.</p>
<ul class="definitions"><li><tt><a name="type-status_code">status_code()</a> = string() | integer()</tt></li><li><tt>StatusDescription = atom()</tt></li></ul></p>
</div><p>Given a status code, returns an atom describing the status code.</p>
<h3><a name="url_encode-1">url_encode/1</a></h3>
<h3 class="function"><a name="url_encode-1">url_encode/1</a></h3>
<div class="spec">
<p><tt>url_encode(Str) -&gt; UrlEncodedStr</tt>
<ul><li><tt>Str = string()</tt></li><li><tt>UrlEncodedStr = string()</tt></li></ul></p>
<p>URL-encodes a string based on RFC 1738. Returns a flat list.</p>
<ul class="definitions"><li><tt>Str = string()</tt></li><li><tt>UrlEncodedStr = string()</tt></li></ul></p>
</div><p>URL-encodes a string based on RFC 1738. Returns a flat list.</p>
<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, Nov 6 2015, 11:40:24.</i></p>
</body>
</html>

+ 1
- 0
rebar.lock Visa fil

@ -0,0 +1 @@
[].

Laddar…
Avbryt
Spara