Posted by: fdmanana | September 27, 2010

Streaming the body of HTTP POST/PUT requests with Erlang OTP

Yesterday I submitted a patch to the Erlang OTP erlang-patches mailing list to add a feature, to the httpc module, that has been lacking for a long time:

Streaming the body of HTTP PUT and POST requests.

It has just been merged into OTP’s pu branch:

http://github.com/erlang/otp/commit/0ae050e3240f1aa68d8d648a36191246f33374b4


http://www.erlang.org/cgi-bin/ezmlm-cgi?3:sss:1483:201009:fcbeggiaekkjadoghldl#b

Hopefully it will get into the next R14 release.

UPDATE: A few days after I submitted another patch on top of that one:

http://github.com/erlang/otp/commit/2809acda106cdd081746d2f2b7d4ddd8c96eff76


http://www.erlang.org/cgi-bin/ezmlm-cgi?3:sss:1483:201009:fcbeggiaekkjadoghldl#b

It adds support for automatically chunking (HTTP chunked Transfer-Encoding) the payload based on what the streaming function returns on each call.

UPDATE: Did some simplifications to the implementation and API when it automatically adds chunked-transfer encoding headers. The new full patch:
https://github.com/erlang/otp/commit/6ec259d2828ac44ee71c7b32392497ba1712ed48

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: