From b3814c981cb600211f0b1b0e133c4dbffc8299bc Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Sat, 22 Oct 2016 10:12:50 +0200 Subject: [PATCH] regen documentation --- README.md | 16 +- doc/README.md | 11 +- doc/edoc-info | 8 +- doc/hackney.md | 4 +- doc/hackney_connect.md | 8 +- doc/hackney_dummy_metrics.md | 75 --------- doc/hackney_exometer_metrics.md | 96 ------------ doc/hackney_folsom_metrics.md | 96 ------------ doc/hackney_local_tcp.md | 148 ++++++++++++++++++ ...ackney_ssl_transport.md => hackney_ssl.md} | 0 ...ackney_tcp_transport.md => hackney_tcp.md} | 0 doc/hackney_util.md | 14 +- 12 files changed, 191 insertions(+), 285 deletions(-) delete mode 100644 doc/hackney_dummy_metrics.md delete mode 100644 doc/hackney_exometer_metrics.md delete mode 100644 doc/hackney_folsom_metrics.md create mode 100644 doc/hackney_local_tcp.md rename doc/{hackney_ssl_transport.md => hackney_ssl.md} (100%) rename doc/{hackney_tcp_transport.md => hackney_tcp.md} (100%) diff --git a/README.md b/README.md index 14af9890..5e16fe3e 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ Copyright (c) 2012-2016 Benoît Chesneau. -__Version:__ 1.6.1 +__Version:__ 1.6.2 # hackney **hackney** is an HTTP client library for Erlang. -[![Build Status](https://secure.travis-ci.org/benoitc/hackney.svg?branch=master)](https://travis-ci.org/benoitc/hackney) +[![Build Status](https://travis-ci.org/benoitc/hackney.png?branch=master)](https://travis-ci.org/benoitc/hackney) [![Hex pm](http://img.shields.io/hexpm/v/hackney.svg?style=flat)](https://hex.pm/packages/hackney) ## Main features: @@ -172,6 +172,8 @@ read_body(MaxLength, Ref, Acc) when MaxLength > byte_size(Acc) -> > Note: you can also fetch a multipart response using the functions > `hackney:stream_multipart/1` and `hackney:skip_multipart/1`. +> Note 2: using the `with_body` option will return the body directy instead of a reference. + ### Reuse a connection By default all connections are created and closed dynamically by @@ -214,7 +216,7 @@ NextReq = {NextMethod, NextPath, ReqHeaders, ReqBody} Here we are posting a JSON payload to '/' on the friendpaste service to create a paste. Then we close the client connection. -> If your connection supports keepalive the connection will be simply : +> If your connection supports keepalive the connection will be kept open until you close it exclusively. ### Send a body @@ -222,7 +224,7 @@ hackney helps you send different payloads by passing different terms as the request body: - `{form, PropList}` : To send a form -- `{multipart, Parts}` : to send you body using the multipart API. Parts +- `{multipart, Parts}` : to send your body using the multipart API. Parts follow this format: - `eof`: end the multipart request - `{file, Path}`: to stream a file @@ -316,7 +318,7 @@ LoopFun(LoopFun, ClientRef). > synchronously using the function `hackney:stop_async/1` See the > example [test_async_once2](https://github.com/benoitc/hackney/blob/master/examples/test_async_once2.erl) for the usage. -> **Note 4**: When the option `{following_redirect, true}` is passed to +> **Note 4**: When the option `{follow_redirect, true}` is passed to > the request, you will receive the folllowing messages on valid > redirection: > - `{redirect, To, Headers}` @@ -508,7 +510,7 @@ $ pip install gunicorn httpbin Running the tests: ``` -$ gunicorn -b 127.0.0.1:8000 -b unix:httpbin.sock --daemon --pid httpbin.pid httpbin:appl +$ gunicorn --daemon --pid httpbin.pid httpbin:app $ make test $ kill `cat httpbin.pid` ``` @@ -527,6 +529,7 @@ $ kill `cat httpbin.pid` hackney_headers hackney_http hackney_http_connect +hackney_local_tcp hackney_manager hackney_multipart hackney_pool @@ -541,3 +544,4 @@ $ kill `cat httpbin.pid` hackney_trace hackney_url hackney_util + diff --git a/doc/README.md b/doc/README.md index 6a462af0..f4929176 100644 --- a/doc/README.md +++ b/doc/README.md @@ -4,7 +4,7 @@ Copyright (c) 2012-2016 Benoît Chesneau. -__Version:__ 1.6.1 +__Version:__ 1.6.2 # hackney @@ -172,6 +172,8 @@ read_body(MaxLength, Ref, Acc) when MaxLength > byte_size(Acc) -> > Note: you can also fetch a multipart response using the functions > `hackney:stream_multipart/1` and `hackney:skip_multipart/1`. +> Note 2: using the `with_body` option will return the body directy instead of a reference. + ### Reuse a connection By default all connections are created and closed dynamically by @@ -214,7 +216,7 @@ NextReq = {NextMethod, NextPath, ReqHeaders, ReqBody} Here we are posting a JSON payload to '/' on the friendpaste service to create a paste. Then we close the client connection. -> If your connection supports keepalive the connection will be simply : +> If your connection supports keepalive the connection will be kept open until you close it exclusively. ### Send a body @@ -222,7 +224,7 @@ hackney helps you send different payloads by passing different terms as the request body: - `{form, PropList}` : To send a form -- `{multipart, Parts}` : to send you body using the multipart API. Parts +- `{multipart, Parts}` : to send your body using the multipart API. Parts follow this format: - `eof`: end the multipart request - `{file, Path}`: to stream a file @@ -316,7 +318,7 @@ LoopFun(LoopFun, ClientRef). > synchronously using the function `hackney:stop_async/1` See the > example [test_async_once2](https://github.com/benoitc/hackney/blob/master/examples/test_async_once2.erl) for the usage. -> **Note 4**: When the option `{following_redirect, true}` is passed to +> **Note 4**: When the option `{follow_redirect, true}` is passed to > the request, you will receive the folllowing messages on valid > redirection: > - `{redirect, To, Headers}` @@ -527,6 +529,7 @@ $ kill `cat httpbin.pid` hackney_headers hackney_http hackney_http_connect +hackney_local_tcp hackney_manager hackney_multipart hackney_pool diff --git a/doc/edoc-info b/doc/edoc-info index cc81fe69..e612b9e6 100644 --- a/doc/edoc-info +++ b/doc/edoc-info @@ -2,7 +2,7 @@ {application,hackney}. {modules,[hackney,hackney_app,hackney_bstr,hackney_connect,hackney_cookie, hackney_date,hackney_headers,hackney_http,hackney_http_connect, - hackney_manager,hackney_multipart,hackney_pool,hackney_pool_handler, - hackney_request,hackney_response,hackney_socks5, - hackney_ssl,hackney_stream,hackney_sup, - hackney_tcp,hackney_trace,hackney_url,hackney_util]}. + hackney_local_tcp,hackney_manager,hackney_multipart,hackney_pool, + hackney_pool_handler,hackney_request,hackney_response, + hackney_socks5,hackney_ssl,hackney_stream,hackney_sup,hackney_tcp, + hackney_trace,hackney_url,hackney_util]}. diff --git a/doc/hackney.md b/doc/hackney.md index 102927ae..9952456a 100644 --- a/doc/hackney.md +++ b/doc/hackney.md @@ -83,7 +83,7 @@ options to it.setopts/2< ### body/1 ###

