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.

387 rivejä
25 KiB

9 vuotta sitten
18 vuotta sitten
14 vuotta sitten
9 vuotta sitten
18 vuotta sitten
18 vuotta sitten
14 vuotta sitten
18 vuotta sitten
17 vuotta sitten
18 vuotta sitten
9 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
18 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
14 vuotta sitten
9 vuotta sitten
17 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
14 vuotta sitten
18 vuotta sitten
18 vuotta sitten
18 vuotta sitten
9 vuotta sitten
9 vuotta sitten
17 vuotta sitten
17 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
18 vuotta sitten
9 vuotta sitten
18 vuotta sitten
9 vuotta sitten
18 vuotta sitten
9 vuotta sitten
18 vuotta sitten
9 vuotta sitten
17 vuotta sitten
17 vuotta sitten
17 vuotta sitten
17 vuotta sitten
17 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
14 vuotta sitten
9 vuotta sitten
17 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
17 vuotta sitten
9 vuotta sitten
9 vuotta sitten
17 vuotta sitten
9 vuotta sitten
9 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
17 vuotta sitten
9 vuotta sitten
17 vuotta sitten
14 vuotta sitten
9 vuotta sitten
14 vuotta sitten
9 vuotta sitten
9 vuotta sitten
9 vuotta sitten
18 vuotta sitten
9 vuotta sitten
18 vuotta sitten
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>Module ibrowse</title>
  6. <link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
  7. </head>
  8. <body bgcolor="white">
  9. <div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  10. <hr>
  11. <h1>Module ibrowse</h1>
  12. <ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>The ibrowse application implements an HTTP 1.1 client in erlang.
  13. <p>Copyright © 2005-2014 Chandrashekhar Mullaparthi</p>
  14. <p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
  15. <p><b>Authors:</b> Chandrashekhar Mullaparthi (<a href="mailto:chandrashekhar dot mullaparthi at gmail dot com"><tt>chandrashekhar dot mullaparthi at gmail dot com</tt></a>).</p>
  16. <h2><a name="description">Description</a></h2><p>The ibrowse application implements an HTTP 1.1 client in erlang. This
  17. module implements the API of the HTTP client. There is one named
  18. process called 'ibrowse' which assists in load balancing and maintaining configuration. There is one load balancing process per unique webserver. There is
  19. one process to handle one TCP connection to a webserver
  20. (implemented in the module ibrowse_http_client). Multiple connections to a
  21. webserver are setup based on the settings for each webserver. The
  22. ibrowse process also determines which connection to pipeline a
  23. certain request on. The functions to call are send_req/3,
  24. send_req/4, send_req/5, send_req/6.</p>
  25. <p>Here are a few sample invocations.</p>
  26. <code>
  27. ibrowse:send_req("http://intranet/messenger/", [], get).
  28. <br><br>
  29. ibrowse:send_req("http://www.google.com/", [], get, [],
  30. [{proxy_user, "XXXXX"},
  31. {proxy_password, "XXXXX"},
  32. {proxy_host, "proxy"},
  33. {proxy_port, 8080}], 1000).
  34. <br><br>
  35. ibrowse:send_req("http://www.erlang.org/download/otp_src_R10B-3.tar.gz", [], get, [],
  36. [{proxy_user, "XXXXX"},
  37. {proxy_password, "XXXXX"},
  38. {proxy_host, "proxy"},
  39. {proxy_port, 8080},
  40. {save_response_to_file, true}], 1000).
  41. <br><br>
  42. ibrowse:send_req("http://www.erlang.org", [], head).
  43. <br><br>
  44. ibrowse:send_req("http://www.sun.com", [], options).
  45. <br><br>
  46. ibrowse:send_req("http://www.bbc.co.uk", [], trace).
  47. <br><br>
  48. ibrowse:send_req("http://www.google.com", [], get, [],
  49. [{stream_to, self()}]).
  50. </code>
  51. <h2><a name="index">Function Index</a></h2>
  52. <table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add_config-1">add_config/1</a></td><td>Add additional configuration elements at runtime.</td></tr>
  53. <tr><td valign="top"><a href="#all_trace_off-0">all_trace_off/0</a></td><td>Turn Off ALL tracing.</td></tr>
  54. <tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td></td></tr>
  55. <tr><td valign="top"><a href="#get_config_value-1">get_config_value/1</a></td><td>Internal export.</td></tr>
  56. <tr><td valign="top"><a href="#get_config_value-2">get_config_value/2</a></td><td>Internal export.</td></tr>
  57. <tr><td valign="top"><a href="#get_metrics-0">get_metrics/0</a></td><td></td></tr>
  58. <tr><td valign="top"><a href="#get_metrics-2">get_metrics/2</a></td><td></td></tr>
  59. <tr><td valign="top"><a href="#handle_call-3">handle_call/3</a></td><td></td></tr>
  60. <tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td></td></tr>
  61. <tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td></td></tr>
  62. <tr><td valign="top"><a href="#init-1">init/1</a></td><td></td></tr>
  63. <tr><td valign="top"><a href="#rescan_config-0">rescan_config/0</a></td><td>Clear current configuration for ibrowse and load from the file
  64. ibrowse.conf in the IBROWSE_EBIN/../priv directory.</td></tr>
  65. <tr><td valign="top"><a href="#rescan_config-1">rescan_config/1</a></td><td></td></tr>
  66. <tr><td valign="top"><a href="#send_req-3">send_req/3</a></td><td>This is the basic function to send a HTTP request.</td></tr>
  67. <tr><td valign="top"><a href="#send_req-4">send_req/4</a></td><td>Same as send_req/3.</td></tr>
  68. <tr><td valign="top"><a href="#send_req-5">send_req/5</a></td><td>Same as send_req/4.</td></tr>
  69. <tr><td valign="top"><a href="#send_req-6">send_req/6</a></td><td>Same as send_req/5.</td></tr>
  70. <tr><td valign="top"><a href="#send_req_direct-4">send_req_direct/4</a></td><td>Same as send_req/3 except that the first argument is the PID
  71. returned by spawn_worker_process/2 or spawn_link_worker_process/2.</td></tr>
  72. <tr><td valign="top"><a href="#send_req_direct-5">send_req_direct/5</a></td><td>Same as send_req/4 except that the first argument is the PID
  73. returned by spawn_worker_process/2 or spawn_link_worker_process/2.</td></tr>
  74. <tr><td valign="top"><a href="#send_req_direct-6">send_req_direct/6</a></td><td>Same as send_req/5 except that the first argument is the PID
  75. returned by spawn_worker_process/2 or spawn_link_worker_process/2.</td></tr>
  76. <tr><td valign="top"><a href="#send_req_direct-7">send_req_direct/7</a></td><td>Same as send_req/6 except that the first argument is the PID
  77. returned by spawn_worker_process/2 or spawn_link_worker_process/2.</td></tr>
  78. <tr><td valign="top"><a href="#set_dest-3">set_dest/3</a></td><td>Deprecated.</td></tr>
  79. <tr><td valign="top"><a href="#set_max_attempts-3">set_max_attempts/3</a></td><td>Set the maximum attempts for each connection to a specific Host:Port.</td></tr>
  80. <tr><td valign="top"><a href="#set_max_pipeline_size-3">set_max_pipeline_size/3</a></td><td>Set the maximum pipeline size for each connection to a specific Host:Port.</td></tr>
  81. <tr><td valign="top"><a href="#set_max_sessions-3">set_max_sessions/3</a></td><td>Set the maximum number of connections allowed to a specific Host:Port.</td></tr>
  82. <tr><td valign="top"><a href="#show_dest_status-0">show_dest_status/0</a></td><td>Shows some internal information about load balancing.</td></tr>
  83. <tr><td valign="top"><a href="#show_dest_status-1">show_dest_status/1</a></td><td></td></tr>
  84. <tr><td valign="top"><a href="#show_dest_status-2">show_dest_status/2</a></td><td>Shows some internal information about load balancing to a
  85. specified Host:Port.</td></tr>
  86. <tr><td valign="top"><a href="#spawn_link_worker_process-1">spawn_link_worker_process/1</a></td><td>Same as spawn_worker_process/1 except the the calling process
  87. is linked to the worker process which is spawned.</td></tr>
  88. <tr><td valign="top"><a href="#spawn_link_worker_process-2">spawn_link_worker_process/2</a></td><td>Same as spawn_link_worker_process/1 except with Erlang process options.</td></tr>
  89. <tr><td valign="top"><a href="#spawn_worker_process-1">spawn_worker_process/1</a></td><td>Creates a HTTP client process to the specified Host:Port which
  90. is not part of the load balancing pool.</td></tr>
  91. <tr><td valign="top"><a href="#spawn_worker_process-2">spawn_worker_process/2</a></td><td>Same as spawn_worker_process/1 except with Erlang process options.</td></tr>
  92. <tr><td valign="top"><a href="#start-0">start/0</a></td><td>Starts the ibrowse process without linking.</td></tr>
  93. <tr><td valign="top"><a href="#start_link-0">start_link/0</a></td><td>Starts the ibrowse process linked to the calling process.</td></tr>
  94. <tr><td valign="top"><a href="#stop-0">stop/0</a></td><td>Stop the ibrowse process.</td></tr>
  95. <tr><td valign="top"><a href="#stop_worker_process-1">stop_worker_process/1</a></td><td>Terminate a worker process spawned using
  96. spawn_worker_process/2 or spawn_link_worker_process/2.</td></tr>
  97. <tr><td valign="top"><a href="#stream_close-1">stream_close/1</a></td><td>Tell ibrowse to close the connection associated with the
  98. specified stream.</td></tr>
  99. <tr><td valign="top"><a href="#stream_next-1">stream_next/1</a></td><td>Tell ibrowse to stream the next chunk of data to the
  100. caller.</td></tr>
  101. <tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td></td></tr>
  102. <tr><td valign="top"><a href="#trace_off-0">trace_off/0</a></td><td>Turn tracing off for the ibrowse process.</td></tr>
  103. <tr><td valign="top"><a href="#trace_off-2">trace_off/2</a></td><td>Turn tracing OFF for all connections to the specified HTTP
  104. server.</td></tr>
  105. <tr><td valign="top"><a href="#trace_on-0">trace_on/0</a></td><td>Turn tracing on for the ibrowse process.</td></tr>
  106. <tr><td valign="top"><a href="#trace_on-2">trace_on/2</a></td><td>Turn tracing on for all connections to the specified HTTP
  107. server.</td></tr>
  108. </table>
  109. <h2><a name="functions">Function Details</a></h2>
  110. <h3 class="function"><a name="add_config-1">add_config/1</a></h3>
  111. <div class="spec">
  112. <p><tt>add_config(Terms) -&gt; any()</tt></p>
  113. </div><p>Add additional configuration elements at runtime.</p>
  114. <h3 class="function"><a name="all_trace_off-0">all_trace_off/0</a></h3>
  115. <div class="spec">
  116. <p><tt>all_trace_off() -&gt; ok</tt><br></p>
  117. </div><p>Turn Off ALL tracing</p>
  118. <h3 class="function"><a name="code_change-3">code_change/3</a></h3>
  119. <div class="spec">
  120. <p><tt>code_change(OldVsn, State, Extra) -&gt; any()</tt></p>
  121. </div>
  122. <h3 class="function"><a name="get_config_value-1">get_config_value/1</a></h3>
  123. <div class="spec">
  124. <p><tt>get_config_value(Key) -&gt; any()</tt></p>
  125. </div><p>Internal export</p>
  126. <h3 class="function"><a name="get_config_value-2">get_config_value/2</a></h3>
  127. <div class="spec">
  128. <p><tt>get_config_value(Key, DefVal) -&gt; any()</tt></p>
  129. </div><p>Internal export</p>
  130. <h3 class="function"><a name="get_metrics-0">get_metrics/0</a></h3>
  131. <div class="spec">
  132. <p><tt>get_metrics() -&gt; any()</tt></p>
  133. </div>
  134. <h3 class="function"><a name="get_metrics-2">get_metrics/2</a></h3>
  135. <div class="spec">
  136. <p><tt>get_metrics(Host, Port) -&gt; any()</tt></p>
  137. </div>
  138. <h3 class="function"><a name="handle_call-3">handle_call/3</a></h3>
  139. <div class="spec">
  140. <p><tt>handle_call(Request, From, State) -&gt; any()</tt></p>
  141. </div>
  142. <h3 class="function"><a name="handle_cast-2">handle_cast/2</a></h3>
  143. <div class="spec">
  144. <p><tt>handle_cast(Msg, State) -&gt; any()</tt></p>
  145. </div>
  146. <h3 class="function"><a name="handle_info-2">handle_info/2</a></h3>
  147. <div class="spec">
  148. <p><tt>handle_info(Info, State) -&gt; any()</tt></p>
  149. </div>
  150. <h3 class="function"><a name="init-1">init/1</a></h3>
  151. <div class="spec">
  152. <p><tt>init(X1) -&gt; any()</tt></p>
  153. </div>
  154. <h3 class="function"><a name="rescan_config-0">rescan_config/0</a></h3>
  155. <div class="spec">
  156. <p><tt>rescan_config() -&gt; any()</tt></p>
  157. </div><p>Clear current configuration for ibrowse and load from the file
  158. ibrowse.conf in the IBROWSE_EBIN/../priv directory. Current
  159. configuration is cleared only if the ibrowse.conf file is readable
  160. using file:consult/1</p>
  161. <h3 class="function"><a name="rescan_config-1">rescan_config/1</a></h3>
  162. <div class="spec">
  163. <p><tt>rescan_config(Terms) -&gt; any()</tt></p>
  164. </div>
  165. <h3 class="function"><a name="send_req-3">send_req/3</a></h3>
  166. <div class="spec">
  167. <p><tt>send_req(Url::string(), Headers::<a href="#type-headerList">headerList()</a>, Method::<a href="#type-method">method()</a>) -&gt; <a href="#type-response">response()</a></tt>
  168. <ul class="definitions"><li><tt><a name="type-headerList">headerList()</a> = [{<a href="#type-header">header()</a>, <a href="#type-value">value()</a>}]</tt></li><li><tt><a name="type-header">header()</a> = atom() | string() | binary()</tt></li><li><tt><a name="type-value">value()</a> = term()</tt></li><li><tt><a name="type-method">method()</a> = get | post | head | options | put | delete | trace | mkcol | propfind | proppatch | lock | unlock | move | copy</tt></li><li><tt>Status = string()</tt></li><li><tt>ResponseHeaders = [<a href="#type-respHeader">respHeader()</a>]</tt></li><li><tt><a name="type-respHeader">respHeader()</a> = {<a href="#type-headerName">headerName()</a>, <a href="#type-headerValue">headerValue()</a>}</tt></li><li><tt><a name="type-headerName">headerName()</a> = string()</tt></li><li><tt><a name="type-headerValue">headerValue()</a> = string()</tt></li><li><tt><a name="type-response">response()</a> = {ok, Status, ResponseHeaders, ResponseBody} | {ibrowse_req_id, <a href="#type-req_id">req_id()</a>} | {error, Reason}</tt></li><li><tt><a name="type-req_id">req_id()</a> = term()</tt></li><li><tt>ResponseBody = string() | {file, Filename}</tt></li><li><tt>Reason = term()</tt></li></ul></p>
  169. </div><p>This is the basic function to send a HTTP request.
  170. The Status return value indicates the HTTP status code returned by the webserver</p>
  171. <h3 class="function"><a name="send_req-4">send_req/4</a></h3>
  172. <div class="spec">
  173. <p><tt>send_req(Url, Headers, Method::<a href="#type-method">method()</a>, Body::<a href="#type-body">body()</a>) -&gt; <a href="#type-response">response()</a></tt>
  174. <ul class="definitions"><li><tt><a name="type-body">body()</a> = [] | string() | binary() | <a href="#type-fun_arity_0">fun_arity_0()</a> | {<a href="#type-fun_arity_1">fun_arity_1()</a>, <a href="#type-initial_state">initial_state()</a>}</tt></li><li><tt><a name="type-initial_state">initial_state()</a> = term()</tt></li></ul></p>
  175. </div><p>Same as send_req/3.
  176. If a list is specified for the body it has to be a flat list. The body can also be a fun/0 or a fun/1. <br>
  177. If fun/0, the connection handling process will repeatdely call the fun until it returns an error or eof. <pre>Fun() = {ok, Data} | eof</pre><br>
  178. If fun/1, the connection handling process will repeatedly call the fun with the supplied state until it returns an error or eof. <pre>Fun(State) = {ok, Data} | {ok, Data, NewState} | eof</pre></p>
  179. <h3 class="function"><a name="send_req-5">send_req/5</a></h3>
  180. <div class="spec">
  181. <p><tt>send_req(Url::string(), Headers::<a href="#type-headerList">headerList()</a>, Method::<a href="#type-method">method()</a>, Body::<a href="#type-body">body()</a>, Options::<a href="#type-optionList">optionList()</a>) -&gt; <a href="#type-response">response()</a></tt>
  182. <ul class="definitions"><li><tt><a name="type-optionList">optionList()</a> = [<a href="#type-option">option()</a>]</tt></li><li><tt><a name="type-option">option()</a> = {max_sessions, integer()} | {response_format, <a href="#type-response_format">response_format()</a>} | {stream_full_chunks, boolean()} | {stream_chunk_size, integer()} | {max_pipeline_size, integer()} | {trace, boolean()} | {is_ssl, boolean()} | {ssl_options, [SSLOpt]} | {pool_name, atom()} | {proxy_host, string()} | {proxy_port, integer()} | {proxy_user, string()} | {proxy_password, string()} | {use_absolute_uri, boolean()} | {basic_auth, {<a href="#type-username">username()</a>, <a href="#type-password">password()</a>}} | {cookie, string()} | {content_length, integer()} | {content_type, string()} | {save_response_to_file, <a href="#type-srtf">srtf()</a>} | {stream_to, <a href="#type-stream_to">stream_to()</a>} | {http_vsn, {MajorVsn, MinorVsn}} | {host_header, string()} | {inactivity_timeout, integer()} | {connect_timeout, integer()} | {socket_options, Sock_opts} | {transfer_encoding, {chunked, ChunkSize}} | {headers_as_is, boolean()} | {give_raw_headers, boolean()} | {preserve_chunked_encoding, boolean()} | {workaround, head_response_with_body} | {worker_process_options, list()} | {return_raw_request, true} | {max_attempts, integer()}</tt></li><li><tt><a name="type-stream_to">stream_to()</a> = <a href="#type-process">process()</a> | {<a href="#type-process">process()</a>, once}</tt></li><li><tt><a name="type-process">process()</a> = pid() | atom()</tt></li><li><tt><a name="type-username">username()</a> = string()</tt></li><li><tt><a name="type-password">password()</a> = string()</tt></li><li><tt>SSLOpt = term()</tt></li><li><tt>Sock_opts = [Sock_opt]</tt></li><li><tt>Sock_opt = term()</tt></li><li><tt>ChunkSize = integer()</tt></li><li><tt><a name="type-srtf">srtf()</a> = boolean() | <a href="#type-filename">filename()</a> | {append, <a href="#type-filename">filename()</a>}</tt></li><li><tt><a name="type-filename">filename()</a> = string()</tt></li><li><tt><a name="type-response_format">response_format()</a> = list | binary</tt></li></ul></p>
  183. </div><p>Same as send_req/4.</p>
  184. <h3 class="function"><a name="send_req-6">send_req/6</a></h3>
  185. <div class="spec">
  186. <p><tt>send_req(Url, Headers::<a href="#type-headerList">headerList()</a>, Method::<a href="#type-method">method()</a>, Body::<a href="#type-body">body()</a>, Options::<a href="#type-optionList">optionList()</a>, Timeout) -&gt; <a href="#type-response">response()</a></tt>
  187. <ul class="definitions"><li><tt>Timeout = integer() | infinity</tt></li></ul></p>
  188. </div><p>Same as send_req/5.
  189. All timeout values are in milliseconds.</p>
  190. <h3 class="function"><a name="send_req_direct-4">send_req_direct/4</a></h3>
  191. <div class="spec">
  192. <p><tt>send_req_direct(Conn_pid, Url, Headers, Method) -&gt; any()</tt></p>
  193. </div><p>Same as send_req/3 except that the first argument is the PID
  194. returned by spawn_worker_process/2 or spawn_link_worker_process/2</p>
  195. <h3 class="function"><a name="send_req_direct-5">send_req_direct/5</a></h3>
  196. <div class="spec">
  197. <p><tt>send_req_direct(Conn_pid, Url, Headers, Method, Body) -&gt; any()</tt></p>
  198. </div><p>Same as send_req/4 except that the first argument is the PID
  199. returned by spawn_worker_process/2 or spawn_link_worker_process/2</p>
  200. <h3 class="function"><a name="send_req_direct-6">send_req_direct/6</a></h3>
  201. <div class="spec">
  202. <p><tt>send_req_direct(Conn_pid, Url, Headers, Method, Body, Options) -&gt; any()</tt></p>
  203. </div><p>Same as send_req/5 except that the first argument is the PID
  204. returned by spawn_worker_process/2 or spawn_link_worker_process/2</p>
  205. <h3 class="function"><a name="send_req_direct-7">send_req_direct/7</a></h3>
  206. <div class="spec">
  207. <p><tt>send_req_direct(Conn_pid, Url, Headers, Method, Body, Options, Timeout) -&gt; any()</tt></p>
  208. </div><p>Same as send_req/6 except that the first argument is the PID
  209. returned by spawn_worker_process/2 or spawn_link_worker_process/2</p>
  210. <h3 class="function"><a name="set_dest-3">set_dest/3</a></h3>
  211. <div class="spec">
  212. <p><tt>set_dest(Host, Port, T) -&gt; any()</tt></p>
  213. </div><p>Deprecated. Use set_max_sessions/3 and set_max_pipeline_size/3
  214. for achieving the same effect.</p>
  215. <h3 class="function"><a name="set_max_attempts-3">set_max_attempts/3</a></h3>
  216. <div class="spec">
  217. <p><tt>set_max_attempts(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt><br></p>
  218. </div><p>Set the maximum attempts for each connection to a specific Host:Port.</p>
  219. <h3 class="function"><a name="set_max_pipeline_size-3">set_max_pipeline_size/3</a></h3>
  220. <div class="spec">
  221. <p><tt>set_max_pipeline_size(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt><br></p>
  222. </div><p>Set the maximum pipeline size for each connection to a specific Host:Port.</p>
  223. <h3 class="function"><a name="set_max_sessions-3">set_max_sessions/3</a></h3>
  224. <div class="spec">
  225. <p><tt>set_max_sessions(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt><br></p>
  226. </div><p>Set the maximum number of connections allowed to a specific Host:Port.</p>
  227. <h3 class="function"><a name="show_dest_status-0">show_dest_status/0</a></h3>
  228. <div class="spec">
  229. <p><tt>show_dest_status() -&gt; any()</tt></p>
  230. </div><p>Shows some internal information about load balancing. Info
  231. about workers spawned using spawn_worker_process/2 or
  232. spawn_link_worker_process/2 is not included.</p>
  233. <h3 class="function"><a name="show_dest_status-1">show_dest_status/1</a></h3>
  234. <div class="spec">
  235. <p><tt>show_dest_status(Url) -&gt; any()</tt></p>
  236. </div>
  237. <h3 class="function"><a name="show_dest_status-2">show_dest_status/2</a></h3>
  238. <div class="spec">
  239. <p><tt>show_dest_status(Host, Port) -&gt; any()</tt></p>
  240. </div><p>Shows some internal information about load balancing to a
  241. specified Host:Port. Info about workers spawned using
  242. spawn_worker_process/2 or spawn_link_worker_process/2 is not
  243. included.</p>
  244. <h3 class="function"><a name="spawn_link_worker_process-1">spawn_link_worker_process/1</a></h3>
  245. <div class="spec">
  246. <p><tt>spawn_link_worker_process(Url::string() | {Host::string(), Port::integer()}) -&gt; {ok, pid()}</tt><br></p>
  247. </div><p>Same as spawn_worker_process/1 except the the calling process
  248. is linked to the worker process which is spawned.</p>
  249. <h3 class="function"><a name="spawn_link_worker_process-2">spawn_link_worker_process/2</a></h3>
  250. <div class="spec">
  251. <p><tt>spawn_link_worker_process(Host::string(), Port::integer()) -&gt; {ok, pid()}</tt><br></p>
  252. </div><p>Same as spawn_link_worker_process/1 except with Erlang process options.</p>
  253. <h3 class="function"><a name="spawn_worker_process-1">spawn_worker_process/1</a></h3>
  254. <div class="spec">
  255. <p><tt>spawn_worker_process(Url::string() | {Host::string(), Port::integer()}) -&gt; {ok, pid()}</tt><br></p>
  256. </div><p>Creates a HTTP client process to the specified Host:Port which
  257. is not part of the load balancing pool. This is useful in cases
  258. where some requests to a webserver might take a long time whereas
  259. some might take a very short time. To avoid getting these quick
  260. requests stuck in the pipeline behind time consuming requests, use
  261. this function to get a handle to a connection process. <br>
  262. <b>Note:</b> Calling this function only creates a worker process. No connection
  263. is setup. The connection attempt is made only when the first
  264. request is sent via any of the send_req_direct/4,5,6,7 functions.<br>
  265. <b>Note:</b> It is the responsibility of the calling process to control
  266. pipeline size on such connections.</p>
  267. <h3 class="function"><a name="spawn_worker_process-2">spawn_worker_process/2</a></h3>
  268. <div class="spec">
  269. <p><tt>spawn_worker_process(Host::string(), Port::integer()) -&gt; {ok, pid()}</tt><br></p>
  270. </div><p>Same as spawn_worker_process/1 except with Erlang process options.</p>
  271. <h3 class="function"><a name="start-0">start/0</a></h3>
  272. <div class="spec">
  273. <p><tt>start() -&gt; any()</tt></p>
  274. </div><p>Starts the ibrowse process without linking. Useful when testing using the shell</p>
  275. <h3 class="function"><a name="start_link-0">start_link/0</a></h3>
  276. <div class="spec">
  277. <p><tt>start_link() -&gt; {ok, pid()}</tt><br></p>
  278. </div><p>Starts the ibrowse process linked to the calling process. Usually invoked by the supervisor ibrowse_sup</p>
  279. <h3 class="function"><a name="stop-0">stop/0</a></h3>
  280. <div class="spec">
  281. <p><tt>stop() -&gt; any()</tt></p>
  282. </div><p>Stop the ibrowse process. Useful when testing using the shell.</p>
  283. <h3 class="function"><a name="stop_worker_process-1">stop_worker_process/1</a></h3>
  284. <div class="spec">
  285. <p><tt>stop_worker_process(Conn_pid::pid()) -&gt; ok</tt><br></p>
  286. </div><p>Terminate a worker process spawned using
  287. spawn_worker_process/2 or spawn_link_worker_process/2. Requests in
  288. progress will get the error response <pre>{error, closing_on_request}</pre></p>
  289. <h3 class="function"><a name="stream_close-1">stream_close/1</a></h3>
  290. <div class="spec">
  291. <p><tt>stream_close(Req_id::<a href="#type-req_id">req_id()</a>) -&gt; ok | {error, unknown_req_id}</tt><br></p>
  292. </div><p>Tell ibrowse to close the connection associated with the
  293. specified stream. Should be used in conjunction with the
  294. <code>stream_to</code> option. Note that all requests in progress on
  295. the connection which is serving this Req_id will be aborted, and an
  296. error returned.</p>
  297. <h3 class="function"><a name="stream_next-1">stream_next/1</a></h3>
  298. <div class="spec">
  299. <p><tt>stream_next(Req_id::<a href="#type-req_id">req_id()</a>) -&gt; ok | {error, unknown_req_id}</tt><br></p>
  300. </div><p>Tell ibrowse to stream the next chunk of data to the
  301. caller. Should be used in conjunction with the
  302. <code>stream_to</code> option</p>
  303. <h3 class="function"><a name="terminate-2">terminate/2</a></h3>
  304. <div class="spec">
  305. <p><tt>terminate(Reason, State) -&gt; any()</tt></p>
  306. </div>
  307. <h3 class="function"><a name="trace_off-0">trace_off/0</a></h3>
  308. <div class="spec">
  309. <p><tt>trace_off() -&gt; any()</tt></p>
  310. </div><p>Turn tracing off for the ibrowse process</p>
  311. <h3 class="function"><a name="trace_off-2">trace_off/2</a></h3>
  312. <div class="spec">
  313. <p><tt>trace_off(Host, Port) -&gt; ok</tt><br></p>
  314. </div><p>Turn tracing OFF for all connections to the specified HTTP
  315. server.</p>
  316. <h3 class="function"><a name="trace_on-0">trace_on/0</a></h3>
  317. <div class="spec">
  318. <p><tt>trace_on() -&gt; any()</tt></p>
  319. </div><p>Turn tracing on for the ibrowse process</p>
  320. <h3 class="function"><a name="trace_on-2">trace_on/2</a></h3>
  321. <div class="spec">
  322. <p><tt>trace_on(Host, Port) -&gt; ok</tt>
  323. <ul class="definitions"><li><tt>Host = string()</tt></li><li><tt>Port = integer()</tt></li></ul></p>
  324. </div><p>Turn tracing on for all connections to the specified HTTP
  325. server. Host is whatever is specified as the domain name in the URL</p>
  326. <hr>
  327. <div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  328. <p><i>Generated by EDoc, Nov 6 2015, 11:40:24.</i></p>
  329. </body>
  330. </html>