-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 , header_key/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(CONNECTION_HEADER, 'Connection'). -define(TRANSFER_ENCODING_HEADER, 'Transfer-Encoding'). -define(EXPECT_HEADER, <<"Expect">>). %% http header 头 -type header_key() :: '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() | string().