-body(Ref::client_ref()) -> {ok, binary()} | {error, atom()}
+body(Ref::client_ref()) -> {ok, binary()} | {error, atom()} | {error, {closed, binary()}}
 

@@ -94,7 +94,7 @@ Return the full body sent with the response. ### body/2 ###

-body(Ref::client_ref(), MaxLength::non_neg_integer() | infinity) -> {ok, binary()} | {error, atom()}
+body(Ref::client_ref(), MaxLength::non_neg_integer() | infinity) -> {ok, binary()} | {error, atom()} | {error, {closed, binary()}}
 

diff --git a/doc/hackney_connect.md b/doc/hackney_connect.md index 96df8eb5..11f24950 100644 --- a/doc/hackney_connect.md +++ b/doc/hackney_connect.md @@ -9,7 +9,7 @@ ## Function Index ## -
check_or_close/1
close/1close the client.
connect/3
connect/4
connect/5
create_connection/4create a connection and return a client state.
create_connection/5
is_pool/1get current pool pid or name used by a client if needed.
maybe_connect/1connect a socket and create a client state.
reconnect/4
set_sockopts/2add set sockets options in the client.
ssl_opts/2
+
check_or_close/1
close/1close the client.
connect/3
connect/4
connect/5
create_connection/4create a connection and return a client state.
create_connection/5
is_pool/1get current pool pid or name used by a client if needed.
maybe_connect/1connect a socket and create a client state.
partial_chain/1
reconnect/4
set_sockopts/2add set sockets options in the client.
ssl_opts/2
@@ -78,6 +78,12 @@ get current pool pid or name used by a client if needed connect a socket and create a client state. + + +### partial_chain/1 ### + +`partial_chain(Certs) -> any()` + ### reconnect/4 ### diff --git a/doc/hackney_dummy_metrics.md b/doc/hackney_dummy_metrics.md deleted file mode 100644 index 391ff6d5..00000000 --- a/doc/hackney_dummy_metrics.md +++ /dev/null @@ -1,75 +0,0 @@ - - -# Module hackney_dummy_metrics # -* [Description](#description) -* [Function Index](#index) -* [Function Details](#functions) - -dummy metric module. - - - -## Function Index ## - - -
decrement_counter/1
decrement_counter/2
delete/1
increment_counter/1
increment_counter/2
new/2
update_gauge/2
update_histogram/2
update_meter/2
- - - - -## Function Details ## - - - -### decrement_counter/1 ### - -`decrement_counter(X1) -> any()` - - - -### decrement_counter/2 ### - -`decrement_counter(X1, X2) -> any()` - - - -### delete/1 ### - -`delete(X1) -> any()` - - - -### increment_counter/1 ### - -`increment_counter(X1) -> any()` - - - -### increment_counter/2 ### - -`increment_counter(X1, X2) -> any()` - - - -### new/2 ### - -`new(X1, X2) -> any()` - - - -### update_gauge/2 ### - -`update_gauge(X1, X2) -> any()` - - - -### update_histogram/2 ### - -`update_histogram(X1, Fun) -> any()` - - - -### update_meter/2 ### - -`update_meter(X1, X2) -> any()` - diff --git a/doc/hackney_exometer_metrics.md b/doc/hackney_exometer_metrics.md deleted file mode 100644 index 79c6ed92..00000000 --- a/doc/hackney_exometer_metrics.md +++ /dev/null @@ -1,96 +0,0 @@ - - -# Module hackney_exometer_metrics # -* [Function Index](#index) -* [Function Details](#functions) - - - -## Function Index ## - - -
decrement_counter/1
decrement_counter/2
delete/1
increment_counter/1
increment_counter/2
new/2
update_gauge/2
update_histogram/2
update_meter/2
- - - - -## Function Details ## - - - -### decrement_counter/1 ### - -

