diff --git a/.gitignore b/.gitignore index 96fbebd7..b10721ae 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ mime.types *.plt .rebar *_plt +rebar3.crashdump diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6612f007..00000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: erlang -otp_release: - # Not available on Travis CI: 19.1, 19.2 and 20.2 - - 19.0 - - 19.3 - - 20.0 - - 20.1.7 - - 20.3.8.22 - - 21.0.9 - - 21.1.4 - - 21.2.7 - - 21.3.8.1 - - 22.0.7 - - 22.1.8.1 - - 22.2.8 - - 22.3.4 - - 23.0.2 - -env: - - TEST=1 - -before_script: - - kerl list installations - - "gunicorn -b 127.0.0.1:8000 -b unix:httpbin.sock httpbin:app&" - -before_install: - - sudo pip install -q httpbin - - sudo pip install -q gunicorn - -script: - - ./support/rebar3 xref - - ./support/rebar3 eunit - - ./support/rebar3 dialyzer - -cache: - directories: - - $HOME/.cache/rebar3 diff --git a/README.md b/README.md index aa117b9d..7c211043 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ __Version:__ 1.16.0 **hackney** is an HTTP client library for Erlang. -[![Build Status](https://github.com/benoitc/hackney/workflows/build/badge.svg)](https://github.com/benoitc/hackney) +[![Build Status](https://github.com/benoitc/hackney/workflows/build/badge.svg)](https://github.com/benoitc/hackney/actions?query=workflow%3Abuild) [![Hex pm](http://img.shields.io/hexpm/v/hackney.svg?style=flat)](https://hex.pm/packages/hackney) ## Main features: diff --git a/doc/README.md b/doc/README.md index a62da807..938cd614 100644 --- a/doc/README.md +++ b/doc/README.md @@ -10,7 +10,7 @@ __Version:__ 1.16.0 **hackney** is an HTTP client library for Erlang. -[![Build Status](https://travis-ci.org/benoitc/hackney.png?branch=master)](https://travis-ci.org/benoitc/hackney) +[![Build Status](https://github.com/benoitc/hackney/workflows/build/badge.svg)](https://github.com/benoitc/hackney/actions?query=workflow%3Abuild) [![Hex pm](http://img.shields.io/hexpm/v/hackney.svg?style=flat)](https://hex.pm/packages/hackney) ## Main features: diff --git a/doc/hackney.md b/doc/hackney.md index 019e9c95..ef853e59 100644 --- a/doc/hackney.md +++ b/doc/hackney.md @@ -64,7 +64,7 @@ fashion
  • {part, Name}: to start sending a part without length in a streaming fashion
  • {part, Name, ExtraHeader}: to start sending a part without -lengthin a streaming fashion
  • +length in a streaming fashion
  • {part_bin, Bin}: To send part of part
  • {part, eof}: To notify the end of the part
  • {mp_mixed, Name, MixedBoundary}: To notify we start a part with a a mixed @@ -487,7 +487,7 @@ fashion fashion * `{part, Name, ExtraHeader}`: to start sending a part without -lengthin a streaming fashion +length in a streaming fashion * `{part_bin, Bin}`: To send part of part @@ -531,18 +531,25 @@ setopts(Ref::client_ref(), Options::list()) -> set client options. Options are: -- `async`: to fetch the response asynchronously -- `{async, once}`: to receive the response asynchronously one time. + +* `async`: to fetch the response asynchronously + +* `{async, once}`: to receive the response asynchronously one time. To receive the next message use the function `hackney:stream_next/1`. -- `{stream_to, pid()}`: to set the pid where the messages of an + +* `{stream_to, pid()}`: to set the pid where the messages of an asynchronous response will be sent. -- `{follow_redirect, bool()}` : if true a redirection will be + +* `{follow_redirect, bool()}` : if true a redirection will be followed when the response is received synchronously -- `{force_redirect, bool()}` : if true a 301/302 redirection will be + +* `{force_redirect, bool()}` : if true a 301/302 redirection will be followed even on POST. -- `{max_redirect, integer()}` the maximum number of redirections that + +* `{max_redirect, integer()}` the maximum number of redirections that will be followed + ### skip_body/1 ### diff --git a/doc/hackney_http.md b/doc/hackney_http.md index 0a682397..b9056741 100644 --- a/doc/hackney_http.md +++ b/doc/hackney_http.md @@ -29,31 +29,41 @@ you can process later with `hackney_http:execute/2` when `{more, ...}` is returnned or `hackney_http:execute/1` in other cases: -- `{response, http_version(), status(), http_reason(), parser()}`: +* `{response, http_version(), status(), http_reason(), parser()}`: when the first line of a response is parsed -- `{request, http_version(), http_method(), uri(), parser()}`: + +* `{request, http_version(), http_method(), uri(), parser()}`: when the first line of a request (on servers) is parsed -- `{more, parser()}`: when the parser need more + +* `{more, parser()}`: when the parser need more data. The new data should be passed to `hackney_http:execute/2` with the new parser() state received. -- `{header, {Name :: binary(), Value :: binary()}, parser()}`: + +* `{header, {Name :: binary(), Value :: binary()}, parser()}`: when an header has been parsed. To continue the parsing you must call the given `parser()` with `hackney_http:execute/1`. -- `{headers_complete, parser()}` : when all headers have been parsed. + +* `{headers_complete, parser()}` : when all headers have been parsed. To continue the parsing you must call the given `parser()` state with `hackney_http:execute/1`. -- `{more, parser(), binary()}`: on body, when + +* `{more, parser(), binary()}`: on body, when the parser need more data. The new data should be passed to `hackney_http:execute/2` (with `parser()` ) when received. The binary at the end of the tuple correspond to the actual buffer of the parser. It may be used for other purpose, like start to parse a new request on pipeline connections, for a proxy... -- `{ok, binary(), parser()}`: on body, when a chunk has been + +* `{ok, binary(), parser()}`: on body, when a chunk has been parsed. To continue the parsing you must call `hackney_http:execute/1` with the given `parser()`. -- `{done, binary()}`: when the parsing is done. The binary + +* `{done, binary()}`: when the parsing is done. The binary given correpond to the non parsed part of the internal buffer. -- `{error, term{}}`: when an error happen + +* `{error, term{}}`: when an error happen + + ## Data Types ## @@ -213,14 +223,23 @@ get(Parser::parser(), Props::atom() | [atom()]) -> retrieve a parser property. Properties are: -- `buffer`: internal buffer of the parser (non parsed) -- `state`: the current state (on_status, on_header, on_body, done) -- `version`: HTTP version -- `content_length`: content length header if any -- `transfer_encoding`: transfer encoding header if any -- `content_type`: content type header if any -- `location`: location header if any -- `connection`: connection header if any. + +* `buffer`: internal buffer of the parser (non parsed) + +* `state`: the current state (on_status, on_header, on_body, done) + +* `version`: HTTP version + +* `content_length`: content length header if any + +* `transfer_encoding`: transfer encoding header if any + +* `content_type`: content type header if any + +* `location`: location header if any + +* `connection`: connection header if any. + diff --git a/doc/hackney_multipart.md b/doc/hackney_multipart.md index 29cf9813..0e0714af 100644 --- a/doc/hackney_multipart.md +++ b/doc/hackney_multipart.md @@ -117,7 +117,7 @@ part_result() = headers() | eof ## Function Index ## -
    boundary/0
    decode_form/2decode a multipart form.
    encode_form/1encode a list of parts a multipart form.
    encode_form/2
    len_mp_stream/2get the size of a mp stream.
    mp_data_header/2return the multipart header for a data.
    mp_eof/1return the boundary ennding a multipart.
    mp_file_header/2return the multipart header for a file that will be sent later.
    mp_header/2create a generic multipart header.
    mp_mixed_header/2return the mixed multipart header.
    parser/1Return a multipart parser for the given boundary.
    part/3create a part.
    +
    boundary/0
    decode_form/2decode a multipart form.
    encode_form/1encode a list of parts a multipart form.
    encode_form/2
    len_mp_stream/2get the size of a mp stream.
    mp_data_header/2return the multipart header for a data.
    mp_eof/1return the boundary ending a multipart.
    mp_file_header/2return the multipart header for a file that will be sent later.
    mp_header/2create a generic multipart header.
    mp_mixed_header/2return the mixed multipart header.
    parser/1Return a multipart parser for the given boundary.
    part/3create a part.
    @@ -152,16 +152,24 @@ decode a multipart form. encode a list of parts a multipart form. Parts can be under the form: -- `{file, Path}` : to send a file -- `{file, Path, ExtraHeaders}` : to send a file with extra headers -- `{file, Path, Name, ExtraHeaders}`: to send a file with DOM element name and extra headers -- `{mp_mixed, Name, Boundary}` to send a mixed multipart. -- `{mp_mixed_eof, Boundary}`: to signal the end of the mixed + +* `{file, Path}` : to send a file + +* `{file, Path, ExtraHeaders}` : to send a file with extra headers + +* `{file, Path, Name, ExtraHeaders}`: to send a file with DOM element name and extra headers + +* `{mp_mixed, Name, Boundary}` to send a mixed multipart. + +* `{mp_mixed_eof, Boundary}`: to signal the end of the mixed multipart boundary. -- `{Name, Data}`: to send a custom content as a part -- `{Name, Data, ExtraHeaders}`: the same as above but with extra + +* `{Name, Data}`: to send a custom content as a part + +* `{Name, Data, ExtraHeaders}`: the same as above but with extra headers. + ### encode_form/2 ### @@ -182,15 +190,22 @@ content-length of a full multipart stream and send it as an identity transfer-encoding instead of chunked so any server can handle it. Calculated Parts can be under the form: -- `{file, Path}` : to send a file -- `{file, Path, ExtraHeaders}` : to send a file with extra headers -- `{file, Path, Name, ExtraHeaders}` : to send a file with DOM element name and extra headers -- `{mp_mixed, Name, Boundary}` to send a mixed multipart. + +* `{file, Path}` : to send a file + +* `{file, Path, ExtraHeaders}` : to send a file with extra headers + +* `{file, Path, Name, ExtraHeaders}` : to send a file with DOM element name and extra headers + +* `{mp_mixed, Name, Boundary}` to send a mixed multipart. multipart boundary. -- `{Name, DataLen}`: to send a custom content as a part -- `{Name, DataLen, ExtraHeaders}`: the same as above but with extra + +* `{Name, DataLen}`: to send a custom content as a part + +* `{Name, DataLen, ExtraHeaders}`: the same as above but with extra headers. + ### mp_data_header/2 ### @@ -208,7 +223,7 @@ return the multipart header for a data `mp_eof(Boundary) -> any()` -return the boundary ennding a multipart +return the boundary ending a multipart diff --git a/doc/hackney_url.md b/doc/hackney_url.md index 9a153a1e..8edd008b 100644 --- a/doc/hackney_url.md +++ b/doc/hackney_url.md @@ -29,7 +29,7 @@ qs_opt() = noplus | upper
    
    -qs_vals() = [{binary(), binary() | true}]
    +qs_vals() = [{binary() | atom() | list() | integer(), binary() | true}]
     
    @@ -217,7 +217,7 @@ urlencode(Bin::binary() | string(), Opts::[qs_opt()]) URL encode a string binary. The `noplus` option disables the default behaviour of quoting space -characters, `\s`, as `+`. The `upper` option overrides the default behaviour -of writing hex numbers using lowecase letters to using uppercase letters +characters, `\s`, as `+`. The `lower` option overrides the default behaviour +of writing hex numbers using uppercase letters to using lowercase letters instead. diff --git a/doc/overview.edoc b/doc/overview.edoc index 5f9cd177..3ad5f864 100644 --- a/doc/overview.edoc +++ b/doc/overview.edoc @@ -27,7 +27,7 @@ **hackney** is an HTTP client library for Erlang. -[![Build Status](https://travis-ci.org/benoitc/hackney.png?branch=master)](https://travis-ci.org/benoitc/hackney) +[![Build Status](https://github.com/benoitc/hackney/workflows/build/badge.svg)](https://github.com/benoitc/hackney/actions?query=workflow%3Abuild) [![Hex pm](http://img.shields.io/hexpm/v/hackney.svg?style=flat)](https://hex.pm/packages/hackney)