Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

416 linhas
24 KiB

há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
há 18 anos
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Module ibrowse</title>
  5. <link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
  6. </head>
  7. <body bgcolor="white">
  8. <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>
  9. <hr>
  10. <h1>Module ibrowse</h1>
  11. <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.
  12. <p>Copyright � 2005-2009 Chandrashekhar Mullaparthi</p>
  13. <p><b>Version:</b> 1.5.1</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. 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. <p><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></p>
  51. <p>A driver exists which implements URL encoding in C, but the
  52. speed achieved using only erlang has been good enough, so the
  53. driver isn't actually used.</p>
  54. <h2><a name="index">Function Index</a></h2>
  55. <table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#all_trace_off-0">all_trace_off/0</a></td><td>Turn Off ALL tracing.</td></tr>
  56. <tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td></td></tr>
  57. <tr><td valign="top"><a href="#get_config_value-1">get_config_value/1</a></td><td>Internal export.</td></tr>
  58. <tr><td valign="top"><a href="#get_config_value-2">get_config_value/2</a></td><td>Internal export.</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_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>
  80. <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>
  81. <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
  82. specified Host:Port.</td></tr>
  83. <tr><td valign="top"><a href="#spawn_link_worker_process-2">spawn_link_worker_process/2</a></td><td>Same as spawn_worker_process/2 except the the calling process
  84. is linked to the worker process which is spawned.</td></tr>
  85. <tr><td valign="top"><a href="#spawn_worker_process-2">spawn_worker_process/2</a></td><td>Creates a HTTP client process to the specified Host:Port which
  86. is not part of the load balancing pool.</td></tr>
  87. <tr><td valign="top"><a href="#start-0">start/0</a></td><td>Starts the ibrowse process without linking.</td></tr>
  88. <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>
  89. <tr><td valign="top"><a href="#stop-0">stop/0</a></td><td>Stop the ibrowse process.</td></tr>
  90. <tr><td valign="top"><a href="#stop_worker_process-1">stop_worker_process/1</a></td><td>Terminate a worker process spawned using
  91. spawn_worker_process/2 or spawn_link_worker_process/2.</td></tr>
  92. <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
  93. caller.</td></tr>
  94. <tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td></td></tr>
  95. <tr><td valign="top"><a href="#trace_off-0">trace_off/0</a></td><td>Turn tracing off for the ibrowse process.</td></tr>
  96. <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
  97. server.</td></tr>
  98. <tr><td valign="top"><a href="#trace_on-0">trace_on/0</a></td><td>Turn tracing on for the ibrowse process.</td></tr>
  99. <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
  100. server.</td></tr>
  101. </table>
  102. <h2><a name="functions">Function Details</a></h2>
  103. <h3 class="function"><a name="all_trace_off-0">all_trace_off/0</a></h3>
  104. <div class="spec">
  105. <p><tt>all_trace_off() -&gt; ok</tt></p>
  106. </div><p>Turn Off ALL tracing</p>
  107. <h3 class="function"><a name="code_change-3">code_change/3</a></h3>
  108. <div class="spec">
  109. <p><tt>code_change(OldVsn, State, Extra) -&gt; any()</tt></p>
  110. </div>
  111. <h3 class="function"><a name="get_config_value-1">get_config_value/1</a></h3>
  112. <div class="spec">
  113. <p><tt>get_config_value(Key) -&gt; any()</tt></p>
  114. </div><p>Internal export</p>
  115. <h3 class="function"><a name="get_config_value-2">get_config_value/2</a></h3>
  116. <div class="spec">
  117. <p><tt>get_config_value(Key, DefVal) -&gt; any()</tt></p>
  118. </div><p>Internal export</p>
  119. <h3 class="function"><a name="handle_call-3">handle_call/3</a></h3>
  120. <div class="spec">
  121. <p><tt>handle_call(Request, From, State) -&gt; any()</tt></p>
  122. </div>
  123. <h3 class="function"><a name="handle_cast-2">handle_cast/2</a></h3>
  124. <div class="spec">
  125. <p><tt>handle_cast(Msg, State) -&gt; any()</tt></p>
  126. </div>
  127. <h3 class="function"><a name="handle_info-2">handle_info/2</a></h3>
  128. <div class="spec">
  129. <p><tt>handle_info(Info, State) -&gt; any()</tt></p>
  130. </div>
  131. <h3 class="function"><a name="init-1">init/1</a></h3>
  132. <div class="spec">
  133. <p><tt>init(X1) -&gt; any()</tt></p>
  134. </div>
  135. <h3 class="function"><a name="rescan_config-0">rescan_config/0</a></h3>
  136. <div class="spec">
  137. <p><tt>rescan_config() -&gt; any()</tt></p>
  138. </div><p>Clear current configuration for ibrowse and load from the file
  139. ibrowse.conf in the IBROWSE_EBIN/../priv directory. Current
  140. configuration is cleared only if the ibrowse.conf file is readable
  141. using file:consult/1</p>
  142. <h3 class="function"><a name="rescan_config-1">rescan_config/1</a></h3>
  143. <div class="spec">
  144. <p><tt>rescan_config(File) -&gt; any()</tt></p>
  145. </div>
  146. <h3 class="function"><a name="send_req-3">send_req/3</a></h3>
  147. <div class="spec">
  148. <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>
  149. <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>
  150. <li><tt><a name="type-header">header()</a> = atom() | string()</tt></li>
  151. <li><tt><a name="type-value">value()</a> = term()</tt></li>
  152. <li><tt><a name="type-method">method()</a> = get | post | head | options | put | delete | trace | mkcol | propfind | proppatch | lock | unlock | move | copy</tt></li>
  153. <li><tt>Status = string()</tt></li>
  154. <li><tt>ResponseHeaders = [<a href="#type-respHeader">respHeader()</a>]</tt></li>
  155. <li><tt><a name="type-respHeader">respHeader()</a> = {<a href="#type-headerName">headerName()</a>, <a href="#type-headerValue">headerValue()</a>}</tt></li>
  156. <li><tt><a name="type-headerName">headerName()</a> = string()</tt></li>
  157. <li><tt><a name="type-headerValue">headerValue()</a> = string()</tt></li>
  158. <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>
  159. <li><tt><a name="type-req_id">req_id()</a> = term()</tt></li>
  160. <li><tt>ResponseBody = string() | {file, Filename}</tt></li>
  161. <li><tt>Reason = term()</tt></li>
  162. </ul></p>
  163. </div><p>This is the basic function to send a HTTP request.
  164. The Status return value indicates the HTTP status code returned by the webserver</p>
  165. <h3 class="function"><a name="send_req-4">send_req/4</a></h3>
  166. <div class="spec">
  167. <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>
  168. <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>
  169. <li><tt><a name="type-initial_state">initial_state()</a> = term()</tt></li>
  170. </ul></p>
  171. </div><p>Same as send_req/3.
  172. 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>
  173. 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>
  174. 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>
  175. <h3 class="function"><a name="send_req-5">send_req/5</a></h3>
  176. <div class="spec">
  177. <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>
  178. <ul class="definitions"><li><tt><a name="type-optionList">optionList()</a> = [<a href="#type-option">option()</a>]</tt></li>
  179. <li><tt><a name="type-option">option()</a> = {max_sessions, integer()} | {response_format, <a href="#type-response_format">response_format()</a>} | {stream_chunk_size, integer()} | {max_pipeline_size, integer()} | {trace, <a href="#type-boolean">boolean()</a>} | {is_ssl, <a href="#type-boolean">boolean()</a>} | {ssl_options, [SSLOpt]} | {pool_name, atom()} | {proxy_host, string()} | {proxy_port, integer()} | {proxy_user, string()} | {proxy_password, string()} | {use_absolute_uri, <a href="#type-boolean">boolean()</a>} | {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()} | {transfer_encoding, {chunked, ChunkSize}}</tt></li>
  180. <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>
  181. <li><tt><a name="type-process">process()</a> = pid() | atom()</tt></li>
  182. <li><tt><a name="type-username">username()</a> = string()</tt></li>
  183. <li><tt><a name="type-password">password()</a> = string()</tt></li>
  184. <li><tt>SSLOpt = term()</tt></li>
  185. <li><tt>ChunkSize = integer()</tt></li>
  186. <li><tt><a name="type-srtf">srtf()</a> = <a href="#type-boolean">boolean()</a> | <a href="#type-filename">filename()</a></tt></li>
  187. <li><tt><a name="type-filename">filename()</a> = string()</tt></li>
  188. <li><tt><a name="type-response_format">response_format()</a> = list | binary</tt></li>
  189. </ul></p>
  190. </div><p>Same as send_req/4.
  191. For a description of SSL Options, look in the <a href="http://www.erlang.org/doc/apps/ssl/index.html">ssl</a> manpage. If the
  192. HTTP Version to use is not specified, the default is 1.1.
  193. <br>
  194. <p>The <code>host_header</code> option is useful in the case where ibrowse is
  195. connecting to a component such as <a href="http://www.stunnel.org">stunnel</a> which then sets up a
  196. secure connection to a webserver. In this case, the URL supplied to
  197. ibrowse must have the stunnel host/port details, but that won't
  198. make sense to the destination webserver. This option can then be
  199. used to specify what should go in the <code>Host</code> header in
  200. the request.</p>
  201. <ul>
  202. <li>The <code>stream_to</code> option can be used to have the HTTP
  203. response streamed to a process as messages as data arrives on the
  204. socket. If the calling process wishes to control the rate at which
  205. data is received from the server, the option <code>{stream_to,
  206. {process(), once}}</code> can be specified. The calling process
  207. will have to invoke <code>ibrowse:stream_next(Request_id)</code> to
  208. receive the next packet.</li>
  209. <li>When both the options <code>save_response_to_file</code> and <code>stream_to</code>
  210. are specified, the former takes precedence.</li>
  211. <li>For the <code>save_response_to_file</code> option, the response body is saved to
  212. file only if the status code is in the 200-299 range. If not, the response body is returned
  213. as a string.</li>
  214. <li>Whenever an error occurs in the processing of a request, ibrowse will return as much
  215. information as it has, such as HTTP Status Code and HTTP Headers. When this happens, the response
  216. is of the form <code>{error, {Reason, {stat_code, StatusCode}, HTTP_headers}}</code></li>
  217. <li>The <code>inactivity_timeout</code> option is useful when
  218. dealing with large response bodies and/or slow links. In these
  219. cases, it might be hard to estimate how long a request will take to
  220. complete. In such cases, the client might want to timeout if no
  221. data has been received on the link for a certain time interval.</li>
  222. <li>
  223. The <code>connect_timeout</code> option is to specify how long the
  224. client process should wait for connection establishment. This is
  225. useful in scenarios where connections to servers are usually setup
  226. very fast, but responses might take much longer compared to
  227. connection setup. In such cases, it is better for the calling
  228. process to timeout faster if there is a problem (DNS lookup
  229. delays/failures, network routing issues, etc). The total timeout
  230. value specified for the request will enforced. To illustrate using
  231. an example:
  232. <code>
  233. ibrowse:send_req("http://www.example.com/cgi-bin/request", [], get, [], [{connect_timeout, 100}], 1000).
  234. </code>
  235. In the above invocation, if the connection isn't established within
  236. 100 milliseconds, the request will fail with
  237. <code>{error, conn_failed}</code>.<br>
  238. If connection setup succeeds, the total time allowed for the
  239. request to complete will be 1000 milliseconds minus the time taken
  240. for connection setup.
  241. </li>
  242. </ul>
  243. </p>
  244. <h3 class="function"><a name="send_req-6">send_req/6</a></h3>
  245. <div class="spec">
  246. <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>
  247. <ul class="definitions"><li><tt>Timeout = integer() | infinity</tt></li>
  248. </ul></p>
  249. </div><p>Same as send_req/5.
  250. All timeout values are in milliseconds.</p>
  251. <h3 class="function"><a name="send_req_direct-4">send_req_direct/4</a></h3>
  252. <div class="spec">
  253. <p><tt>send_req_direct(Conn_pid, Url, Headers, Method) -&gt; any()</tt></p>
  254. </div><p>Same as send_req/3 except that the first argument is the PID
  255. returned by spawn_worker_process/2 or spawn_link_worker_process/2</p>
  256. <h3 class="function"><a name="send_req_direct-5">send_req_direct/5</a></h3>
  257. <div class="spec">
  258. <p><tt>send_req_direct(Conn_pid, Url, Headers, Method, Body) -&gt; any()</tt></p>
  259. </div><p>Same as send_req/4 except that the first argument is the PID
  260. returned by spawn_worker_process/2 or spawn_link_worker_process/2</p>
  261. <h3 class="function"><a name="send_req_direct-6">send_req_direct/6</a></h3>
  262. <div class="spec">
  263. <p><tt>send_req_direct(Conn_pid, Url, Headers, Method, Body, Options) -&gt; any()</tt></p>
  264. </div><p>Same as send_req/5 except that the first argument is the PID
  265. returned by spawn_worker_process/2 or spawn_link_worker_process/2</p>
  266. <h3 class="function"><a name="send_req_direct-7">send_req_direct/7</a></h3>
  267. <div class="spec">
  268. <p><tt>send_req_direct(Conn_pid, Url, Headers, Method, Body, Options, Timeout) -&gt; any()</tt></p>
  269. </div><p>Same as send_req/6 except that the first argument is the PID
  270. returned by spawn_worker_process/2 or spawn_link_worker_process/2</p>
  271. <h3 class="function"><a name="set_dest-3">set_dest/3</a></h3>
  272. <div class="spec">
  273. <p><tt>set_dest(Host, Port, T) -&gt; any()</tt></p>
  274. </div><p>Deprecated. Use set_max_sessions/3 and set_max_pipeline_size/3
  275. for achieving the same effect.</p>
  276. <h3 class="function"><a name="set_max_pipeline_size-3">set_max_pipeline_size/3</a></h3>
  277. <div class="spec">
  278. <p><tt>set_max_pipeline_size(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt></p>
  279. </div><p>Set the maximum pipeline size for each connection to a specific Host:Port.</p>
  280. <h3 class="function"><a name="set_max_sessions-3">set_max_sessions/3</a></h3>
  281. <div class="spec">
  282. <p><tt>set_max_sessions(Host::string(), Port::integer(), Max::integer()) -&gt; ok</tt></p>
  283. </div><p>Set the maximum number of connections allowed to a specific Host:Port.</p>
  284. <h3 class="function"><a name="show_dest_status-2">show_dest_status/2</a></h3>
  285. <div class="spec">
  286. <p><tt>show_dest_status(Host, Port) -&gt; any()</tt></p>
  287. </div><p>Shows some internal information about load balancing to a
  288. specified Host:Port. Info about workers spawned using
  289. spawn_worker_process/2 or spawn_link_worker_process/2 is not
  290. included.</p>
  291. <h3 class="function"><a name="spawn_link_worker_process-2">spawn_link_worker_process/2</a></h3>
  292. <div class="spec">
  293. <p><tt>spawn_link_worker_process(Host, Port) -&gt; any()</tt></p>
  294. </div><p>Same as spawn_worker_process/2 except the the calling process
  295. is linked to the worker process which is spawned.</p>
  296. <h3 class="function"><a name="spawn_worker_process-2">spawn_worker_process/2</a></h3>
  297. <div class="spec">
  298. <p><tt>spawn_worker_process(Host::string(), Port::integer()) -&gt; {ok, pid()}</tt></p>
  299. </div><p>Creates a HTTP client process to the specified Host:Port which
  300. is not part of the load balancing pool. This is useful in cases
  301. where some requests to a webserver might take a long time whereas
  302. some might take a very short time. To avoid getting these quick
  303. requests stuck in the pipeline behind time consuming requests, use
  304. this function to get a handle to a connection process. <br>
  305. <b>Note:</b> Calling this function only creates a worker process. No connection
  306. is setup. The connection attempt is made only when the first
  307. request is sent via any of the send_req_direct/4,5,6,7 functions.<br>
  308. <b>Note:</b> It is the responsibility of the calling process to control
  309. pipeline size on such connections.
  310. </p>
  311. <h3 class="function"><a name="start-0">start/0</a></h3>
  312. <div class="spec">
  313. <p><tt>start() -&gt; any()</tt></p>
  314. </div><p>Starts the ibrowse process without linking. Useful when testing using the shell</p>
  315. <h3 class="function"><a name="start_link-0">start_link/0</a></h3>
  316. <div class="spec">
  317. <p><tt>start_link() -&gt; {ok, pid()}</tt></p>
  318. </div><p>Starts the ibrowse process linked to the calling process. Usually invoked by the supervisor ibrowse_sup</p>
  319. <h3 class="function"><a name="stop-0">stop/0</a></h3>
  320. <div class="spec">
  321. <p><tt>stop() -&gt; any()</tt></p>
  322. </div><p>Stop the ibrowse process. Useful when testing using the shell.</p>
  323. <h3 class="function"><a name="stop_worker_process-1">stop_worker_process/1</a></h3>
  324. <div class="spec">
  325. <p><tt>stop_worker_process(Conn_pid::pid()) -&gt; ok</tt></p>
  326. </div><p>Terminate a worker process spawned using
  327. spawn_worker_process/2 or spawn_link_worker_process/2. Requests in
  328. progress will get the error response <pre>{error, closing_on_request}</pre></p>
  329. <h3 class="function"><a name="stream_next-1">stream_next/1</a></h3>
  330. <div class="spec">
  331. <p><tt>stream_next(Req_id::<a href="#type-req_id">req_id()</a>) -&gt; ok | {error, unknown_req_id}</tt></p>
  332. </div><p>Tell ibrowse to stream the next chunk of data to the
  333. caller. Should be used in conjunction with the
  334. <code>stream_to</code> option</p>
  335. <h3 class="function"><a name="terminate-2">terminate/2</a></h3>
  336. <div class="spec">
  337. <p><tt>terminate(Reason, State) -&gt; any()</tt></p>
  338. </div>
  339. <h3 class="function"><a name="trace_off-0">trace_off/0</a></h3>
  340. <div class="spec">
  341. <p><tt>trace_off() -&gt; any()</tt></p>
  342. </div><p>Turn tracing off for the ibrowse process</p>
  343. <h3 class="function"><a name="trace_off-2">trace_off/2</a></h3>
  344. <div class="spec">
  345. <p><tt>trace_off(Host, Port) -&gt; ok</tt></p>
  346. </div><p>Turn tracing OFF for all connections to the specified HTTP
  347. server.</p>
  348. <h3 class="function"><a name="trace_on-0">trace_on/0</a></h3>
  349. <div class="spec">
  350. <p><tt>trace_on() -&gt; any()</tt></p>
  351. </div><p>Turn tracing on for the ibrowse process</p>
  352. <h3 class="function"><a name="trace_on-2">trace_on/2</a></h3>
  353. <div class="spec">
  354. <p><tt>trace_on(Host, Port) -&gt; ok</tt>
  355. <ul class="definitions"><li><tt>Host = string()</tt></li>
  356. <li><tt>Port = integer()</tt></li>
  357. </ul></p>
  358. </div><p>Turn tracing on for all connections to the specified HTTP
  359. server. Host is whatever is specified as the domain name in the URL</p>
  360. <hr>
  361. <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>
  362. <p><i>Generated by EDoc, Jul 7 2009, 23:13:24.</i></p>
  363. </body>
  364. </html>