-decrement_counter(Name::any()) -> ok | {error, term()}
-
-
- - - -### decrement_counter/2 ### - -

-decrement_counter(Name::any(), Value::pos_integer()) -> ok | {error, term()}
-
-
- - - -### delete/1 ### - -`delete(Name) -> any()` - - - -### increment_counter/1 ### - -

-increment_counter(Name::any()) -> ok | {error, term()}
-
-
- - - -### increment_counter/2 ### - -

-increment_counter(Name::any(), Value::pos_integer()) -> ok | {error, term()}
-
-
- - - -### new/2 ### - -

-new(X1::atom(), Name::any()) -> ok | {error, metric_exists | unsupported_type}
-
-
- - - -### update_gauge/2 ### - -

-update_gauge(Name::any(), Value::number()) -> ok | {error, term()}
-
-
- - - -### update_histogram/2 ### - -

-update_histogram(Name::any(), Fun::number()) -> ok | {error, term()}
-
-
- - - -### update_meter/2 ### - -

-update_meter(Name::any(), Value::number()) -> ok | {error, term()}
-
-
- diff --git a/doc/hackney_folsom_metrics.md b/doc/hackney_folsom_metrics.md deleted file mode 100644 index 56bfd779..00000000 --- a/doc/hackney_folsom_metrics.md +++ /dev/null @@ -1,96 +0,0 @@ - - -# Module hackney_folsom_metrics # -* [Function Index](#index) -* [Function Details](#functions) - - - -## Function Index ## - - -
decrement_counter/1
decrement_counter/2
delete/1
increment_counter/1
increment_counter/2
new/2
update_gauge/2
update_histogram/2
update_meter/2
- - - - -## Function Details ## - - - -### decrement_counter/1 ### - -

-decrement_counter(Name::any()) -> ok | {error, term()}
-
-
- - - -### decrement_counter/2 ### - -

-decrement_counter(Name::any(), Value::pos_integer()) -> ok | {error, term()}
-
-
- - - -### delete/1 ### - -`delete(Name) -> any()` - - - -### increment_counter/1 ### - -

-increment_counter(Name::any()) -> ok | {error, term()}
-
-
- - - -### increment_counter/2 ### - -

-increment_counter(Name::any(), Value::pos_integer()) -> ok | {error, term()}
-
-
- - - -### new/2 ### - -

-new(X1::atom(), Name::any()) -> ok | {error, term()}
-
-
- - - -### update_gauge/2 ### - -

-update_gauge(Name::any(), Value::number()) -> ok | {error, term()}
-
-
- - - -### update_histogram/2 ### - -

-update_histogram(Name::any(), Fun::number()) -> ok | {error, term()}
-
-
- - - -### update_meter/2 ### - -

