您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

140 行
4.3 KiB

  1. %%% ----------------------------------------------------------------------------
  2. %%% Copyright (c) 2009, Erlang Training and Consulting Ltd.
  3. %%% All rights reserved.
  4. %%%
  5. %%% Redistribution and use in source and binary forms, with or without
  6. %%% modification, are permitted provided that the following conditions are met:
  7. %%% * Redistributions of source code must retain the above copyright
  8. %%% notice, this list of conditions and the following disclaimer.
  9. %%% * Redistributions in binary form must reproduce the above copyright
  10. %%% notice, this list of conditions and the following disclaimer in the
  11. %%% documentation and/or other materials provided with the distribution.
  12. %%% * Neither the name of Erlang Training and Consulting Ltd. nor the
  13. %%% names of its contributors may be used to endorse or promote products
  14. %%% derived from this software without specific prior written permission.
  15. %%%
  16. %%% THIS SOFTWARE IS PROVIDED BY Erlang Training and Consulting Ltd. ''AS IS''
  17. %%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. %%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. %%% ARE DISCLAIMED. IN NO EVENT SHALL Erlang Training and Consulting Ltd. BE
  20. %%% LIABLE SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  21. %%% BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  22. %%% WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  23. %%% OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  24. %%% ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. %%% ----------------------------------------------------------------------------
  26. -type header() ::
  27. 'Cache-Control' |
  28. 'Connection' |
  29. 'Date' |
  30. 'Pragma'|
  31. 'Transfer-Encoding' |
  32. 'Upgrade' |
  33. 'Via' |
  34. 'Accept' |
  35. 'Accept-Charset'|
  36. 'Accept-Encoding' |
  37. 'Accept-Language' |
  38. 'Authorization' |
  39. 'From' |
  40. 'Host' |
  41. 'If-Modified-Since' |
  42. 'If-Match' |
  43. 'If-None-Match' |
  44. 'If-Range'|
  45. 'If-Unmodified-Since' |
  46. 'Max-Forwards' |
  47. 'Proxy-Authorization' |
  48. 'Range'|
  49. 'Referer' |
  50. 'User-Agent' |
  51. 'Age' |
  52. 'Location' |
  53. 'Proxy-Authenticate'|
  54. 'Public' |
  55. 'Retry-After' |
  56. 'Server' |
  57. 'Vary' |
  58. 'Warning'|
  59. 'Www-Authenticate' |
  60. 'Allow' |
  61. 'Content-Base' |
  62. 'Content-Encoding'|
  63. 'Content-Language' |
  64. 'Content-Length' |
  65. 'Content-Location'|
  66. 'Content-Md5' |
  67. 'Content-Range' |
  68. 'Content-Type' |
  69. 'Etag'|
  70. 'Expires' |
  71. 'Last-Modified' |
  72. 'Accept-Ranges' |
  73. 'Set-Cookie'|
  74. 'Set-Cookie2' |
  75. 'X-Forwarded-For' |
  76. 'Cookie' |
  77. 'Keep-Alive' |
  78. 'Proxy-Connection' |
  79. binary() |
  80. string().
  81. -type headers() :: [{header(), iodata()}].
  82. -type method() :: string() | atom().
  83. -type pos_timeout() :: pos_integer() | 'infinity'.
  84. -type bodypart() :: iodata() | 'http_eob'.
  85. -type socket() :: _.
  86. -type port_num() :: 1..65535.
  87. -type poolsize() :: non_neg_integer() | atom().
  88. -type invalid_option() :: any().
  89. -type pool_id() :: pid() | atom().
  90. -type destination() :: {string(), pos_integer(), boolean()}.
  91. -type raw_headers() :: [{atom() | binary() | string(), binary() | string()}].
  92. -type partial_download_option() ::
  93. {'window_size', window_size()} |
  94. {'part_size', non_neg_integer() | 'infinity'} |
  95. invalid_option().
  96. -type option() ::
  97. {'connect_timeout', timeout()} |
  98. {'send_retry', non_neg_integer()} |
  99. {'partial_upload', non_neg_integer() | 'infinity'} |
  100. {'partial_download', [partial_download_option()]} |
  101. {'connect_options', socket_options()} |
  102. {'proxy', string()} |
  103. {'proxy_ssl_options', socket_options()} |
  104. {'pool', pid() | atom()} |
  105. invalid_option().
  106. -type options() :: [option()].
  107. -type host() :: string() | {integer(), integer(), integer(), integer()}.
  108. -type http_status() :: {integer(), string() | binary()} | {'nil','nil'}.
  109. -type socket_options() :: [{atom(), term()} | atom()].
  110. -type window_size() :: non_neg_integer() | 'infinity'.
  111. -type upload_state() :: {pid(), window_size()}.
  112. -type body() :: binary() |
  113. 'undefined' | % HEAD request.
  114. pid(). % When partial_download option is used.
  115. -type result() ::
  116. {ok, {{pos_integer(), string()}, headers(), body()}} |
  117. {ok, upload_state()} |
  118. {error, atom()}.