File: Http_client.html

package info (click to toggle)
netclient 0.91-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,096 kB
  • ctags: 1,539
  • sloc: ml: 8,808; sh: 527; makefile: 203
file content (509 lines) | stat: -rw-r--r-- 32,213 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="Start" href="index.html">
<link rel="previous" href="Ftp_data_endpoint.html">
<link rel="next" href="Http_client_mt.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of class types" rel=Appendix href="index_class_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Ftp_client" rel="Chapter" href="Ftp_client.html">
<link title="Ftp_data_endpoint" rel="Chapter" href="Ftp_data_endpoint.html">
<link title="Http_client" rel="Chapter" href="Http_client.html">
<link title="Http_client_mt" rel="Chapter" href="Http_client_mt.html">
<link title="Telnet_client" rel="Chapter" href="Telnet_client.html"><link title="Types and Exceptions" rel="Section" href="#1_TypesandExceptions">
<link title="HTTP methods" rel="Section" href="#1_HTTPmethods">
<link title="Authentication" rel="Section" href="#1_Authentication">
<link title="Pipelines" rel="Section" href="#1_Pipelines">
<link title="Convenience module for simple applications" rel="Section" href="#1_Conveniencemoduleforsimpleapplications">
<title>The Netclient Manual : Http_client</title>
</head>
<body>
<div class="navbar"><a href="Ftp_data_endpoint.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="Http_client_mt.html">Next</a>
</div>
<center><h1>Module <a href="type_Http_client.html">Http_client</a></h1></center>
<br>
<pre><span class="keyword">module</span> Http_client: <code class="code">sig</code> <a href="Http_client.html">..</a> <code class="code">end</code></pre>HTTP 1.1 client<br>
<hr width="100%">
<br>
<b>Note for beginners:</b> There is a simplified interface called
 <a href="Http_client.Convenience.html"><code class="code">Http_client.Convenience</code></a>.<br>
<br>
Implements much of HTTP/1.1.
 Implements the following advanced features:<ul>
<li>chunked messages</li>
<li>persistent connections</li>
<li>connections in pipelining mode ("full duplex" connections)</li>
<li>modular authentication methods, currently Basic and Digest</li>
<li>event-driven implementation; allows concurrent service for
    several network connections </li>
</ul>

 Left out:<ul>
<li>multipart messages, including multipart/byterange</li>
<li>content encoding (compression)    (1)</li>
<li>content digests specified by RFC 2068 and 2069   (1)</li>
<li>content negotiation   (1)</li>
<li>conditional and partial GET   (1)</li>
<li>following code 303 redirections automatically    (1)</li>
<li>client-side caching   (1)</li>
<li>HTTP/0.9 compatibility</li>
</ul>

 (1) These features can be implemented on top of this module if really needed,
     but there is no special support for them.<br>
<br>
<b>Thread safety</b>
<p>

 The module can be compiled such that it is thread-safe. In particular,
 one has to link the http_client_mt.cm<code class="code">xo</code> object, and thread-safety is
 restricted to the following kinds of usage:<ul>
<li>The golden rule is that threads must not share pipeline objects.
   If every thread uses its own pipeline, every thread will have its own
   set of state variables.
   It is not detected if two threads errornously share a pipeline,
   neither by an error message nor by implicit serialization. Strange
   things may happen.</li>
<li>The same applies to the other objects, e.g. http_call objects</li>
<li>The <code class="code">Convenience</code> module even serializes; see below.</li>
</ul>
<br>
<br>
<a name="1_TypesandExceptions"></a>
<h1>Types and Exceptions</h1><br>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONBad_message"></a>Bad_message <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info">
The server sent a message which cannot be interpreted. The string
 indicates the reason.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONHttp_error"></a>Http_error <span class="keyword">of</span> <code class="type">(int * string)</code></pre>
<div class="info">
<b>Deprecated.</b> 
 The server sent an error message. The left component of the pair is
 the error code, the right component is the error text.
 This exception is only used by <code class="code">get_resp_body</code>.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONNo_reply"></a>No_reply</pre>
<div class="info">
There was no response to the request because some other request failed
 earlier and it was not allowed to send the request again.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONToo_many_redirections"></a>Too_many_redirections</pre>
<div class="info">
While following redirections the limit has been reached<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONHttp_protocol"></a>Http_protocol <span class="keyword">of</span> <code class="type">exn</code></pre>
<div class="info">
The request could not be processed because the exception condition 
 was raised.<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPEstatus"></a><code class="type"></code>status = <code class="type">[ `Client_error<br>       | `Http_protocol_error of exn<br>       | `Redirection<br>       | `Server_error<br>       | `Successful<br>       | `Unserved ]</code> </pre>
<div class="info">
Condensed status information of a HTTP call:<ul>
<li><code class="code">`Unserved</code>: The call has not yet been finished</li>
<li><code class="code">`HTTP_protocol_error e</code>: An error on HTTP level occurred. Corresponds
   to the exception <code class="code">Http_protocol</code>.</li>
<li><code class="code">`Successful</code>: The call is successful, and the response code is between
   200 and 299.</li>
<li><code class="code">`Redirection</code>: The call is successful, and the response code is
   between 300 and 399.</li>
<li><code class="code">`Client_error</code>: The call failed with a response code between 400 and
   499.</li>
<li><code class="code">`Server_error</code>: The call failed for any other reason.</li>
</ul>
<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEhow_to_reconnect"></a><code class="type">'a</code> how_to_reconnect = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Send_again</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Send the request automatically again</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Request_fails</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Drop the request</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Inquire</span> <span class="keyword">of</span> <code class="type">('a -> bool)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>If the function return <code class="code">true</code> send again, otherwise
 drop the request.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Send_again_if_idem</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Default behaviour: <code class="code">Send_again</code> for idempotent 
 methods (GET, HEAD), <code class="code">Request_fails</code> for the rest</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info">
How to deal with automatic reconnections, especially when the
 connection crashes.<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEhow_to_redirect"></a><code class="type">'a</code> how_to_redirect = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Redirect</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Perform the redirection</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Do_not_redirect</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>No redirection</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Redirect_inquire</span> <span class="keyword">of</span> <code class="type">('a -> bool)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>If the function return <code class="code">true</code> redirect, otherwise
 do not redirect</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Redirect_if_idem</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Default behaviour: <code class="code">Redirect</code> for idempotent 
 methods (GET, HEAD), <code class="code">Do_not_redirect</code> for the rest</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>


<pre><span class="keyword">type</span> <a name="TYPEprivate_api"></a><code class="type"></code>private_api </pre>
<div class="info">
The private part of the <code class="code">http_call</code> class type<br>
</div>

<pre><span class="keyword">type</span> <a name="TYPEresponse_body_storage"></a><code class="type"></code>response_body_storage = <code class="type">[ `Body of unit -> Netmime.mime_body | `File of unit -> string | `Memory ]</code> </pre>
<div class="info">
How to create the response body:<ul>
<li><code class="code">`Memory</code>: The response body is in-memory</li>
<li><code class="code">`File f</code>: The response body is stored into the file whose name
   is returned by <code class="code">f()</code></li>
<li><code class="code">`Body f</code>: The response body is stored into the object returned
   by <code class="code">f()</code></li>
</ul>
<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEsynchronization"></a><code class="type"></code>synchronization = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Sync</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The next request begins after the response of the last request has
 been received.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Pipeline</span> <span class="keyword">of</span> <code class="type">int</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The client is allowed to send several requests without waiting
 for responses. The number is the maximum number of unreplied
 requests that are allowed. A typical value: 5.
 If you increase this value, the risk becomes higher that requests
 must be repeatedly sent to the server in the case the connection
 crashes. Increasing is recommended if you send a bigger number of
 GET or HEAD requests to the server. Decreasing is recommended if you
 send large POST or PUT requests to the server.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info">
This type determines whether to keep requests and responses 
 synchronized or not.
<p>

 The first request/response round is always done in
 Sync mode, because the protocol version of the other side
 is not known at that moment. <code class="code">Pipeline</code> requires HTTP/1.1.
<p>

 In previous versions of netclient there was a third option,
 <code class="code">Sync_with_handshake_before_request_body</code>. This option is no
 longer necessary because the HTTP specification has been updated
 in the meantime, and there is a better mechanism now (the
 <code class="code">Expect</code> header is set).<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEhttp_options"></a><code class="type"></code>http_options = {</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>synchronization&nbsp;: <code class="type"><a href="Http_client.html#TYPEsynchronization">synchronization</a></code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Default: <code class="code">Pipeline 5</code>.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>maximum_connection_failures&nbsp;: <code class="type">int</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>This option limits the number of connection attempts.
 Default: 5</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>maximum_message_errors&nbsp;: <code class="type">int</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>This option limits the number of protocol errors tolerated per
 request. If a request leads to a protocol error, the connection
 is shut down, the server is connected again, and the request is
 tried again (if the kind of the message allows retransmission).
 If a request repeatedly fails, this option limits the number
 of retransmissions.
 Default: 2</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>inhibit_persistency&nbsp;: <code class="type">bool</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>This option turns persistent connections off.
 Default: <code class="code">false</code>
 It is normally not necessary to change this option.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>connection_timeout&nbsp;: <code class="type">float</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>If there is no network transmission for this period of time,
 the connection is shut down, and tried again.
 Default: 300.0 (seconds)
 It may be necessary to increase this value if HTTP is used for
 batch applications that contact extremely slow services.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>number_of_parallel_connections&nbsp;: <code class="type">int</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The client keeps up to this number of parallel connections to
 a single content server or proxy.
 Default: 2
 You may increase this value if you are mainly connected with
 an HTTP/1.0 proxy.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>maximum_redirections&nbsp;: <code class="type">int</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The maximum number of redirections per message</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>handshake_timeout&nbsp;: <code class="type">float</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The timeout when waiting for "100 Continue". Default: 1.0</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>verbose_status&nbsp;: <code class="type">bool</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>verbose_request_header&nbsp;: <code class="type">bool</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>verbose_response_header&nbsp;: <code class="type">bool</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>verbose_request_contents&nbsp;: <code class="type">bool</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>verbose_response_contents&nbsp;: <code class="type">bool</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>verbose_connection&nbsp;: <code class="type">bool</code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Enable various debugging message types.<ul>
<li><code class="code">verbose_status</code>: reports about status of received documents</li>
<li><code class="code">verbose_request_header</code>: prints the header sent to the server</li>
<li><code class="code">verbose_request_contents</code>: prints the document sent to the server</li>
<li><code class="code">verbose_response_header</code>: prints the header of the answer from the server</li>
<li><code class="code">verbose_response_contents</code>: prints the document received from the server</li>
<li><code class="code">verbose_connection</code>: reports many connection events; authentication,
   too.</li>
</ul>
</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
}

<div class="info">
Options for the whole pipeline<br>
</div>

<pre><span class="keyword">type</span> <a name="TYPEheader_kind"></a><code class="type"></code>header_kind = <code class="type">[ `Base | `Effective ]</code> </pre>
<div class="info">
The <code class="code">`Base</code> header is set by the user of <code class="code">http_call</code> and is never
 changed during processing the call. The <code class="code">`Effective</code> header is a copy
 of the base header at the time the request is sent. The effective header
 contains additions like <code class="code">Content-length</code> and authentication info.<br>
</div>

<pre><span class="keyword">class type</span> <a name="TYPEhttp_call"></a><a href="Http_client.http_call.html">http_call</a> = <code class="code">object</code> <a href="Http_client.http_call.html">..</a> <code class="code">end</code></pre><div class="info">
The container for HTTP calls
</div>
<br>
<a name="1_HTTPmethods"></a>
<h1>HTTP methods</h1><br>
<pre><span class="keyword">class</span> <a name="TYPEgeneric_call"></a><span class="keyword">virtual</span> <a href="Http_client.generic_call.html">generic_call</a> : <code class="type"></code><code class="code">object</code> <a href="Http_client.generic_call.html">..</a> <code class="code">end</code></pre><div class="info">
This class is an implementation of <code class="code">http_call</code>.
</div>
<br>
The following classes are implementations for the various HTTP
 methods. These classes do not initialize the call object.<br>
<pre><span class="keyword">class</span> <a name="TYPEget_call"></a><a href="Http_client.get_call.html">get_call</a> : <code class="type"></code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><pre><span class="keyword">class</span> <a name="TYPEtrace_call"></a><a href="Http_client.trace_call.html">trace_call</a> : <code class="type"></code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><pre><span class="keyword">class</span> <a name="TYPEoptions_call"></a><a href="Http_client.options_call.html">options_call</a> : <code class="type"></code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><pre><span class="keyword">class</span> <a name="TYPEhead_call"></a><a href="Http_client.head_call.html">head_call</a> : <code class="type"></code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><pre><span class="keyword">class</span> <a name="TYPEpost_call"></a><a href="Http_client.post_call.html">post_call</a> : <code class="type"></code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><pre><span class="keyword">class</span> <a name="TYPEput_call"></a><a href="Http_client.put_call.html">put_call</a> : <code class="type"></code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><pre><span class="keyword">class</span> <a name="TYPEdelete_call"></a><a href="Http_client.delete_call.html">delete_call</a> : <code class="type"></code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><br>
The following classes initialize the request message of the
 call (header and body). 
 These classes are also backward compatible to the classes
 found in earlier versions of netclient.<br>
<pre><span class="keyword">class</span> <a name="TYPEget"></a><a href="Http_client.get.html">get</a> : <code class="type">string -> </code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><div class="info">
Argument: URI
</div>
<pre><span class="keyword">class</span> <a name="TYPEtrace"></a><a href="Http_client.trace.html">trace</a> : <code class="type">string -> int -> </code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><div class="info">
Arguments: URI, maximum number of hops
</div>
<pre><span class="keyword">class</span> <a name="TYPEoptions"></a><a href="Http_client.options.html">options</a> : <code class="type">string -> </code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><div class="info">
Argument: URI or "*"
</div>
<pre><span class="keyword">class</span> <a name="TYPEhead"></a><a href="Http_client.head.html">head</a> : <code class="type">string -> </code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><div class="info">
Argument: URI
</div>
<pre><span class="keyword">class</span> <a name="TYPEpost"></a><a href="Http_client.post.html">post</a> : <code class="type">string -> (string * string) list -> </code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><div class="info">
Arguments: URI, parameter list to be transferred as
 application/x-www-form-urlencoded body
</div>
<pre><span class="keyword">class</span> <a name="TYPEpost_raw"></a><a href="Http_client.post_raw.html">post_raw</a> : <code class="type">string -> string -> </code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><div class="info">
Arguments: URI, body
</div>
<pre><span class="keyword">class</span> <a name="TYPEput"></a><a href="Http_client.put.html">put</a> : <code class="type">string -> string -> </code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><div class="info">
Arguments: URI, body
</div>
<pre><span class="keyword">class</span> <a name="TYPEdelete"></a><a href="Http_client.delete.html">delete</a> : <code class="type">string -> </code><code class="type"><a href="Http_client.http_call.html">http_call</a></code></pre><div class="info">
Argument: URI
</div>
<br>
<a name="1_Authentication"></a>
<h1>Authentication</h1><br>
<pre><span class="keyword">class type</span> <a name="TYPEkey"></a><a href="Http_client.key.html">key</a> = <code class="code">object</code> <a href="Http_client.key.html">..</a> <code class="code">end</code></pre><div class="info">
A <code class="code">key</code> is a user/password combination for a certain realm
</div>
<pre><span class="keyword">class type</span> <a name="TYPEkey_handler"></a><a href="Http_client.key_handler.html">key_handler</a> = <code class="code">object</code> <a href="Http_client.key_handler.html">..</a> <code class="code">end</code></pre><pre><span class="keyword">class</span> <a name="TYPEkey_ring"></a><a href="Http_client.key_ring.html">key_ring</a> : <code class="type">?uplink:#<a href="Http_client.key_handler.html">key_handler</a> -> unit -> </code><code class="code">object</code> <a href="Http_client.key_ring.html">..</a> <code class="code">end</code></pre><div class="info">
The <code class="code">key_ring</code> is a cache for keys.
</div>
<pre><span class="keyword">class type</span> <a name="TYPEauth_session"></a><a href="Http_client.auth_session.html">auth_session</a> = <code class="code">object</code> <a href="Http_client.auth_session.html">..</a> <code class="code">end</code></pre><div class="info">
An <code class="code">auth_session</code> represents an authenticated session
</div>
<pre><span class="keyword">class type</span> <a name="TYPEauth_handler"></a><a href="Http_client.auth_handler.html">auth_handler</a> = <code class="code">object</code> <a href="Http_client.auth_handler.html">..</a> <code class="code">end</code></pre><div class="info">
An authentication handler has the capability of adding the necessary
 headers to messages.
</div>
<pre><span class="keyword">class</span> <a name="TYPEbasic_auth_handler"></a><a href="Http_client.basic_auth_handler.html">basic_auth_handler</a> : <code class="type">?enable_auth_in_advance:bool -> #<a href="Http_client.key_handler.html">key_handler</a> -> </code><code class="type"><a href="Http_client.auth_handler.html">auth_handler</a></code></pre><div class="info">
Basic authentication.
</div>
<pre><span class="keyword">class</span> <a name="TYPEdigest_auth_handler"></a><a href="Http_client.digest_auth_handler.html">digest_auth_handler</a> : <code class="type">?enable_auth_in_advance:bool -> #<a href="Http_client.key_handler.html">key_handler</a> -> </code><code class="type"><a href="Http_client.auth_handler.html">auth_handler</a></code></pre><div class="info">
Digest authentication.
</div>
<pre><span class="keyword">class</span> <a name="TYPEbasic_auth_method"></a><a href="Http_client.basic_auth_method.html">basic_auth_method</a> : <code class="type"></code><code class="code">object</code> <a href="Http_client.basic_auth_method.html">..</a> <code class="code">end</code></pre><div class="info">
<b>Deprecated.</b>
</div>
<pre><span class="keyword">class</span> <a name="TYPEdigest_auth_method"></a><a href="Http_client.digest_auth_method.html">digest_auth_method</a> : <code class="type"></code><code class="type"><a href="Http_client.basic_auth_method.html">basic_auth_method</a></code></pre><div class="info">
<b>Deprecated.</b>
</div>
<br>
<a name="1_Pipelines"></a>
<h1>Pipelines</h1><br>
<br>
A connection cache is an object that keeps connections open that
 are currently unused. A connection cache can be shared by several
 pipelines.<br>
<pre><span class="keyword">type</span> <a name="TYPEconnection_cache"></a><code class="type"></code>connection_cache </pre>

<pre><span class="keyword">val</span> <a name="VALclose_connection_cache"></a>close_connection_cache : <code class="type"><a href="Http_client.html#TYPEconnection_cache">connection_cache</a> -> unit</code></pre><div class="info">
Closes all descriptors known to the cache<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcreate_restrictive_cache"></a>create_restrictive_cache : <code class="type">unit -> <a href="Http_client.html#TYPEconnection_cache">connection_cache</a></code></pre><div class="info">
A restrictive cache closes connections as soon as there are no
 pending requests.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcreate_aggressive_cache"></a>create_aggressive_cache : <code class="type">unit -> <a href="Http_client.html#TYPEconnection_cache">connection_cache</a></code></pre><div class="info">
This type of cache tries to keep connections as long open as
 possible. The consequence is that users are responsible for
 closing the descriptors (by calling <code class="code">close_connection_cache</code>) when the
 cache is no longer in use.
<p>

 Aggressive caching is an experimental feature. Reports about success
 and/or problems are very welcome.<br>
</div>
<pre><span class="keyword">class</span> <a name="TYPEpipeline"></a><a href="Http_client.pipeline.html">pipeline</a> : <code class="type"></code><code class="code">object</code> <a href="Http_client.pipeline.html">..</a> <code class="code">end</code></pre><div class="info">
A pipeline is a queue of HTTP calls to perform
</div>
<br>
<b>Example using the pipeline:</b>
<p>

 <pre><code class="code">
 let call = new get "http://server/path" in
 let pipeline = new pipeline in
 pipeline # add call;
 pipeline # run();    (* Now the HTTP client is working... *)
 match call # status with
 | `Successful -&gt; ...
 | ...
 </code></pre><br>
<br>
<a name="1_Conveniencemoduleforsimpleapplications"></a>
<h1>Convenience module for simple applications</h1><br>
<br>
Do <code class="code">open Http_client.Convenience</code> for simple applications.<br>
<pre><span class="keyword">module</span> <a href="Http_client.Convenience.html">Convenience</a>: <code class="code">sig</code> <a href="Http_client.Convenience.html">..</a> <code class="code">end</code></pre></body></html>