-include_lib("eNet/include/eNet.hrl").
|
|
|
|
|
|
|
|
-export_type([wsOpt/0]).
|
|
-type wsOpt() ::
|
|
listenOpt() |
|
|
{wsMod, module()}.
|
|
|
|
-record(wsReq, {
|
|
method :: method(),
|
|
path :: binary(),
|
|
version :: wsHttp:version(),
|
|
scheme :: undefined | binary(),
|
|
host :: undefined | binary(),
|
|
port :: undefined | 1..65535,
|
|
args :: [{binary(), any()}],
|
|
headers :: headers(),
|
|
body = <<>> :: body()
|
|
}).
|
|
|
|
-export_type([
|
|
wsReq/0
|
|
, method/0
|
|
, body/0
|
|
, path/0
|
|
, headers/0
|
|
, httpCode/0
|
|
, version/0
|
|
]).
|
|
|
|
-type wsReq() :: #wsReq{}.
|
|
-type method() :: 'OPTIONS' | 'GET' | 'HEAD' | 'POST'| 'PUT' | 'DELETE' | 'TRACE' | binary().
|
|
-type body() :: binary() | iolist().
|
|
-type path() :: binary().
|
|
-type header() :: {Key :: binary(), Value :: binary() | string()}.
|
|
-type headers() :: [header()].
|
|
-type httpCode() :: 100..999.
|
|
-type version() :: {0, 9} | {1, 0} | {1, 1}.
|
|
|
|
-define(CONTENT_LENGTH_HEADER, 'Content-Length').
|
|
-define(EXPECT_HEADER, <<"expect">>).
|
|
-define(CONNECTION_HEADER, 'Connection').
|
|
-define(TRANSFER_ENCODING_HEADER, <<"Transfer-Encoding">>).
|
|
|