From 95e05d822f46e791a919f4e966879b4827989669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 29 Mar 2012 01:14:44 +0200 Subject: Add chunked transfer encoding support and rework the body reading API Introduces 3 low level functions and updates the existing higher levels functions. The new primitives are has_body/1, body_length/1 and stream_body/1. In addition to that, a helper function init_stream/4 has been added. Streaming a body implies to decode the Transfer-Encoding and Content-Encoding used for the body. By default, Cowboy will try to figure out what was used and decode them properly. You can override this if you want to disable this behavior or simply support more encodings by calling the init_stream/4 function before you start streaming the body. --- include/http.hrl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/http.hrl b/include/http.hrl index 9ba3787..21d837b 100644 --- a/include/http.hrl +++ b/include/http.hrl @@ -41,8 +41,8 @@ meta = [] :: [{atom(), any()}], %% Request body. - body_state = waiting :: waiting | done | - {multipart, non_neg_integer(), fun()}, + body_state = waiting :: waiting | done | {stream, fun(), any(), fun()} + | {multipart, non_neg_integer(), fun()}, buffer = <<>> :: binary(), %% Response. -- cgit v1.2.3