You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 line
2.1 KiB

  1. -include_lib("eNet/include/eNet.hrl").
  2. -export_type([wsOpt/0]).
  3. -type wsOpt() ::
  4. listenOpt() |
  5. {wsMod, module()}.
  6. -record(wsReq, {
  7. method :: method(),
  8. path :: binary(),
  9. version :: wsHttp:version(),
  10. scheme :: undefined | binary(),
  11. host :: undefined | binary(),
  12. port :: undefined | 1..65535,
  13. args :: [{binary(), any()}],
  14. headers :: headers(),
  15. body = <<>> :: body()
  16. }).
  17. -export_type([
  18. wsReq/0
  19. , method/0
  20. , body/0
  21. , path/0
  22. , headers/0
  23. , httpCode/0
  24. , version/0
  25. , header_key/0
  26. ]).
  27. -type wsReq() :: #wsReq{}.
  28. -type method() :: 'OPTIONS' | 'GET' | 'HEAD' | 'POST'| 'PUT' | 'DELETE' | 'TRACE' | binary().
  29. -type body() :: binary() | iolist().
  30. -type path() :: binary().
  31. -type header() :: {Key :: binary(), Value :: binary() | string()}.
  32. -type headers() :: [header()].
  33. -type httpCode() :: 100..999.
  34. -type version() :: {0, 9} | {1, 0} | {1, 1}.
  35. -define(CONTENT_LENGTH_HEADER, 'Content-Length').
  36. -define(CONNECTION_HEADER, 'Connection').
  37. -define(TRANSFER_ENCODING_HEADER, 'Transfer-Encoding').
  38. -define(EXPECT_HEADER, <<"Expect">>).
  39. %% http header 头
  40. -type header_key() ::
  41. 'Cache-Control' |
  42. 'Connection' |
  43. 'Date' |
  44. 'Pragma'|
  45. 'Transfer-Encoding' |
  46. 'Upgrade' |
  47. 'Via' |
  48. 'Accept' |
  49. 'Accept-Charset'|
  50. 'Accept-Encoding' |
  51. 'Accept-Language' |
  52. 'Authorization' |
  53. 'From' |
  54. 'Host' |
  55. 'If-Modified-Since' |
  56. 'If-Match' |
  57. 'If-None-Match' |
  58. 'If-Range'|
  59. 'If-Unmodified-Since' |
  60. 'Max-Forwards' |
  61. 'Proxy-Authorization' |
  62. 'Range'|
  63. 'Referer' |
  64. 'User-Agent' |
  65. 'Age' |
  66. 'Location' |
  67. 'Proxy-Authenticate'|
  68. 'Public' |
  69. 'Retry-After' |
  70. 'Server' |
  71. 'Vary' |
  72. 'Warning'|
  73. 'Www-Authenticate' |
  74. 'Allow' |
  75. 'Content-Base' |
  76. 'Content-Encoding'|
  77. 'Content-Language' |
  78. 'Content-Length' |
  79. 'Content-Location'|
  80. 'Content-Md5' |
  81. 'Content-Range' |
  82. 'Content-Type' |
  83. 'Etag'|
  84. 'Expires' |
  85. 'Last-Modified' |
  86. 'Accept-Ranges' |
  87. 'Set-Cookie'|
  88. 'Set-Cookie2' |
  89. 'X-Forwarded-For' |
  90. 'Cookie' |
  91. 'Keep-Alive' |
  92. 'Proxy-Connection' |
  93. binary() |
  94. string().