diff --git a/.gitignore b/.gitignore index 1491146..3f362b6 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Makefile b/Makefile index 4df166b..918f33b 100644 --- a/Makefile +++ b/Makefile @@ -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 \ No newline at end of file diff --git a/doc/ibrowse.html b/doc/ibrowse.html index 1594d74..e7c5afd 100644 --- a/doc/ibrowse.html +++ b/doc/ibrowse.html @@ -1,6 +1,7 @@ + Module ibrowse @@ -10,9 +11,8 @@

Module ibrowse

The ibrowse application implements an HTTP 1.1 client in erlang. -

Copyright © 2005-2010 Chandrashekhar Mullaparthi

+

Copyright © 2005-2014 Chandrashekhar Mullaparthi

-

Version: 2.1.2

Behaviours: gen_server.

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

@@ -61,10 +61,13 @@ send_req/4, send_req/5, send_req/6.

Function Index

- +
all_trace_off/0Turn Off ALL tracing.
+ + + @@ -85,19 +88,19 @@ send_req/4, send_req/5, send_req/6.

+ + - + - + @@ -118,9 +121,14 @@ send_req/4, send_req/5, send_req/6.

Function Details

+

add_config/1

+
+

add_config(Terms) -> any()

+

Add additional configuration elements at runtime.

+

all_trace_off/0

-

all_trace_off() -> ok

+

all_trace_off() -> ok

Turn Off ALL tracing

code_change/3

@@ -138,6 +146,16 @@ send_req/4, send_req/5, send_req/6.

get_config_value(Key, DefVal) -> any()

Internal export

+

get_metrics/0

+
+

get_metrics() -> any()

+
+ +

get_metrics/2

+
+

get_metrics(Host, Port) -> any()

+
+

handle_call/3

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

@@ -168,35 +186,20 @@ send_req/4, send_req/5, send_req/6.

rescan_config/1

-

rescan_config(File) -> any()

+

rescan_config(Terms) -> any()

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. The body can also be a fun/0 or a fun/1.
If fun/0, the connection handling process will repeatdely call the fun until it returns an error or eof.

Fun() = {ok, Data} | eof

@@ -205,106 +208,13 @@ send_req/4, send_req/5, send_req/6.

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. -
-

-

+

+

Same as send_req/4.

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.

@@ -338,14 +248,19 @@ data has been received on the link for a certain time interval.

Deprecated. Use set_max_sessions/3 and set_max_pipeline_size/3 for achieving the same effect.

+

set_max_attempts/3

+
+

set_max_attempts(Host::string(), Port::integer(), Max::integer()) -> ok

+

Set the maximum attempts for each connection to a specific Host:Port.

+

set_max_pipeline_size/3

-

set_max_pipeline_size(Host::string(), Port::integer(), Max::integer()) -> ok

+

set_max_pipeline_size(Host::string(), Port::integer(), Max::integer()) -> ok

Set the maximum pipeline size for each connection to a specific Host:Port.

set_max_sessions/3

-

set_max_sessions(Host::string(), Port::integer(), Max::integer()) -> ok

+

set_max_sessions(Host::string(), Port::integer(), Max::integer()) -> ok

Set the maximum number of connections allowed to a specific Host:Port.

show_dest_status/0

@@ -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.

+

show_dest_status/1

+
+

show_dest_status(Url) -> any()

+
+

show_dest_status/2

show_dest_status(Host, Port) -> any()

@@ -365,19 +285,18 @@ data has been received on the link for a certain time interval.

spawn_link_worker_process/1

-

spawn_link_worker_process(Url::string()) -> {ok, pid()}

+

spawn_link_worker_process(Url::string() | {Host::string(), Port::integer()}) -> {ok, pid()}

Same as spawn_worker_process/1 except the the calling process is linked to the worker process which is spawned.

spawn_link_worker_process/2

-

spawn_link_worker_process(Host::string(), Port::integer()) -> {ok, pid()}

