aboutsummaryrefslogtreecommitdiffstats
path: root/include/http.hrl
diff options
context:
space:
mode:
Diffstat (limited to 'include/http.hrl')
-rw-r--r--include/http.hrl42
1 files changed, 9 insertions, 33 deletions
diff --git a/include/http.hrl b/include/http.hrl
index a7355f4..c66f2b0 100644
--- a/include/http.hrl
+++ b/include/http.hrl
@@ -13,32 +13,6 @@
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--type http_method() :: 'OPTIONS' | 'GET' | 'HEAD'
- | 'POST' | 'PUT' | 'DELETE' | 'TRACE' | binary().
--type http_uri() :: '*' | {absoluteURI, http | https, Host::binary(),
- Port::integer() | undefined, Path::binary()}
- | {scheme, Scheme::binary(), binary()}
- | {abs_path, binary()} | binary().
--type http_version() :: {Major::non_neg_integer(), Minor::non_neg_integer()}.
--type http_header() :: 'Cache-Control' | 'Connection' | 'Date' | 'Pragma'
- | 'Transfer-Encoding' | 'Upgrade' | 'Via' | 'Accept' | 'Accept-Charset'
- | 'Accept-Encoding' | 'Accept-Language' | 'Authorization' | 'From' | 'Host'
- | 'If-Modified-Since' | 'If-Match' | 'If-None-Match' | 'If-Range'
- | 'If-Unmodified-Since' | 'Max-Forwards' | 'Proxy-Authorization' | 'Range'
- | 'Referer' | 'User-Agent' | 'Age' | 'Location' | 'Proxy-Authenticate'
- | 'Public' | 'Retry-After' | 'Server' | 'Vary' | 'Warning'
- | 'Www-Authenticate' | 'Allow' | 'Content-Base' | 'Content-Encoding'
- | 'Content-Language' | 'Content-Length' | 'Content-Location'
- | 'Content-Md5' | 'Content-Range' | 'Content-Type' | 'Etag'
- | 'Expires' | 'Last-Modified' | 'Accept-Ranges' | 'Set-Cookie'
- | 'Set-Cookie2' | 'X-Forwarded-For' | 'Cookie' | 'Keep-Alive'
- | 'Proxy-Connection' | binary().
--type http_headers() :: list({http_header(), iodata()}).
--type http_cookies() :: list({binary(), binary()}).
--type http_status() :: non_neg_integer() | binary().
--type http_resp_body() :: iodata() | {non_neg_integer(),
- fun(() -> {sent, non_neg_integer()})}.
-
-record(http_req, {
%% Transport.
socket = undefined :: undefined | inet:socket(),
@@ -47,8 +21,8 @@
%% Request.
pid = undefined :: pid(),
- method = 'GET' :: http_method(),
- version = {1, 1} :: http_version(),
+ method = 'GET' :: cowboy_http:method(),
+ version = {1, 1} :: cowboy_http:version(),
peer = undefined :: undefined | {inet:ip_address(), inet:ip_port()},
host = undefined :: undefined | cowboy_dispatcher:tokens(),
host_info = undefined :: undefined | cowboy_dispatcher:tokens(),
@@ -60,19 +34,21 @@
qs_vals = undefined :: undefined | list({binary(), binary() | true}),
raw_qs = undefined :: undefined | binary(),
bindings = undefined :: undefined | cowboy_dispatcher:bindings(),
- headers = [] :: http_headers(),
+ headers = [] :: cowboy_http:headers(),
p_headers = [] :: [any()], %% @todo Improve those specs.
- cookies = undefined :: undefined | http_cookies(),
+ cookies = undefined :: undefined | [{binary(), binary()}],
meta = [] :: [{atom(), any()}],
%% Request body.
- body_state = waiting :: waiting | done,
+ body_state = waiting :: waiting | done |
+ {multipart, non_neg_integer(), fun()},
buffer = <<>> :: binary(),
%% Response.
resp_state = waiting :: locked | waiting | chunks | done,
- resp_headers = [] :: http_headers(),
- resp_body = <<>> :: http_resp_body(),
+ resp_headers = [] :: cowboy_http:headers(),
+ resp_body = <<>> :: iodata() | {non_neg_integer(),
+ fun(() -> {sent, non_neg_integer()})},
%% Functions.
urldecode :: {fun((binary(), T) -> binary()), T}