Module ibrowse

Description

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 acts as a load balancer. There is one process to handle one TCP connection to a webserver (implemented in the module ibrowse_http_client). Multiple connections to a webserver are setup based on the settings for each webserver. The ibrowse process also determines which connection to pipeline a certain request on. The functions to call are send_req/3, send_req/4, send_req/5, send_req/6.

Here are a few sample invocations.

ibrowse:send_req("http://intranet/messenger/", [], get).

ibrowse:send_req("http://www.google.com/", [], get, [], [{proxy_user, "XXXXX"}, {proxy_password, "XXXXX"}, {proxy_host, "proxy"}, {proxy_port, 8080}], 1000).

ibrowse:send_req("http://www.erlang.org/download/otp_src_R10B-3.tar.gz", [], get, [], [{proxy_user, "XXXXX"}, {proxy_password, "XXXXX"}, {proxy_host, "proxy"}, {proxy_port, 8080}, {save_response_to_file, true}], 1000).

ibrowse:set_dest("www.hotmail.com", 80, [{max_sessions, 10}, {max_pipeline_size, 1}]).

ibrowse:send_req("http://www.erlang.org", [], head).

ibrowse:send_req("http://www.sun.com", [], options).

ibrowse:send_req("http://www.bbc.co.uk", [], trace).

ibrowse:send_req("http://www.google.com", [], get, [], [{stream_to, self()}]).

A driver exists which implements URL encoding in C, but the speed achieved using only erlang has been good enough, so the driver isn't actually used.

Function Index

Exported Functions
code_change/3
finished_async_request/0Internal export.
handle_call/3
handle_cast/2
handle_info/2
init/1
reply/2Internal export.
send_req/3This is the basic function to send a HTTP request.
send_req/4Same as send_req/3.
send_req/5Same as send_req/4.
send_req/6Same as send_req/5.
set_dest/3Sets options for a destination.
shutting_down/0Internal export.
start/0
start_link/0
stop/0
terminate/2
trace_off/0Turn tracing off for the ibrowse process.
trace_off/2Turn tracing OFF for all connections to the specified HTTP server.
trace_on/0Turn tracing on for the ibrowse process.
trace_on/2Turn tracing on for all connections to the specified HTTP server.

Exported Functions

code_change/3

code_change(Arg1, Arg2, Arg3) -> term()

finished_async_request/0

finished_async_request() -> term()

Internal export. Called by a HTTP connection process to indicate to the load balancing process (ibrowse) that an asynchronous request has finished processing.

handle_call/3

handle_call(Arg1, Arg2, Arg3) -> term()

handle_cast/2

handle_cast(Arg1, Arg2) -> term()

handle_info/2

handle_info(Arg1, Arg2) -> term()

init/1

init(Arg1) -> term()

reply/2

reply(Arg1, Arg2) -> term()

Internal export. Called by a HTTP connection process to indicate to the load balancing process (ibrowse) that a synchronous request has finished processing.

send_req/3

send_req(Url::string(), Headers::headerList(), Method::method()) -> response()

This is the basic function to send a HTTP request. The Status return value indicates the HTTP status code returned by the webserver

send_req/4

send_req(Url, Headers, Method::method(), Body::body()) -> response()

Same as send_req/3. If a list is specified for the body it has to be a flat list.

send_req/5

send_req(Url::string(), Headers::headerList(), Method::method(), Body::body(), Options::optionList()) -> response()

Same as send_req/4. For a description of SSL Options, look in the ssl manpage. If the HTTP Version to use is not specified, the default is 1.1

send_req/6

send_req(Url, Headers::headerList(), Method::method(), Body::body(), Options::optionList(), Timeout) -> response()

Same as send_req/5. All timeout values are in milliseconds.

set_dest/3

set_dest(Host::string(), Port::integer(), Opts::opt_list()) -> ok

Sets options for a destination. If the options have not been set in the ibrowse.conf file, it can be set using this function before sending the first request to the destination. If not, defaults will be used. Entries in ibrowse.conf look like this.
{dest, Host, Port, MaxSess, MaxPipe, Options}.
where
Host = string(). "www.erlang.org" | "193.180.168.23"
Port = integer()
MaxSess = integer()
MaxPipe = integer()
Options = optionList() -- see options in send_req/5

shutting_down/0

shutting_down() -> term()

Internal export. Called by a HTTP connection process to indicate to ibrowse that it is shutting down and further requests should not be sent it's way.

start/0

start() -> term()

start_link/0

start_link() -> term()

stop/0

stop() -> term()

terminate/2

terminate(Arg1, Arg2) -> term()

trace_off/0

trace_off() -> term()

Turn tracing off for the ibrowse process

trace_off/2

trace_off(Host, Port) -> term()

Turn tracing OFF for all connections to the specified HTTP server.

trace_on/0

trace_on() -> term()

Turn tracing on for the ibrowse process

trace_on/2

trace_on(Host, Port) -> term()

Turn tracing on for all connections to the specified HTTP server. Host is whatever is specified as the domain name in the URL