-update_meter(Name::any(), Value::number()) -> ok | {error, term()}
-
-
- diff --git a/doc/hackney_local_tcp.md b/doc/hackney_local_tcp.md new file mode 100644 index 00000000..75abec07 --- /dev/null +++ b/doc/hackney_local_tcp.md @@ -0,0 +1,148 @@ + + +# Module hackney_local_tcp # +* [Function Index](#index) +* [Function Details](#functions) + + + +## Function Index ## + + +
close/1Close a TCP socket.
connect/3
connect/4
controlling_process/2Assign a new controlling process Pid to Socket.
messages/1Atoms used to identify messages in {active, once | true} mode.
peername/1Return the address and port for the other end of a connection.
recv/2
recv/3Receive a packet from a socket in passive mode.
send/2Send a packet on a socket.
setopts/2Set one or more options for a socket.
shutdown/2Immediately close a socket in one or two directions.
sockname/1Get the local address and port of a socket.
+ + + + +## Function Details ## + + + +### close/1 ### + +

+close(Socket::inet:socket()) -> ok
+
+
+ +Close a TCP socket. + +__See also:__ [gen_tcp:close/1](gen_tcp.md#close-1). + + + +### connect/3 ### + +`connect(Host, Port, Opts) -> any()` + + + +### connect/4 ### + +`connect(Host, Port, Opts, Timeout) -> any()` + + + +### controlling_process/2 ### + +

+controlling_process(Socket::inet:socket(), Pid::pid()) -> ok | {error, closed | not_owner | atom()}
+
+
+ +Assign a new controlling process _Pid_ to _Socket_. + +__See also:__ [gen_tcp:controlling_process/2](gen_tcp.md#controlling_process-2). + + + +### messages/1 ### + +`messages(X1) -> any()` + +Atoms used to identify messages in {active, once | true} mode. + + + +### peername/1 ### + +

+peername(Socket::inet:socket()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}
+
+
+ +Return the address and port for the other end of a connection. + +__See also:__ [inet:peername/1](inet.md#peername-1). + + + +### recv/2 ### + +`recv(Socket, Length) -> any()` + + + +### recv/3 ### + +

+recv(Socket::inet:socket(), Length::non_neg_integer(), Timeout::timeout()) -> {ok, any()} | {error, closed | atom()}
+
+
+ +Receive a packet from a socket in passive mode. + +__See also:__ [gen_tcp:recv/3](gen_tcp.md#recv-3). + + + +### send/2 ### + +

+send(Socket::inet:socket(), Packet::iolist()) -> ok | {error, atom()}
+
+
+ +Send a packet on a socket. + +__See also:__ [gen_tcp:send/2](gen_tcp.md#send-2). + + + +### setopts/2 ### + +

+setopts(Socket::inet:socket(), Opts::list()) -> ok | {error, atom()}
+
+
+ +Set one or more options for a socket. + +__See also:__ [inet:setopts/2](inet.md#setopts-2). + + + +### shutdown/2 ### + +

+shutdown(Socket::inet:socket(), How::read | write | read_write) -> ok
+
+
+ +Immediately close a socket in one or two directions. + +__See also:__ [gen_tcp:shutdown/2](gen_tcp.md#shutdown-2). + + + +### sockname/1 ### + +

+sockname(Socket::inet:socket()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}
+
+
+ +Get the local address and port of a socket + +__See also:__ [inet:sockname/1](inet.md#sockname-1). + diff --git a/doc/hackney_ssl_transport.md b/doc/hackney_ssl.md similarity index 100% rename from doc/hackney_ssl_transport.md rename to doc/hackney_ssl.md diff --git a/doc/hackney_tcp_transport.md b/doc/hackney_tcp.md similarity index 100% rename from doc/hackney_tcp_transport.md rename to doc/hackney_tcp.md diff --git a/doc/hackney_util.md b/doc/hackney_util.md index 0c92d417..537c3792 100644 --- a/doc/hackney_util.md +++ b/doc/hackney_util.md @@ -9,7 +9,7 @@ ## Function Index ## -
filter_options/3filter a proplists and only keep allowed keys.
is_ipv6/1
maybe_apply_defaults/2
mod_metrics/0
privdir/0
require/1Start the given applications if they were not already started.
set_option_default/3set the default options in a proplists if not defined.
to_atom/1
+
filter_options/3filter a proplists and only keep allowed keys.
is_ipv6/1
maybe_apply_defaults/2
merge_opts/2
mod_metrics/0
privdir/0
require/1Start the given applications if they were not already started.
set_option_default/3set the default options in a proplists if not defined.
to_atom/1
uniform/1
@@ -40,6 +40,12 @@ filter a proplists and only keep allowed keys `maybe_apply_defaults(Rest, Options) -> any()` + + +### merge_opts/2 ### + +`merge_opts(Rest, Options) -> any()` + ### mod_metrics/0 ### @@ -81,3 +87,9 @@ set the default options in a proplists if not defined `to_atom(V) -> any()` + + +### uniform/1 ### + +`uniform(N) -> any()` +