-

Same as spawn_worker_process/2 except the the calling process - is linked to the worker process which is spawned.

+

spawn_link_worker_process(Host::string(), Port::integer()) -> {ok, pid()}

+

Same as spawn_link_worker_process/1 except with Erlang process options.

spawn_worker_process/1

-

spawn_worker_process(Url::string()) -> {ok, pid()}

+

spawn_worker_process(Url::string() | {Host::string(), Port::integer()}) -> {ok, pid()}

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.
Note: It is the responsibility of the calling process to control - pipeline size on such connections. -

+ pipeline size on such connections.

spawn_worker_process/2

-

spawn_worker_process(Host::string(), Port::integer()) -> {ok, pid()}

-

Same as spawn_worker_process/1 but takes as input a Host and Port - instead of a URL.

+

spawn_worker_process(Host::string(), Port::integer()) -> {ok, pid()}

+

Same as spawn_worker_process/1 except with Erlang process options.

start/0

@@ -404,7 +321,7 @@ data has been received on the link for a certain time interval.

start_link/0

-

start_link() -> {ok, pid()}

+

start_link() -> {ok, pid()}

Starts the ibrowse process linked to the calling process. Usually invoked by the supervisor ibrowse_sup

stop/0

@@ -414,14 +331,14 @@ data has been received on the link for a certain time interval.

stop_worker_process/1

-

stop_worker_process(Conn_pid::pid()) -> ok

+

stop_worker_process(Conn_pid::pid()) -> ok

Terminate a worker process spawned using spawn_worker_process/2 or spawn_link_worker_process/2. Requests in progress will get the error response

{error, closing_on_request}

stream_close/1

-

stream_close(Req_id::req_id()) -> ok | {error, unknown_req_id}

+

stream_close(Req_id::req_id()) -> ok | {error, unknown_req_id}

Tell ibrowse to close the connection associated with the specified stream. Should be used in conjunction with the stream_to option. Note that all requests in progress on @@ -430,7 +347,7 @@ data has been received on the link for a certain time interval.

stream_next/1

-

stream_next(Req_id::req_id()) -> ok | {error, unknown_req_id}

+

stream_next(Req_id::req_id()) -> ok | {error, unknown_req_id}

Tell ibrowse to stream the next chunk of data to the caller. Should be used in conjunction with the stream_to option

@@ -447,7 +364,7 @@ data has been received on the link for a certain time interval.

trace_off/2

-

trace_off(Host, Port) -> ok

+

trace_off(Host, Port) -> ok

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

@@ -459,14 +376,12 @@ data has been received on the link for a certain time interval.

trace_on/2

trace_on(Host, Port) -> ok -

+

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


add_config/1Add additional configuration elements at runtime.
all_trace_off/0Turn Off ALL tracing.
code_change/3
get_config_value/1Internal export.
get_config_value/2Internal export.
get_metrics/0
get_metrics/2
handle_call/3
handle_cast/2
handle_info/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_attempts/3Set the maximum attempts for each connection to a specific Host:Port.
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/0Shows some internal information about load balancing.
show_dest_status/1
show_dest_status/2Shows some internal information about load balancing to a specified Host:Port.
spawn_link_worker_process/1Same as spawn_worker_process/1 except the the calling process is linked to the worker process which is spawned.
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_link_worker_process/2Same as spawn_link_worker_process/1 except with Erlang process options.
spawn_worker_process/1Creates a HTTP client process to the specified Host:Port which is not part of the load balancing pool.
spawn_worker_process/2Same as spawn_worker_process/1 but takes as input a Host and Port - instead of a URL.
spawn_worker_process/2Same as spawn_worker_process/1 except with Erlang process options.
start/0Starts the ibrowse process without linking.
start_link/0Starts the ibrowse process linked to the calling process.
stop/0Stop the ibrowse process.
Overviewerlang logo
-

Generated by EDoc, Nov 10 2010, 06:04:33.

