diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/http.hrl | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/include/http.hrl b/include/http.hrl index 3b4e938..a10b120 100644 --- a/include/http.hrl +++ b/include/http.hrl @@ -33,16 +33,11 @@ | 'Expires' | 'Last-Modified' | 'Accept-Ranges' | 'Set-Cookie' | 'Set-Cookie2' | 'X-Forwarded-For' | 'Cookie' | 'Keep-Alive' | 'Proxy-Connection' | binary(). --type http_headers() :: list({http_header(), binary()}). +-type http_headers() :: list({http_header(), iodata()}). -type http_cookies() :: list({binary(), binary()}). -type http_status() :: non_neg_integer() | binary(). - -%% @todo Improve this type. --type multipart_data() :: - {headers, http_headers()} | - {data, binary()} | - end_of_part | - eof. +-type http_resp_body() :: iodata() | {non_neg_integer(), + fun(() -> {sent, non_neg_integer()})}. -record(http_req, { %% Transport. @@ -51,6 +46,7 @@ connection = keepalive :: keepalive | close, %% Request. + pid = undefined :: pid(), method = 'GET' :: http_method(), version = {1, 1} :: http_version(), peer = undefined :: undefined | {inet:ip_address(), inet:ip_port()}, @@ -67,6 +63,7 @@ headers = [] :: http_headers(), p_headers = [] :: [any()], %% @todo Improve those specs. cookies = undefined :: undefined | http_cookies(), + meta = [] :: [{atom(), any()}], %% Request body. body_state = waiting :: waiting | done | @@ -74,5 +71,10 @@ buffer = <<>> :: binary(), %% Response. - resp_state = waiting :: locked | waiting | chunks | done + resp_state = waiting :: locked | waiting | chunks | done, + resp_headers = [] :: http_headers(), + resp_body = <<>> :: http_resp_body(), + + %% Functions. + urldecode :: {fun((binary(), T) -> binary()), T} }). |