xref: /minix/external/bsd/fetch/dist/libfetch/fetch.3 (revision 0a6a1f1d)
1.\"-
2.\" Copyright (c) 1998-2004 Dag-Erling Co�dan Sm�rgrav
3.\" Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.org>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" $FreeBSD: fetch.3,v 1.64 2007/12/18 11:03:26 des Exp $
28.\" $NetBSD: fetch.3,v 1.3 2014/03/18 18:20:36 riastradh Exp $
29.\"
30.Dd January 22, 2010
31.Dt FETCH 3
32.Os
33.Sh NAME
34.Nm fetchMakeURL ,
35.Nm fetchParseURL ,
36.Nm fetchCopyURL ,
37.Nm fetchFreeURL ,
38.Nm fetchXGetURL ,
39.Nm fetchGetURL ,
40.Nm fetchPutURL ,
41.Nm fetchStatURL ,
42.Nm fetchListURL ,
43.Nm fetchXGet ,
44.Nm fetchGet ,
45.Nm fetchPut ,
46.Nm fetchStat ,
47.Nm fetchList ,
48.Nm fetchXGetFile ,
49.Nm fetchGetFile ,
50.Nm fetchPutFile ,
51.Nm fetchStatFile ,
52.Nm fetchListFile ,
53.Nm fetchXGetHTTP ,
54.Nm fetchGetHTTP ,
55.Nm fetchPutHTTP ,
56.Nm fetchStatHTTP ,
57.Nm fetchListHTTP ,
58.Nm fetchXGetFTP ,
59.Nm fetchGetFTP ,
60.Nm fetchPutFTP ,
61.Nm fetchStatFTP ,
62.Nm fetchListFTP
63.Nm fetchInitURLList ,
64.Nm fetchFreeURLList ,
65.Nm fetchUnquotePath ,
66.Nm fetchUnquoteFilename ,
67.Nm fetchStringifyURL ,
68.Nm fetchConnectionCacheInit ,
69.Nm fetchConnectionCacheClose ,
70.Nm fetch
71.Nd file transfer functions
72.Sh LIBRARY
73.Lb libfetch
74.Sh SYNOPSIS
75.In stdio.h
76.In fetch.h
77.Ft struct url *
78.Fn fetchMakeURL "const char *scheme" "const char *host" "int port" "const char *doc" "const char *user" "const char *pwd"
79.Ft struct url *
80.Fn fetchParseURL "const char *URL"
81.Ft struct url *
82.Fn fetchCopyURL "const struct url *u"
83.Ft void
84.Fn fetchFreeURL "struct url *u"
85.Ft fetchIO *
86.Fn fetchXGetURL "const char *URL" "struct url_stat *us" "const char *flags"
87.Ft fetchIO *
88.Fn fetchGetURL "const char *URL" "const char *flags"
89.Ft fetchIO *
90.Fn fetchPutURL "const char *URL" "const char *flags"
91.Ft int
92.Fn fetchStatURL "const char *URL" "struct url_stat *us" "const char *flags"
93.Ft int
94.Fn fetchListURL "struct url_list *list" "const char *URL" "const char *flags"
95.Ft fetchIO *
96.Fn fetchXGet "struct url *u" "struct url_stat *us" "const char *flags"
97.Ft fetchIO *
98.Fn fetchGet "struct url *u" "const char *flags"
99.Ft fetchIO *
100.Fn fetchPut "struct url *u" "const char *flags"
101.Ft int
102.Fn fetchStat "struct url *u" "struct url_stat *us" "const char *flags"
103.Ft int
104.Fn fetchList "struct url_list *list" "struct url *u" "const char *flags"
105.Ft fetchIO *
106.Fn fetchXGetFile "struct url *u" "struct url_stat *us" "const char *flags"
107.Ft fetchIO *
108.Fn fetchGetFile "struct url *u" "const char *flags"
109.Ft fetchIO *
110.Fn fetchPutFile "struct url *u" "const char *flags"
111.Ft int
112.Fn fetchStatFile "struct url *u" "struct url_stat *us" "const char *flags"
113.Ft int
114.Fn fetchListFile "struct url_list *list" "struct url *u" "const char *flags"
115.Ft fetchIO *
116.Fn fetchXGetHTTP "struct url *u" "struct url_stat *us" "const char *flags"
117.Ft fetchIO *
118.Fn fetchGetHTTP "struct url *u" "const char *flags"
119.Ft fetchIO *
120.Fn fetchPutHTTP "struct url *u" "const char *flags"
121.Ft int
122.Fn fetchStatHTTP "struct url *u" "struct url_stat *us" "const char *flags"
123.Ft int
124.Fn fetchListHTTP "struct url_list *list" "struct url *u" "const char *flags"
125.Ft fetchIO *
126.Fn fetchXGetFTP "struct url *u" "struct url_stat *us" "const char *flags"
127.Ft fetchIO *
128.Fn fetchGetFTP "struct url *u" "const char *flags"
129.Ft fetchIO *
130.Fn fetchPutFTP "struct url *u" "const char *flags"
131.Ft int
132.Fn fetchStatFTP "struct url *u" "struct url_stat *us" "const char *flags"
133.Ft int
134.Fn fetchListFTP "struct url_list *list" "struct url *u" "const char *flags"
135.Ft void
136.Fn fetchInitURLList "struct url_list *ul"
137.Ft int
138.Fn fetchAppendURLList "struct url_list *dst" "const struct url_list *src"
139.Ft void
140.Fn fetchFreeURLList "struct url_list *ul"
141.Ft char *
142.Fn fetchUnquotePath "struct url *u"
143.Ft char *
144.Fn fetchUnquoteFilename "struct url *u"
145.Ft char *
146.Fn fetchStringifyURL "const struct url *u"
147.Ft void
148.Fn fetchConnectionCacheInit "int global" "int per_host"
149.Ft void
150.Fn fetchConnectionCacheClose "void"
151.Sh DESCRIPTION
152These functions implement a high-level library for retrieving and
153uploading files using Uniform Resource Locators (URLs).
154.Pp
155.Fn fetchParseURL
156takes a URL in the form of a null-terminated string and splits it into
157its components function according to the Common Internet Scheme Syntax
158detailed in RFC 1738.
159A regular expression which produces this syntax is:
160.Bd -literal -offset indent
161\*[Lt]scheme\*[Gt]:(//(\*[Lt]user\*[Gt](:\*[Lt]pwd\*[Gt])?@)?\*[Lt]host\*[Gt](:\*[Lt]port\*[Gt])?)?/(\*[Lt]document\*[Gt])?
162.Ed
163.Pp
164If the URL does not seem to begin with a scheme name, it is assumed to be a local path.
165Only absolute path names are accepted.
166.Pp
167Note that some components of the URL are not necessarily relevant to
168all URL schemes.
169For instance, the file scheme only needs the
170.Aq scheme
171and
172.Aq document
173components.
174.Fn fetchParseURL
175quotes any unsafe character in the URL automatically.
176This is not done by
177.Fn fetchMakeURL .
178.Fn fetchCopyURL
179copies an existing
180.Vt url
181structure.
182.Pp
183.Fn fetchMakeURL ,
184.Fn fetchParseURL ,
185and
186.Fn fetchCopyURL
187return a pointer to a
188.Vt url
189structure, which is defined as follows in
190.In fetch.h :
191.Bd -literal
192#define URL_SCHEMELEN 16
193#define URL_USERLEN 256
194#define URL_PWDLEN 256
195#define URL_HOSTLEN 255
196
197struct url {
198    char	 scheme[URL_SCHEMELEN + 1];
199    char	 user[URL_USERLEN + 1];
200    char	 pwd[URL_PWDLEN + 1];
201    char	 host[URL_HOSTLEN + 1];
202    int		 port;
203    char	*doc;
204    off_t	 offset;
205    size_t	 length;
206    time_t	 last_modified;
207};
208.Ed
209.Pp
210The pointer returned by
211.Fn fetchMakeURL ,
212.Fn fetchCopyURL ,
213and
214.Fn fetchParseURL
215should be freed using
216.Fn fetchFreeURL .
217The size of
218.Vt struct URL
219is not part of the ABI.
220.Pp
221.Fn fetchXGetURL ,
222.Fn fetchGetURL ,
223and
224.Fn fetchPutURL
225constitute the recommended interface to the
226.Nm fetch
227library.
228They examine the URL passed to them to determine the transfer
229method, and call the appropriate lower-level functions to perform the
230actual transfer.
231.Fn fetchXGetURL
232also returns the remote document's metadata in the
233.Vt url_stat
234structure pointed to by the
235.Fa us
236argument.
237.Pp
238The
239.Fa flags
240argument is a string of characters which specify transfer options.
241The
242meaning of the individual flags is scheme-dependent, and is detailed
243in the appropriate section below.
244.Pp
245.Fn fetchStatURL
246attempts to obtain the requested document's metadata and fill in the
247structure pointed to by its second argument.
248The
249.Vt url_stat
250structure is defined as follows in
251.In fetch.h :
252.Bd -literal
253struct url_stat {
254    off_t	 size;
255    time_t	 atime;
256    time_t	 mtime;
257};
258.Ed
259.Pp
260If the size could not be obtained from the server, the
261.Fa size
262field is set to \-1.
263If the modification time could not be obtained from the server, the
264.Fa mtime
265field is set to the epoch.
266If the access time could not be obtained from the server, the
267.Fa atime
268field is set to the modification time.
269.Pp
270.Fn fetchListURL
271attempts to list the contents of the directory pointed to by the URL provided.
272The pattern can be a simple glob-like expression as hint.
273Callers should not depend on the server to filter names.
274If successful, it appends the list of entries to the
275.Vt url_list
276structure.
277The
278.Vt url_list
279structure is defined as follows in
280.In fetch.h :
281.Bd -literal
282struct url_list {
283    size_t	length;
284    size_t	alloc_size;
285    struct url	*urls;
286};
287.Ed
288.Pp
289The list should be initialized by calling
290.Fn fetchInitURLList
291and the entries be freed by calling
292.Fn fetchFreeURLList .
293The function
294.Fn fetchAppendURLList
295can be used to append one URL lists to another.
296If the
297.Ql c
298(cache result) flag is specified, the library is allowed to internally
299cache the result.
300.Pp
301.Fn fetchStringifyURL
302returns the URL as string.
303.Fn fetchUnquotePath
304returns the path name part of the URL with any quoting undone.
305Query arguments and fragment identifiers are not included.
306.Fn fetchUnquoteFilename
307returns the last component of the path name as returned by
308.Fn fetchUnquotePath .
309.Fn fetchStringifyURL ,
310.Fn fetchUnquotePath ,
311and
312.Fn fetchUnquoteFilename
313return a string that should be deallocated with
314.Fn free
315after use.
316.Pp
317.Fn fetchConnectionCacheInit
318enables the connection cache.
319The first argument specifies the global limit on cached connections.
320The second argument specifies the host limit.
321Entries are considered to specify the same host, if the host name
322from the URL is identical, indepent of the address or address family.
323.Fn fetchConnectionCacheClose
324flushed the connection cache and closes all cached connections.
325.Pp
326.Fn fetchXGet ,
327.Fn fetchGet ,
328.Fn fetchPut ,
329and
330.Fn fetchStat
331are similar to
332.Fn fetchXGetURL ,
333.Fn fetchGetURL ,
334.Fn fetchPutURL ,
335and
336.Fn fetchStatURL ,
337except that they expect a pre-parsed URL in the form of a pointer to
338a
339.Vt struct url
340rather than a string.
341.Pp
342All of the
343.Fn fetchXGetXXX ,
344.Fn fetchGetXXX ,
345and
346.Fn fetchPutXXX
347functions return a pointer to a stream which can be used to read or
348write data from or to the requested document, respectively.
349Note that
350although the implementation details of the individual access methods
351vary, it can generally be assumed that a stream returned by one of the
352.Fn fetchXGetXXX
353or
354.Fn fetchGetXXX
355functions is read-only, and that a stream returned by one of the
356.Fn fetchPutXXX
357functions is write-only.
358.Sh PROTOCOL INDEPENDENT FLAGS
359If the
360.Ql i
361(if-modified-since) flag is specified, the library will try to fetch
362the content only if it is newer than
363.Va last_modified .
364For HTTP an
365.Li If-Modified-Since
366HTTP header is sent.
367For FTP a
368.Li MTDM
369command is sent first and compared locally.
370For FILE the source file is compared.
371.Sh FILE SCHEME
372.Fn fetchXGetFile ,
373.Fn fetchGetFile ,
374and
375.Fn fetchPutFile
376provide access to documents which are files in a locally mounted file
377system.
378Only the
379.Aq document
380component of the URL is used.
381.Pp
382.Fn fetchXGetFile
383and
384.Fn fetchGetFile
385do not accept any flags.
386.Pp
387.Fn fetchPutFile
388accepts the
389.Ql a
390(append to file) flag.
391If that flag is specified, the data written to
392the stream returned by
393.Fn fetchPutFile
394will be appended to the previous contents of the file, instead of
395replacing them.
396.Sh FTP SCHEME
397.Fn fetchXGetFTP ,
398.Fn fetchGetFTP ,
399and
400.Fn fetchPutFTP
401implement the FTP protocol as described in RFC 959.
402.Pp
403By default
404.Nm libfetch
405will attempt to use passive mode first and only fallback to active mode
406if the server reports a syntax error.
407If the
408.Ql a
409(active) flag is specified, a passive connection is not tried and active mode
410is used directly.
411.Pp
412If the
413.Ql l
414(low) flag is specified, data sockets will be allocated in the low (or
415default) port range instead of the high port range (see
416.Xr ip 4 ) .
417.Pp
418If the
419.Ql d
420(direct) flag is specified,
421.Fn fetchXGetFTP ,
422.Fn fetchGetFTP ,
423and
424.Fn fetchPutFTP
425will use a direct connection even if a proxy server is defined.
426.Pp
427If no user name or password is given, the
428.Nm fetch
429library will attempt an anonymous login, with user name "anonymous"
430and password "anonymous@\*[Lt]hostname\*[Gt]".
431.Sh HTTP SCHEME
432The
433.Fn fetchXGetHTTP ,
434.Fn fetchGetHTTP ,
435and
436.Fn fetchPutHTTP
437functions implement the HTTP/1.1 protocol.
438With a little luck, there is
439even a chance that they comply with RFC 2616 and RFC 2617.
440.Pp
441If the
442.Ql d
443(direct) flag is specified,
444.Fn fetchXGetHTTP ,
445.Fn fetchGetHTTP ,
446and
447.Fn fetchPutHTTP
448will use a direct connection even if a proxy server is defined.
449.Pp
450Since there seems to be no good way of implementing the HTTP PUT
451method in a manner consistent with the rest of the
452.Nm fetch
453library,
454.Fn fetchPutHTTP
455is currently unimplemented.
456.Sh AUTHENTICATION
457Apart from setting the appropriate environment variables and
458specifying the user name and password in the URL or the
459.Vt struct url ,
460the calling program has the option of defining an authentication
461function with the following prototype:
462.Pp
463.Ft int
464.Fn myAuthMethod "struct url *u"
465.Pp
466The callback function should fill in the
467.Fa user
468and
469.Fa pwd
470fields in the provided
471.Vt struct url
472and return 0 on success, or any other value to indicate failure.
473.Pp
474To register the authentication callback, simply set
475.Va fetchAuthMethod
476to point at it.
477The callback will be used whenever a site requires authentication and
478the appropriate environment variables are not set.
479.Pp
480This interface is experimental and may be subject to change.
481.Sh RETURN VALUES
482.Fn fetchParseURL
483returns a pointer to a
484.Vt struct url
485containing the individual components of the URL.
486If it is
487unable to allocate memory, or the URL is syntactically incorrect,
488.Fn fetchParseURL
489returns a
490.Dv NULL
491pointer.
492.Pp
493The
494.Fn fetchStat
495functions return 0 on success and \-1 on failure.
496.Pp
497All other functions return a stream pointer which may be used to
498access the requested document, or
499.Dv NULL
500if an error occurred.
501.Pp
502The following error codes are defined in
503.In fetch.h :
504.Bl -tag -width 18n
505.It Bq Er FETCH_ABORT
506Operation aborted
507.It Bq Er FETCH_AUTH
508Authentication failed
509.It Bq Er FETCH_DOWN
510Service unavailable
511.It Bq Er FETCH_EXISTS
512File exists
513.It Bq Er FETCH_FULL
514File system full
515.It Bq Er FETCH_INFO
516Informational response
517.It Bq Er FETCH_MEMORY
518Insufficient memory
519.It Bq Er FETCH_MOVED
520File has moved
521.It Bq Er FETCH_NETWORK
522Network error
523.It Bq Er FETCH_OK
524No error
525.It Bq Er FETCH_PROTO
526Protocol error
527.It Bq Er FETCH_RESOLV
528Resolver error
529.It Bq Er FETCH_SERVER
530Server error
531.It Bq Er FETCH_TEMP
532Temporary error
533.It Bq Er FETCH_TIMEOUT
534Operation timed out
535.It Bq Er FETCH_UNAVAIL
536File is not available
537.It Bq Er FETCH_UNKNOWN
538Unknown error
539.It Bq Er FETCH_URL
540Invalid URL
541.El
542.Pp
543The accompanying error message includes a protocol-specific error code
544and message, e.g.\& "File is not available (404 Not Found)"
545.Sh ENVIRONMENT
546.Bl -tag -width ".Ev FETCH_BIND_ADDRESS"
547.It Ev FETCH_BIND_ADDRESS
548Specifies a host name or IP address to which sockets used for outgoing
549connections will be bound.
550.It Ev FTP_LOGIN
551Default FTP login if none was provided in the URL.
552.It Ev FTP_PASSIVE_MODE
553If set to anything but
554.Ql no ,
555forces the FTP code to use passive mode.
556.It Ev FTP_PASSWORD
557Default FTP password if the remote server requests one and none was
558provided in the URL.
559.It Ev FTP_PROXY
560URL of the proxy to use for FTP requests.
561The document part is ignored.
562FTP and HTTP proxies are supported; if no scheme is specified, FTP is
563assumed.
564If the proxy is an FTP proxy,
565.Nm libfetch
566will send
567.Ql user@host
568as user name to the proxy, where
569.Ql user
570is the real user name, and
571.Ql host
572is the name of the FTP server.
573.Pp
574If this variable is set to an empty string, no proxy will be used for
575FTP requests, even if the
576.Ev HTTP_PROXY
577variable is set.
578.It Ev ftp_proxy
579Same as
580.Ev FTP_PROXY ,
581for compatibility.
582.It Ev HTTP_AUTH
583Specifies HTTP authorization parameters as a colon-separated list of
584items.
585The first and second item are the authorization scheme and realm
586respectively; further items are scheme-dependent.
587Currently, only basic authorization is supported.
588.Pp
589Basic authorization requires two parameters: the user name and
590password, in that order.
591.Pp
592This variable is only used if the server requires authorization and
593no user name or password was specified in the URL.
594.It Ev HTTP_PROXY
595URL of the proxy to use for HTTP requests.
596The document part is ignored.
597Only HTTP proxies are supported for HTTP requests.
598If no port number is specified, the default is 3128.
599.Pp
600Note that this proxy will also be used for FTP documents, unless the
601.Ev FTP_PROXY
602variable is set.
603.It Ev http_proxy
604Same as
605.Ev HTTP_PROXY ,
606for compatibility.
607.It Ev HTTP_PROXY_AUTH
608Specifies authorization parameters for the HTTP proxy in the same
609format as the
610.Ev HTTP_AUTH
611variable.
612.Pp
613This variable is used if and only if connected to an HTTP proxy, and
614is ignored if a user and/or a password were specified in the proxy
615URL.
616.It Ev HTTP_REFERER
617Specifies the referrer URL to use for HTTP requests.
618If set to
619.Dq auto ,
620the document URL will be used as referrer URL.
621.It Ev HTTP_USER_AGENT
622Specifies the User-Agent string to use for HTTP requests.
623This can be useful when working with HTTP origin or proxy servers that
624differentiate between user agents.
625.It Ev NETRC
626Specifies a file to use instead of
627.Pa ~/.netrc
628to look up login names and passwords for FTP sites.
629See
630.Xr ftp 1
631for a description of the file format.
632This feature is experimental.
633.It Ev NO_PROXY
634Either a single asterisk, which disables the use of proxies
635altogether, or a comma- or whitespace-separated list of hosts for
636which proxies should not be used.
637.It Ev no_proxy
638Same as
639.Ev NO_PROXY ,
640for compatibility.
641.El
642.Sh EXAMPLES
643To access a proxy server on
644.Pa proxy.example.com
645port 8080, set the
646.Ev HTTP_PROXY
647environment variable in a manner similar to this:
648.Pp
649.Dl HTTP_PROXY=http://proxy.example.com:8080
650.Pp
651If the proxy server requires authentication, there are
652two options available for passing the authentication data.
653The first method is by using the proxy URL:
654.Pp
655.Dl HTTP_PROXY=http://\*[Lt]user\*[Gt]:\*[Lt]pwd\*[Gt]@proxy.example.com:8080
656.Pp
657The second method is by using the
658.Ev HTTP_PROXY_AUTH
659environment variable:
660.Bd -literal -offset indent
661HTTP_PROXY=http://proxy.example.com:8080
662HTTP_PROXY_AUTH=basic:*:\*[Lt]user\*[Gt]:\*[Lt]pwd\*[Gt]
663.Ed
664.Pp
665To disable the use of a proxy for an HTTP server running on the local
666host, define
667.Ev NO_PROXY
668as follows:
669.Bd -literal -offset indent
670NO_PROXY=localhost,127.0.0.1
671.Ed
672.Sh SEE ALSO
673.\" .Xr fetch 1 ,
674.\" .Xr ftpio 3 ,
675.Xr ftp 1 ,
676.Xr ip 4
677.Rs
678.%A J. Postel
679.%A J. K. Reynolds
680.%D October 1985
681.%B File Transfer Protocol
682.%O RFC 959
683.Re
684.Rs
685.%A P. Deutsch
686.%A A. Emtage
687.%A A. Marine
688.%D May 1994
689.%T How to Use Anonymous FTP
690.%O RFC 1635
691.Re
692.Rs
693.%A T. Berners-Lee
694.%A L. Masinter
695.%A M. McCahill
696.%D December 1994
697.%T Uniform Resource Locators (URL)
698.%O RFC 1738
699.Re
700.Rs
701.%A R. Fielding
702.%A J. Gettys
703.%A J. Mogul
704.%A H. Frystyk
705.%A L. Masinter
706.%A P. Leach
707.%A T. Berners-Lee
708.%D January 1999
709.%B Hypertext Transfer Protocol -- HTTP/1.1
710.%O RFC 2616
711.Re
712.Rs
713.%A J. Franks
714.%A P. Hallam-Baker
715.%A J. Hostetler
716.%A S. Lawrence
717.%A P. Leach
718.%A A. Luotonen
719.%A L. Stewart
720.%D June 1999
721.%B HTTP Authentication: Basic and Digest Access Authentication
722.%O RFC 2617
723.Re
724.Sh HISTORY
725The
726.Nm fetch
727library first appeared in
728.Fx 3.0 .
729.Sh AUTHORS
730.An -nosplit
731The
732.Nm fetch
733library was mostly written by
734.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org
735with numerous suggestions from
736.An Jordan K. Hubbard Aq Mt jkh@FreeBSD.org ,
737.An Eugene Skepner Aq Mt eu@qub.com
738and other
739.Fx
740developers.
741It replaces the older
742.Nm ftpio
743library written by
744.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org
745and
746.An Jordan K. Hubbard Aq Mt jkh@FreeBSD.org .
747.Pp
748This manual page was written by
749.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
750.Sh BUGS
751Some parts of the library are not yet implemented.
752The most notable
753examples of this are
754.Fn fetchPutHTTP
755and FTP proxy support.
756.Pp
757There is no way to select a proxy at run-time other than setting the
758.Ev HTTP_PROXY
759or
760.Ev FTP_PROXY
761environment variables as appropriate.
762.Pp
763.Nm libfetch
764does not understand or obey 305 (Use Proxy) replies.
765.Pp
766Error numbers are unique only within a certain context; the error
767codes used for FTP and HTTP overlap, as do those used for resolver and
768system errors.
769For instance, error code 202 means "Command not
770implemented, superfluous at this site" in an FTP context and
771"Accepted" in an HTTP context.
772.Pp
773.Fn fetchStatFTP
774does not check that the result of an MDTM command is a valid date.
775.Pp
776The man page is incomplete, poorly written and produces badly
777formatted text.
778.Pp
779The error reporting mechanism is unsatisfactory.
780.Pp
781Some parts of the code are not fully reentrant.
782