+

Generated by EDoc, Nov 6 2015, 11:40:24.

diff --git a/doc/ibrowse_lib.html b/doc/ibrowse_lib.html index 7a00d4f..4411692 100644 --- a/doc/ibrowse_lib.html +++ b/doc/ibrowse_lib.html @@ -1,67 +1,114 @@ + Module ibrowse_lib - + + +

Module ibrowse_lib

-Module with a few useful functions. - +Module with a few useful functions. +

Description

Module with a few useful functions

Function Index

- - - - - +
dec2hex/2dec2hex taken from gtk.erl in std dist - M = integer() -- number of hex digits required - N = integer() -- the number to represent as hex.
decode_base64/1Implements the base64 decoding algorithm.
decode_rfc822_date/1
drv_ue/1
drv_ue/2
+ + + + + + + + + +
decode_base64/1Implements the base64 decoding algorithm.
decode_rfc822_date/1
do_trace/2
do_trace/3
do_trace/3
encode_base64/1Implements the base64 encoding algorithm.
get_trace_status/2
get_value/2
get_value/3
parse_url/1
printable_date/0
printable_date/1
status_code/1Given a status code, returns an atom describing the status code.
url_encode/1URL-encodes a string based on RFC 1738.

Function Details

-

dec2hex/2

-

dec2hex(M::integer(), N::integer()) -> string()

-

dec2hex taken from gtk.erl in std dist - M = integer() -- number of hex digits required - N = integer() -- the number to represent as hex

+

decode_base64/1

+
+

decode_base64(List::In) -> Out | exit({error, invalid_input}) +

+

Implements the base64 decoding algorithm. The output data type matches in the input data type.

-

decode_base64/1

-

decode_base64(List::In) -> Out | exit({error, invalid_input}) -

-

Implements the base64 decoding algorithm. The output data type matches in the input data type.

+

decode_rfc822_date/1

+
+

decode_rfc822_date(String) -> any()

+
-

decode_rfc822_date/1

-decode_rfc822_date(String) -> term() - +

do_trace/2

+
+

do_trace(Fmt, Args) -> any()

+
-

drv_ue/1

-drv_ue(Str) -> term() - +

do_trace/3

+
+

do_trace(X1, Fmt, Args) -> any()

+
-

drv_ue/2

-drv_ue(Str, Port) -> term() - +

do_trace/3

+
+

do_trace(X1, Fmt, Args) -> any()

+
-

encode_base64/1

+

encode_base64/1

+

encode_base64(List::In) -> Out -

-

Implements the base64 encoding algorithm. The output data type matches in the input data type.

+

+

Implements the base64 encoding algorithm. The output data type matches in the input data type.

+ +

get_trace_status/2

+
+

get_trace_status(Host, Port) -> any()

+
+ +

get_value/2

+
+

get_value(Tag, TVL) -> any()

+
+ +

get_value/3

+
+

get_value(Tag, TVL, DefVal) -> any()

+
-

status_code/1

+

parse_url/1

+
+

parse_url(Url) -> any()

+
+ +

printable_date/0

+
+

printable_date() -> any()

+
+ +

printable_date/1

+
+

printable_date(Now) -> any()

+
+ +

status_code/1

+

status_code(StatusCode::status_code()) -> StatusDescription -

-

Given a status code, returns an atom describing the status code.

+

+

Given a status code, returns an atom describing the status code.

-

url_encode/1

+

url_encode/1

+

url_encode(Str) -> UrlEncodedStr -

-

URL-encodes a string based on RFC 1738. Returns a flat list.

+

+

URL-encodes a string based on RFC 1738. Returns a flat list.

+
+ + +

Generated by EDoc, Nov 6 2015, 11:40:24.

diff --git a/rebar.lock b/rebar.lock new file mode 100644 index 0000000..57afcca --- /dev/null +++ b/rebar.lock @@ -0,0 +1 @@ +[].