cmullaparthi / ibrowse

Erlang HTTP client

Home | Edit | New

ibrowse API

Module ibrowse

Module ibrowse

The ibrowse application implements an HTTP 1.1 client.

Copyright © 2005-2009 Chandrashekhar Mullaparthi

Version: 1.5.5

Behaviours: gen_server.

Authors: Chandrashekhar Mullaparthi (chandrashekhar dot mullaparthi at gmail dot com).

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 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
(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: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

all_trace_off/0Turn Off ALL tracing.
code_change/3
get_config_value/1Internal export.
get_config_value/2Internal export.
handle_call/3
handle_cast/2
handle_info/2
init/1
rescan_config/0Clear current configuration for ibrowse and load from the file
ibrowse.conf in the IBROWSE_EBIN/../priv directory.
rescan_config/1
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.
send_req_direct/4Same as send_req/3 except that the first argument is the PID
returned by spawn_worker_process/2 or spawn_link_worker_process/2.
send_req_direct/5Same as send_req/4 except that the first argument is the PID
returned by spawn_worker_process/2 or spawn_link_worker_process/2.
send_req_direct/6Same as send_req/5 except that the first argument is the PID
returned by spawn_worker_process/2 or spawn_link_worker_process/2.
send_req_direct/7Same as send_req/6 except that the first argument is the PID
returned by spawn_worker_process/2 or spawn_link_worker_process/2.
set_dest/3Deprecated.
set_max_pipeline_size/3Set the maximum pipeline size for each connection to a specific Host:Port.
set_max_sessions/3Set the maximum number of connections allowed to a specific Host:Port.
show_dest_status/2Shows some internal information about load balancing to a
specified Host:Port.
spawn_link_worker_process/2Same as spawn_worker_process/2 except the the calling process
is linked to the worker process which is spawned.
spawn_worker_process/2Creates a HTTP client process to the specified Host:Port which
is not part of the load balancing pool.
start/0Starts the ibrowse process without linking.
start_link/0Starts the ibrowse process linked to the calling process.
stop/0Stop the ibrowse process.
stop_worker_process/1Terminate a worker process spawned using
spawn_worker_process/2 or spawn_link_worker_process/2.
stream_next/1Tell ibrowse to stream the next chunk of data to the
caller.
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.

Function Details

all_trace_off/0

all_trace_off() -> ok

Turn Off ALL tracing

code_change/3

code_change(OldVsn, State, Extra) -> any()

get_config_value/1

get_config_value(Key) -> any()

Internal export

get_config_value/2

get_config_value(Key, DefVal) -> any()

Internal export

handle_call/3

handle_call(Request, From, State) -> any()

handle_cast/2

handle_cast(Msg, State) -> any()

handle_info/2

handle_info(Info, State) -> any()

init/1

init(X1) -> any()

rescan_config/0

rescan_config() -> any()

Clear current configuration for ibrowse and load from the file
ibrowse.conf in the IBROWSE_EBIN/../priv directory. Current
configuration is cleared only if the ibrowse.conf file is readable
using file:consult/1

rescan_config/1

rescan_config(File) -> any()

send_req/3

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

Last edited by cmullaparthi, Sun Oct 04 13:52:02 -0700 2009
Home | Edit | New
Versions: