aboutsummaryrefslogtreecommitdiffstats
path: root/libfetch/fetch.cat3
blob: f112d6a4591e4904dbced79b41f5ede783c263d1 (plain)
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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
FETCH(3)                NetBSD Library Functions Manual               FETCH(3)

NNAAMMEE
     ffeettcchhMMaakkeeUURRLL, ffeettcchhPPaarrsseeUURRLL, ffeettcchhCCooppyyUURRLL, ffeettcchhFFrreeeeUURRLL, ffeettcchhXXGGeettUURRLL,
     ffeettcchhGGeettUURRLL, ffeettcchhPPuuttUURRLL, ffeettcchhSSttaattUURRLL, ffeettcchhLLiissttUURRLL, ffeettcchhXXGGeett,
     ffeettcchhGGeett, ffeettcchhPPuutt, ffeettcchhSSttaatt, ffeettcchhLLiisstt, ffeettcchhXXGGeettFFiillee, ffeettcchhGGeettFFiillee,
     ffeettcchhPPuuttFFiillee, ffeettcchhSSttaattFFiillee, ffeettcchhLLiissttFFiillee, ffeettcchhXXGGeettHHTTTTPP, ffeettcchhGGeettHHTTTTPP,
     ffeettcchhPPuuttHHTTTTPP, ffeettcchhSSttaattHHTTTTPP, ffeettcchhLLiissttHHTTTTPP, ffeettcchhXXGGeettFFTTPP, ffeettcchhGGeettFFTTPP,
     ffeettcchhPPuuttFFTTPP, ffeettcchhSSttaattFFTTPP, ffeettcchhLLiissttFFTTPP ffeettcchhIInniittUURRLLLLiisstt,
     ffeettcchhFFrreeeeUURRLLLLiisstt, ffeettcchhUUnnqquuootteePPaatthh, ffeettcchhUUnnqquuootteeFFiilleennaammee,
     ffeettcchhSSttrriinnggiiffyyUURRLL, ffeettcchhCCoonnnneeccttiioonnCCaacchheeIInniitt, ffeettcchhCCoonnnneeccttiioonnCCaacchheeCClloossee,
     ffeettcchh -- file transfer functions

LLIIBBRRAARRYY
               File Transfer Library for URLs (libfetch, -lfetch)

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssttddiioo..hh>>
     ##iinncclluuddee <<ffeettcchh..hh>>

     _s_t_r_u_c_t _u_r_l _*
     ffeettcchhMMaakkeeUURRLL(_c_o_n_s_t _c_h_a_r _*_s_c_h_e_m_e, _c_o_n_s_t _c_h_a_r _*_h_o_s_t, _i_n_t _p_o_r_t,
         _c_o_n_s_t _c_h_a_r _*_d_o_c, _c_o_n_s_t _c_h_a_r _*_u_s_e_r, _c_o_n_s_t _c_h_a_r _*_p_w_d);

     _s_t_r_u_c_t _u_r_l _*
     ffeettcchhPPaarrsseeUURRLL(_c_o_n_s_t _c_h_a_r _*_U_R_L);

     _s_t_r_u_c_t _u_r_l _*
     ffeettcchhCCooppyyUURRLL(_c_o_n_s_t _s_t_r_u_c_t _u_r_l _*_u);

     _v_o_i_d
     ffeettcchhFFrreeeeUURRLL(_s_t_r_u_c_t _u_r_l _*_u);

     _f_e_t_c_h_I_O _*
     ffeettcchhXXGGeettUURRLL(_c_o_n_s_t _c_h_a_r _*_U_R_L, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhGGeettUURRLL(_c_o_n_s_t _c_h_a_r _*_U_R_L, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhPPuuttUURRLL(_c_o_n_s_t _c_h_a_r _*_U_R_L, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhSSttaattUURRLL(_c_o_n_s_t _c_h_a_r _*_U_R_L, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhLLiissttUURRLL(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_l_i_s_t, _c_o_n_s_t _c_h_a_r _*_U_R_L, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhXXGGeett(_s_t_r_u_c_t _u_r_l _*_u, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhGGeett(_s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhPPuutt(_s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhSSttaatt(_s_t_r_u_c_t _u_r_l _*_u, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhLLiisstt(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_l_i_s_t, _s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhXXGGeettFFiillee(_s_t_r_u_c_t _u_r_l _*_u, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhGGeettFFiillee(_s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhPPuuttFFiillee(_s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhSSttaattFFiillee(_s_t_r_u_c_t _u_r_l _*_u, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhLLiissttFFiillee(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_l_i_s_t, _s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhXXGGeettHHTTTTPP(_s_t_r_u_c_t _u_r_l _*_u, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhGGeettHHTTTTPP(_s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhPPuuttHHTTTTPP(_s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhSSttaattHHTTTTPP(_s_t_r_u_c_t _u_r_l _*_u, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhLLiissttHHTTTTPP(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_l_i_s_t, _s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhXXGGeettFFTTPP(_s_t_r_u_c_t _u_r_l _*_u, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhGGeettFFTTPP(_s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _f_e_t_c_h_I_O _*
     ffeettcchhPPuuttFFTTPP(_s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhSSttaattFFTTPP(_s_t_r_u_c_t _u_r_l _*_u, _s_t_r_u_c_t _u_r_l___s_t_a_t _*_u_s, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _i_n_t
     ffeettcchhLLiissttFFTTPP(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_l_i_s_t, _s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);

     _v_o_i_d
     ffeettcchhIInniittUURRLLLLiisstt(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_u_l);

     _i_n_t
     ffeettcchhAAppppeennddUURRLLLLiisstt(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_d_s_t, _c_o_n_s_t _s_t_r_u_c_t _u_r_l___l_i_s_t _*_s_r_c);

     _v_o_i_d
     ffeettcchhFFrreeeeUURRLLLLiisstt(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_u_l);

     _c_h_a_r _*
     ffeettcchhUUnnqquuootteePPaatthh(_s_t_r_u_c_t _u_r_l _*_u);

     _c_h_a_r _*
     ffeettcchhUUnnqquuootteeFFiilleennaammee(_s_t_r_u_c_t _u_r_l _*_u);

     _c_h_a_r _*
     ffeettcchhSSttrriinnggiiffyyUURRLL(_c_o_n_s_t _s_t_r_u_c_t _u_r_l _*_u);

     _v_o_i_d
     ffeettcchhCCoonnnneeccttiioonnCCaacchheeIInniitt(_i_n_t _g_l_o_b_a_l, _i_n_t _p_e_r___h_o_s_t);

     _v_o_i_d
     ffeettcchhCCoonnnneeccttiioonnCCaacchheeCClloossee(_v_o_i_d);

DDEESSCCRRIIPPTTIIOONN
     These functions implement a high-level library for retrieving and upload-
     ing files using Uniform Resource Locators (URLs).

     ffeettcchhPPaarrsseeUURRLL() takes a URL in the form of a null-terminated string and
     splits it into its components function according to the Common Internet
     Scheme Syntax detailed in RFC 1738.  A regular expression which produces
     this syntax is:

           <scheme>:(//(<user>(:<pwd>)?@)?<host>(:<port>)?)?/(<document>)?

     If the URL does not seem to begin with a scheme name, it is assumed to be
     a local path.  Only absolute path names are accepted.

     Note that some components of the URL are not necessarily relevant to all
     URL schemes.  For instance, the file scheme only needs the <scheme> and
     <document> components.  ffeettcchhPPaarrsseeUURRLL() quotes any unsafe character in
     the URL automatically.  This is not done by ffeettcchhMMaakkeeUURRLL().
     ffeettcchhCCooppyyUURRLL() copies an existing _u_r_l structure.

     ffeettcchhMMaakkeeUURRLL(), ffeettcchhPPaarrsseeUURRLL(), and ffeettcchhCCooppyyUURRLL() return a pointer to a
     _u_r_l structure, which is defined as follows in <_f_e_t_c_h_._h>:

     #define URL_SCHEMELEN 16
     #define URL_USERLEN 256
     #define URL_PWDLEN 256
     #define URL_HOSTLEN 255

     struct url {
         char         scheme[URL_SCHEMELEN + 1];
         char         user[URL_USERLEN + 1];
         char         pwd[URL_PWDLEN + 1];
         char         host[URL_HOSTLEN + 1];
         int          port;
         char        *doc;
         off_t        offset;
         size_t       length;
         time_t       last_modified;
     };

     The pointer returned by ffeettcchhMMaakkeeUURRLL(), ffeettcchhCCooppyyUURRLL(), and
     ffeettcchhPPaarrsseeUURRLL() should be freed using ffeettcchhFFrreeeeUURRLL().  The size of _s_t_r_u_c_t
     _U_R_L is not part of the ABI.

     ffeettcchhXXGGeettUURRLL(), ffeettcchhGGeettUURRLL(), and ffeettcchhPPuuttUURRLL() constitute the recom-
     mended interface to the ffeettcchh library.  They examine the URL passed to
     them to determine the transfer method, and call the appropriate lower-
     level functions to perform the actual transfer.  ffeettcchhXXGGeettUURRLL() also
     returns the remote document's metadata in the _u_r_l___s_t_a_t structure pointed
     to by the _u_s argument.

     The _f_l_a_g_s argument is a string of characters which specify transfer
     options.  The meaning of the individual flags is scheme-dependent, and is
     detailed in the appropriate section below.

     ffeettcchhSSttaattUURRLL() attempts to obtain the requested document's metadata and
     fill in the structure pointed to by its second argument.  The _u_r_l___s_t_a_t
     structure is defined as follows in <_f_e_t_c_h_._h>:

     struct url_stat {
         off_t        size;
         time_t       atime;
         time_t       mtime;
     };

     If the size could not be obtained from the server, the _s_i_z_e field is set
     to -1.  If the modification time could not be obtained from the server,
     the _m_t_i_m_e field is set to the epoch.  If the access time could not be
     obtained from the server, the _a_t_i_m_e field is set to the modification
     time.

     ffeettcchhLLiissttUURRLL() attempts to list the contents of the directory pointed to
     by the URL provided.  The pattern can be a simple glob-like expression as
     hint.  Callers should not depend on the server to filter names.  If suc-
     cessful, it appends the list of entries to the _u_r_l___l_i_s_t structure.  The
     _u_r_l___l_i_s_t structure is defined as follows in <_f_e_t_c_h_._h>:

     struct url_list {
         size_t      length;
         size_t      alloc_size;
         struct url  *urls;
     };

     The list should be initialized by calling ffeettcchhIInniittUURRLLLLiisstt() and the
     entries be freed by calling ffeettcchhFFrreeeeUURRLLLLiisstt().  The function
     ffeettcchhAAppppeennddUURRLLLLiisstt() can be used to append one URL lists to another.  If
     the `c' (cache result) flag is specified, the library is allowed to
     internally cache the result.

     ffeettcchhSSttrriinnggiiffyyUURRLL() returns the URL as string.  ffeettcchhUUnnqquuootteePPaatthh()
     returns the path name part of the URL with any quoting undone.  Query
     arguments and fragment identifiers are not included.
     ffeettcchhUUnnqquuootteeFFiilleennaammee() returns the last component of the path name as
     returned by ffeettcchhUUnnqquuootteePPaatthh().  ffeettcchhSSttrriinnggiiffyyUURRLL(), ffeettcchhUUnnqquuootteePPaatthh(),
     and ffeettcchhUUnnqquuootteeFFiilleennaammee() return a string that should be deallocated
     with ffrreeee() after use.

     ffeettcchhCCoonnnneeccttiioonnCCaacchheeIInniitt() enables the connection cache.  The first argu-
     ment specifies the global limit on cached connections.  The second argu-
     ment specifies the host limit.  Entries are considered to specify the
     same host, if the host name from the URL is identical, indepent of the
     address or address family.  ffeettcchhCCoonnnneeccttiioonnCCaacchheeCClloossee() flushed the con-
     nection cache and closes all cached connections.

     ffeettcchhXXGGeett(), ffeettcchhGGeett(), ffeettcchhPPuutt(), and ffeettcchhSSttaatt() are similar to
     ffeettcchhXXGGeettUURRLL(), ffeettcchhGGeettUURRLL(), ffeettcchhPPuuttUURRLL(), and ffeettcchhSSttaattUURRLL(), except
     that they expect a pre-parsed URL in the form of a pointer to a _s_t_r_u_c_t
     _u_r_l rather than a string.

     All of the ffeettcchhXXGGeettXXXXXX(), ffeettcchhGGeettXXXXXX(), and ffeettcchhPPuuttXXXXXX() functions
     return a pointer to a stream which can be used to read or write data from
     or to the requested document, respectively.  Note that although the
     implementation details of the individual access methods vary, it can gen-
     erally be assumed that a stream returned by one of the ffeettcchhXXGGeettXXXXXX() or
     ffeettcchhGGeettXXXXXX() functions is read-only, and that a stream returned by one
     of the ffeettcchhPPuuttXXXXXX() functions is write-only.

PPRROOTTOOCCOOLL IINNDDEEPPEENNDDEENNTT FFLLAAGGSS
     If the `i' (if-modified-since) flag is specified, the library will try to
     fetch the content only if it is newer than _l_a_s_t___m_o_d_i_f_i_e_d.  For HTTP an
     If-Modified-Since HTTP header is sent.  For FTP a MTDM command is sent
     first and compared locally.  For FILE the source file is compared.

FFIILLEE SSCCHHEEMMEE
     ffeettcchhXXGGeettFFiillee(), ffeettcchhGGeettFFiillee(), and ffeettcchhPPuuttFFiillee() provide access to
     documents which are files in a locally mounted file system.  Only the
     <document> component of the URL is used.

     ffeettcchhXXGGeettFFiillee() and ffeettcchhGGeettFFiillee() do not accept any flags.

     ffeettcchhPPuuttFFiillee() accepts the `a' (append to file) flag.  If that flag is
     specified, the data written to the stream returned by ffeettcchhPPuuttFFiillee() will
     be appended to the previous contents of the file, instead of replacing
     them.

FFTTPP SSCCHHEEMMEE
     ffeettcchhXXGGeettFFTTPP(), ffeettcchhGGeettFFTTPP(), and ffeettcchhPPuuttFFTTPP() implement the FTP proto-
     col as described in RFC 959.

     By default lliibbffeettcchh will attempt to use passive mode first and only fall-
     back to active mode if the server reports a syntax error.  If the `a'
     (active) flag is specified, a passive connection is not tried and active
     mode is used directly.

     If the `l' (low) flag is specified, data sockets will be allocated in the
     low (or default) port range instead of the high port range (see ip(4)).

     If the `d' (direct) flag is specified, ffeettcchhXXGGeettFFTTPP(), ffeettcchhGGeettFFTTPP(), and
     ffeettcchhPPuuttFFTTPP() will use a direct connection even if a proxy server is
     defined.

     If no user name or password is given, the ffeettcchh library will attempt an
     anonymous login, with user name "anonymous" and password "anony-
     mous@<hostname>".

HHTTTTPP SSCCHHEEMMEE
     The ffeettcchhXXGGeettHHTTTTPP(), ffeettcchhGGeettHHTTTTPP(), and ffeettcchhPPuuttHHTTTTPP() functions imple-
     ment the HTTP/1.1 protocol.  With a little luck, there is even a chance
     that they comply with RFC 2616 and RFC 2617.

     If the `d' (direct) flag is specified, ffeettcchhXXGGeettHHTTTTPP(), ffeettcchhGGeettHHTTTTPP(),
     and ffeettcchhPPuuttHHTTTTPP() will use a direct connection even if a proxy server is
     defined.

     Since there seems to be no good way of implementing the HTTP PUT method
     in a manner consistent with the rest of the ffeettcchh library, ffeettcchhPPuuttHHTTTTPP()
     is currently unimplemented.

AAUUTTHHEENNTTIICCAATTIIOONN
     Apart from setting the appropriate environment variables and specifying
     the user name and password in the URL or the _s_t_r_u_c_t _u_r_l, the calling pro-
     gram has the option of defining an authentication function with the fol-
     lowing prototype:

     _i_n_t mmyyAAuutthhMMeetthhoodd(_s_t_r_u_c_t _u_r_l _*_u)

     The callback function should fill in the _u_s_e_r and _p_w_d fields in the pro-
     vided _s_t_r_u_c_t _u_r_l and return 0 on success, or any other value to indicate
     failure.

     To register the authentication callback, simply set _f_e_t_c_h_A_u_t_h_M_e_t_h_o_d to
     point at it.  The callback will be used whenever a site requires authen-
     tication and the appropriate environment variables are not set.

     This interface is experimental and may be subject to change.

RREETTUURRNN VVAALLUUEESS
     ffeettcchhPPaarrsseeUURRLL() returns a pointer to a _s_t_r_u_c_t _u_r_l containing the individ-
     ual components of the URL.  If it is unable to allocate memory, or the
     URL is syntactically incorrect, ffeettcchhPPaarrsseeUURRLL() returns a NULL pointer.

     The ffeettcchhSSttaatt() functions return 0 on success and -1 on failure.

     All other functions return a stream pointer which may be used to access
     the requested document, or NULL if an error occurred.

     The following error codes are defined in <_f_e_t_c_h_._h>:

     [FETCH_ABORT]       Operation aborted

     [FETCH_AUTH]        Authentication failed

     [FETCH_DOWN]        Service unavailable

     [FETCH_EXISTS]      File exists

     [FETCH_FULL]        File system full

     [FETCH_INFO]        Informational response

     [FETCH_MEMORY]      Insufficient memory

     [FETCH_MOVED]       File has moved

     [FETCH_NETWORK]     Network error

     [FETCH_OK]          No error

     [FETCH_PROTO]       Protocol error

     [FETCH_RESOLV]      Resolver error

     [FETCH_SERVER]      Server error

     [FETCH_TEMP]        Temporary error

     [FETCH_TIMEOUT]     Operation timed out

     [FETCH_UNAVAIL]     File is not available

     [FETCH_UNKNOWN]     Unknown error

     [FETCH_URL]         Invalid URL

     The accompanying error message includes a protocol-specific error code
     and message, e.g. "File is not available (404 Not Found)"

EENNVVIIRROONNMMEENNTT
     FETCH_BIND_ADDRESS  Specifies a host name or IP address to which sockets
                         used for outgoing connections will be bound.

     FTP_LOGIN           Default FTP login if none was provided in the URL.

     FTP_PASSIVE_MODE    If set to anything but `no', forces the FTP code to
                         use passive mode.

     FTP_PASSWORD        Default FTP password if the remote server requests
                         one and none was provided in the URL.

     FTP_PROXY           URL of the proxy to use for FTP requests.  The docu-
                         ment part is ignored.  FTP and HTTP proxies are sup-
                         ported; if no scheme is specified, FTP is assumed.
                         If the proxy is an FTP proxy, lliibbffeettcchh will send
                         `user@host' as user name to the proxy, where `user'
                         is the real user name, and `host' is the name of the
                         FTP server.

                         If this variable is set to an empty string, no proxy
                         will be used for FTP requests, even if the HTTP_PROXY
                         variable is set.

     ftp_proxy           Same as FTP_PROXY, for compatibility.

     HTTP_AUTH           Specifies HTTP authorization parameters as a colon-
                         separated list of items.  The first and second item
                         are the authorization scheme and realm respectively;
                         further items are scheme-dependent.  Currently, only
                         basic authorization is supported.

                         Basic authorization requires two parameters: the user
                         name and password, in that order.

                         This variable is only used if the server requires
                         authorization and no user name or password was speci-
                         fied in the URL.

     HTTP_PROXY          URL of the proxy to use for HTTP requests.  The docu-
                         ment part is ignored.  Only HTTP proxies are sup-
                         ported for HTTP requests.  If no port number is spec-
                         ified, the default is 3128.

                         Note that this proxy will also be used for FTP docu-
                         ments, unless the FTP_PROXY variable is set.

     http_proxy          Same as HTTP_PROXY, for compatibility.

     HTTP_PROXY_AUTH     Specifies authorization parameters for the HTTP proxy
                         in the same format as the HTTP_AUTH variable.

                         This variable is used if and only if connected to an
                         HTTP proxy, and is ignored if a user and/or a pass-
                         word were specified in the proxy URL.

     HTTP_REFERER        Specifies the referrer URL to use for HTTP requests.
                         If set to ``auto'', the document URL will be used as
                         referrer URL.

     HTTP_USER_AGENT     Specifies the User-Agent string to use for HTTP
                         requests.  This can be useful when working with HTTP
                         origin or proxy servers that differentiate between
                         user agents.

     NETRC               Specifies a file to use instead of _~_/_._n_e_t_r_c to look
                         up login names and passwords for FTP sites.  See
                         ftp(1) for a description of the file format.  This
                         feature is experimental.

     NO_PROXY            Either a single asterisk, which disables the use of
                         proxies altogether, or a comma- or whitespace-sepa-
                         rated list of hosts for which proxies should not be
                         used.

     no_proxy            Same as NO_PROXY, for compatibility.

EEXXAAMMPPLLEESS
     To access a proxy server on _p_r_o_x_y_._e_x_a_m_p_l_e_._c_o_m port 8080, set the
     HTTP_PROXY environment variable in a manner similar to this:

           HTTP_PROXY=http://proxy.example.com:8080

     If the proxy server requires authentication, there are two options avail-
     able for passing the authentication data.  The first method is by using
     the proxy URL:

           HTTP_PROXY=http://<user>:<pwd>@proxy.example.com:8080

     The second method is by using the HTTP_PROXY_AUTH environment variable:

           HTTP_PROXY=http://proxy.example.com:8080
           HTTP_PROXY_AUTH=basic:*:<user>:<pwd>

     To disable the use of a proxy for an HTTP server running on the local
     host, define NO_PROXY as follows:

           NO_PROXY=localhost,127.0.0.1

SSEEEE AALLSSOO
     ftp(1), ip(4)

     J. Postel and J. K. Reynolds, _F_i_l_e _T_r_a_n_s_f_e_r _P_r_o_t_o_c_o_l, October 1985, RFC
     959.

     P. Deutsch, A. Emtage, and A. Marine, _H_o_w _t_o _U_s_e _A_n_o_n_y_m_o_u_s _F_T_P, May 1994,
     RFC 1635.

     T. Berners-Lee, L. Masinter, and M. McCahill, _U_n_i_f_o_r_m _R_e_s_o_u_r_c_e _L_o_c_a_t_o_r_s
     _(_U_R_L_), December 1994, RFC 1738.

     R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L. Masinter, P. Leach, and
     T. Berners-Lee, _H_y_p_e_r_t_e_x_t _T_r_a_n_s_f_e_r _P_r_o_t_o_c_o_l _-_- _H_T_T_P_/_1_._1, January 1999,
     RFC 2616.

     J. Franks, P. Hallam-Baker, J. Hostetler, S. Lawrence, P. Leach, A.
     Luotonen, and L. Stewart, _H_T_T_P _A_u_t_h_e_n_t_i_c_a_t_i_o_n_: _B_a_s_i_c _a_n_d _D_i_g_e_s_t _A_c_c_e_s_s
     _A_u_t_h_e_n_t_i_c_a_t_i_o_n, June 1999, RFC 2617.

HHIISSTTOORRYY
     The ffeettcchh library first appeared in FreeBSD 3.0.

AAUUTTHHOORRSS
     The ffeettcchh library was mostly written by Dag-Erling Sm�rgrav
     <des@FreeBSD.org> with numerous suggestions from Jordan K. Hubbard
     <jkh@FreeBSD.org>, Eugene Skepner <eu@qub.com> and other FreeBSD develop-
     ers.  It replaces the older ffttppiioo library written by Poul-Henning Kamp
     <phk@FreeBSD.org> and Jordan K. Hubbard <jkh@FreeBSD.org>.

     This manual page was written by Dag-Erling Sm�rgrav <des@FreeBSD.org>.

BBUUGGSS
     Some parts of the library are not yet implemented.  The most notable
     examples of this are ffeettcchhPPuuttHHTTTTPP() and FTP proxy support.

     There is no way to select a proxy at run-time other than setting the
     HTTP_PROXY or FTP_PROXY environment variables as appropriate.

     lliibbffeettcchh does not understand or obey 305 (Use Proxy) replies.

     Error numbers are unique only within a certain context; the error codes
     used for FTP and HTTP overlap, as do those used for resolver and system
     errors.  For instance, error code 202 means "Command not implemented,
     superfluous at this site" in an FTP context and "Accepted" in an HTTP
     context.

     ffeettcchhSSttaattFFTTPP() does not check that the result of an MDTM command is a
     valid date.

     The man page is incomplete, poorly written and produces badly formatted
     text.

     The error reporting mechanism is unsatisfactory.

     Some parts of the code are not fully reentrant.

NetBSD 5.0                     January 22, 2010                     NetBSD 5.0