From 64329fbeb7a9810ea48aa4ade6b72af4853f9668 Mon Sep 17 00:00:00 2001 From: benoitc Date: Fri, 26 Oct 2012 21:28:55 +0200 Subject: [PATCH] bump to 0.40 --- NEWS.md | 14 ++++++++++ README.md | 2 +- doc/README.md | 2 +- doc/hackney.md | 56 +++++++++++++++++++++++++++++++++++++--- doc/hackney_multipart.md | 17 ++++++++++-- doc/hackney_request.md | 9 ++++++- doc/overview.edoc | 2 +- package.exs | 4 +-- src/hackney.app.src | 2 +- src/hackney.erl | 4 +-- 10 files changed, 98 insertions(+), 14 deletions(-) diff --git a/NEWS.md b/NEWS.md index ccdcb26a..f6a994eb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,19 @@ # NEWS +0.4.0 - 2012/10/26 +------------------ + +- Allows to stream a multipart request +- Add `insecure` option to connect via ssl without verifying an SSL + certificate +- Handle empty headers values +- Add `force_redirect` option +- Add expm support +- Fix body streaming +- Fix SSL handling +- Fix hackney:request/3 (no more loop) + + 0.3.0 - 2012/09/26 ------------------ diff --git a/README.md b/README.md index 63575d2d..59dd32f7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Copyright (c) 2012 Benoît Chesneau. -__Version:__ 0.3 +__Version:__ 0.4 # hackney diff --git a/doc/README.md b/doc/README.md index 2f907462..f528d521 100644 --- a/doc/README.md +++ b/doc/README.md @@ -5,7 +5,7 @@ Copyright (c) 2012 Benoît Chesneau. -__Version:__ 0.3 +__Version:__ 0.4 # hackney diff --git a/doc/hackney.md b/doc/hackney.md index 7cb1bde9..a0322bce 100644 --- a/doc/hackney.md +++ b/doc/hackney.md @@ -11,7 +11,22 @@
body/1Return the full body sent with the response.
body/2Return the full body sent with the response as long as the body -length doesn't go over MaxLength.
close/1close the client.
connect/1connect a socket and create a client state.
connect/3
connect/4
pool/1get current pool pid or name used by a client if needed.
request/1make a request.
request/2make a request.
request/3make a request.
request/4make a request.
request/5make a request.
send_request/2send a request using the current client state.
set_sockopts/2add set sockets options in the client.
skip_body/1skip the full body.
start/0Start the couchbeam process.
start_pool/2start a pool.
start_response/1start a response.
stop/0Stop the couchbeam process.
stop_pool/1stop a pool.
stream_body/1Stream the response body.
stream_request_body/2stream the request body.
+length doesn't go over MaxLength.close/1close the client.connect/1connect a socket and create a client state.connect/3connect/4end_stream_request_body/1end streaming the request body.pool/1get current pool pid or name used by a client if needed.request/1make a request.request/2make a request.request/3make a request.request/4make a request.request/5make a request.send_request/2send a request using the current client state.set_sockopts/2add set sockets options in the client.skip_body/1skip the full body.start/0Start the couchbeam process.start_pool/2start a pool.start_response/1start a response.stop/0Stop the couchbeam process.stop_pool/1stop a pool.stream_body/1Stream the response body.stream_multipart_request/2stream a multipart request until eof +Possible value are : +stream_request_body/2stream the request body. @@ -65,7 +80,14 @@ connect a socket and create a client state. `connect(Transport, Host, Port, Client) -> any()` - + + +###end_stream_request_body/1## + + +`end_stream_request_body(Client) -> any()` + +end streaming the request body. ###pool/1## @@ -260,7 +282,35 @@ stop a pool `stream_body(Client) -> any()` -Stream the response body. +Stream the response body. + +###stream_multipart_request/2## + + +`stream_multipart_request(Body, Client) -> any()` + +stream a multipart request until eof +Possible value are : + +* `eof`: end the multipart request + +* `{Id, {File, FileName}}`: to stream a file + +* `{data, {start, Id, DileName, ContentType}}`: to start to stream +arbitrary binary content + +* `{data, Bin}`: send a binary. Use it only after emitting a +**start** +
  • `{data, eof}`: stop sending an arbitary content. It doesn`t stop +the multipart request + +* `{Id, {file, Filename, Content}`: send a full content as a +boundary + +* `{Id, Value}`: send an arbitrary value as a boundary. Filename and +Id are identique + + ###stream_request_body/2## diff --git a/doc/hackney_multipart.md b/doc/hackney_multipart.md index 7bcb7aaa..d0215877 100644 --- a/doc/hackney_multipart.md +++ b/doc/hackney_multipart.md @@ -13,13 +13,20 @@ module to encode/decode forms. ##Function Index## -
    decode_form/1
    encode_form/1encode a list of properties in a form.
    +
    boundary/0
    decode_form/1
    encode_form/1encode a list of properties in a form.
    stream/2
    ##Function Details## + + +###boundary/0## + + +`boundary() -> any()` + ###decode_form/1## @@ -34,4 +41,10 @@ module to encode/decode forms. `encode_form(KVs) -> any()` -encode a list of properties in a form. \ No newline at end of file +encode a list of properties in a form. + +###stream/2## + + +`stream(X1, Client) -> any()` + diff --git a/doc/hackney_request.md b/doc/hackney_request.md index 63322a79..e09bf691 100644 --- a/doc/hackney_request.md +++ b/doc/hackney_request.md @@ -10,13 +10,20 @@ ##Function Index## -
    perform/2
    send/2
    send_chunk/2
    sendfile/2
    stream_body/2
    +
    end_stream_body/1
    perform/2
    send/2
    send_chunk/2
    sendfile/2
    stream_body/2
    ##Function Details## + + +###end_stream_body/1## + + +`end_stream_body(Client) -> any()` + ###perform/2## diff --git a/doc/overview.edoc b/doc/overview.edoc index b3afad5b..1ed5eec8 100644 --- a/doc/overview.edoc +++ b/doc/overview.edoc @@ -16,7 +16,7 @@ @copyright 2012 Benoît Chesneau. -@version 0.3 +@version 0.4 @title hackney - simple HTTP client in Erlang @doc diff --git a/package.exs b/package.exs index 33a7d32a..9c8f6adc 100644 --- a/package.exs +++ b/package.exs @@ -1,5 +1,5 @@ Expm.Package.new(name: "hackney", description: "Simple HTTP client in Erlang", - version: "0.3.2", keywords: ["http","client","binary"], + version: "0.4.0", keywords: ["http","client","binary"], dependencies: ["mimetypes"], licenses: [[name: "Apache License, Version 2.0", file: "LICENSE"]], contributors: [[name: "Adam Rutkowski", @@ -22,5 +22,5 @@ Expm.Package.new(name: "hackney", description: "Simple HTTP client in Erlang", ]], maintainers: [[name: "Benoit Chesneau", email: "bchesneau@gmail.com"]], - repositories: [[github: "benoitc/hackney", tag: "0.3.2"]]) + repositories: [[github: "benoitc/hackney", tag: "0.4.0"]]) diff --git a/src/hackney.app.src b/src/hackney.app.src index 0bf5f897..da3fdf4b 100644 --- a/src/hackney.app.src +++ b/src/hackney.app.src @@ -4,7 +4,7 @@ {application, hackney, [ {description, "simple HTTP client"}, - {vsn, "0.3.2"}, + {vsn, "0.4.0"}, {registered, [hackney_pool]}, {applications, [kernel, stdlib, crypto, public_key, ssl]}, {mod, { hackney_app, nil}}, diff --git a/src/hackney.erl b/src/hackney.erl index 6f2b40f7..4c2efb13 100644 --- a/src/hackney.erl +++ b/src/hackney.erl @@ -249,9 +249,9 @@ end_stream_request_body(Client) -> %% **start**
  • %%
  • `{data, eof}`: stop sending an arbitary content. It doesn't stop %% the multipart request
  • -%%
  • `{Id, {file, Filename, Content}`: send a full content as a +%%
  • `{Id, {file, Filename, Content}': send a full content as a %% boundary
  • -%%
  • `{Id, Value}: send an arbitrary value as a boundary. Filename and +%%
  • `{Id, Value}': send an arbitrary value as a boundary. Filename and %% Id are identique
  • %% stream_multipart_request(Body, Client) ->