aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorChong Yidong2012-11-09 16:34:17 +0800
committerChong Yidong2012-11-09 16:34:17 +0800
commit5b6372227ee9db95fdb1e7c88cca5059620e4754 (patch)
treee6000dd49d72d6555d56feecc9b8705d68966837 /doc
parent847a056110575995e0f68ccdc0c7561e3c563da3 (diff)
downloademacs-5b6372227ee9db95fdb1e7c88cca5059620e4754.tar.gz
emacs-5b6372227ee9db95fdb1e7c88cca5059620e4754.zip
More updates for the URL library manual.
* url.texi (Introduction): Move url-configuration-directory to Customization node. (Parsed URIs): Split into its own node. (URI Encoding): New node. (Defining New URLs): Remove empty chapter. (Retrieving URLs): Add an introduction. Doc fix for url-retrieve. Improve docs for url-queue-*. (Supported URL Types): Copyedits. Delete empty subnodes.
Diffstat (limited to 'doc')
-rw-r--r--doc/misc/ChangeLog11
-rw-r--r--doc/misc/url.texi526
2 files changed, 315 insertions, 222 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index d7af0d79c68..80d19f3adaa 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,14 @@
12012-11-09 Chong Yidong <cyd@gnu.org>
2
3 * url.texi (Introduction): Move url-configuration-directory to
4 Customization node.
5 (Parsed URIs): Split into its own node.
6 (URI Encoding): New node.
7 (Defining New URLs): Remove empty chapter.
8 (Retrieving URLs): Add an introduction. Doc fix for url-retrieve.
9 Improve docs for url-queue-*.
10 (Supported URL Types): Copyedits. Delete empty subnodes.
11
12012-11-08 Chong Yidong <cyd@gnu.org> 122012-11-08 Chong Yidong <cyd@gnu.org>
2 13
3 * url.texi (Introduction): Rename from Getting Started. Rewrite 14 * url.texi (Introduction): Rename from Getting Started. Rewrite
diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index 9124edfcf73..fdb3ab452f2 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -18,7 +18,7 @@
18@end direntry 18@end direntry
19 19
20@copying 20@copying
21This file documents @code{url} Emacs Lisp library. 21This is the manual for the @code{url} Emacs Lisp library.
22 22
23Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. 23Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc.
24 24
@@ -61,7 +61,6 @@ developing GNU and promoting software freedom.''
61* URI Parsing:: Parsing (and unparsing) URIs. 61* URI Parsing:: Parsing (and unparsing) URIs.
62* Retrieving URLs:: How to use this package to retrieve a URL. 62* Retrieving URLs:: How to use this package to retrieve a URL.
63* Supported URL Types:: Descriptions of URL types currently supported. 63* Supported URL Types:: Descriptions of URL types currently supported.
64* Defining New URLs:: How to define a URL loader for a new protocol.
65* General Facilities:: URLs can be cached, accessed via a gateway 64* General Facilities:: URLs can be cached, accessed via a gateway
66 and tracked in a history list. 65 and tracked in a history list.
67* Customization:: Variables you can alter. 66* Customization:: Variables you can alter.
@@ -79,12 +78,12 @@ developing GNU and promoting software freedom.''
79@cindex uniform resource locator 78@cindex uniform resource locator
80 79
81A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted 80A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted
82name, such as an Internet address, which identifies some name or 81name, such as an Internet address, that identifies some name or
83resource. The format of URIs is described in RFC 3986, which updates 82resource. The format of URIs is described in RFC 3986, which updates
84and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A 83and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A
85@dfn{Uniform Resource Locator} (URL) is an older but still-common 84@dfn{Uniform Resource Locator} (URL) is an older but still-common
86term, which basically refers to a URI corresponding to a resource 85term, which basically refers to a URI corresponding to a resource that
87which can be accessed over a network. 86can be accessed (usually over a network) in a specific way.
88 87
89 Here are some examples of URIs (taken from RFC 3986): 88 Here are some examples of URIs (taken from RFC 3986):
90 89
@@ -101,22 +100,9 @@ urn:oasis:names:specification:docbook:dtd:xml:4.1.2
101 100
102 This manual describes the @code{url} library, an Emacs Lisp library 101 This manual describes the @code{url} library, an Emacs Lisp library
103for parsing URIs and retrieving the resources to which they refer. 102for parsing URIs and retrieving the resources to which they refer.
104(The library is so-named due to historical reasons; nowadays, the 103(The library is so-named for historical reasons; nowadays, the ``URI''
105``URI'' terminology is regarded as the more general one, and ``URL'' 104terminology is regarded as the more general one, and ``URL'' is
106is technically obsolete despite its widespread vernacular usage.) 105technically obsolete despite its widespread vernacular usage.)
107
108@defvar url-configuration-directory
109@cindex configuration files
110The value of this variable specifies the name of the directory in
111which the @code{url} library stores its various configuration files,
112cache files, etc.
113
114The default value specifies a subdirectory named @file{url/} in the
115standard Emacs user data directory specified by the variable
116@code{user-emacs-directory} (normally @file{~/.emacs.d}). However,
117the old default was @file{~/.url}, and this directory is used instead
118if it exists.
119@end defvar
120 106
121@node URI Parsing 107@node URI Parsing
122@chapter URI Parsing 108@chapter URI Parsing
@@ -133,28 +119,38 @@ specifies the scheme component @samp{http}, the hostname component
133@samp{www.gnu.org}, and the path component @samp{/software/emacs/}. 119@samp{www.gnu.org}, and the path component @samp{/software/emacs/}.
134 120
135@cindex parsed URIs 121@cindex parsed URIs
136 The URI format is specified by RFC 3986. The @code{url} library 122 The format of URIs is specified by RFC 3986. The @code{url} library
137provides the Lisp function @code{url-generic-parse-url}, a 123provides the Lisp function @code{url-generic-parse-url}, a (mostly)
138standard-compliant URI parser, as well as the unparser 124standard-compliant URI parser, as well as function
139@code{url-recreate-url}: 125@code{url-recreate-url}, which converts a parsed URI back into a URI
140 126string.
141@defun url-generic-parse-url url 127
142This function returns a parsed version of the string @var{url}. 128@defun url-generic-parse-url uri-string
129This function returns a parsed version of the string @var{uri-string}.
143@end defun 130@end defun
144 131
145@defun url-recreate-url uri 132@defun url-recreate-url uri-obj
146@cindex unparsing URLs 133@cindex unparsing URLs
147Given a parsed URI, this function returns a corresponding URI string. 134Given a parsed URI, this function returns the corresponding URI string.
148@end defun 135@end defun
149 136
150@cindex parsed URI 137@cindex parsed URI
151 The return value of @code{url-generic-parse-url}, and the argument 138 The return value of @code{url-generic-parse-url}, and the argument
152expected by @code{url-recreate-url}, is a @dfn{parsed URI}, in the 139expected by @code{url-recreate-url}, is a @dfn{parsed URI}: a CL
153form of a CL structure whose slots hold the various components of the 140structure whose slots hold the various components of the URI.
154URI. @xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, 141@xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, for
155for details about CL structures. Most of the other functions in the 142details about CL structures. Most of the other functions in the
156@code{url} library act on parsed URIs. Each parsed URI structure 143@code{url} library act on parsed URIs.
157contains the following slots: 144
145@menu
146* Parsed URIs:: Format of parsed URI structures.
147* URI Encoding:: Non-@acronym{ASCII} characters in URIs.
148@end menu
149
150@node Parsed URIs
151@section Parsed URI structures
152
153 Each parsed URI structure contains the following slots:
158 154
159@table @code 155@table @code
160@item type 156@item type
@@ -185,7 +181,7 @@ The combination of the ``path'' and ``query'' components of the URI (a
185string), or @code{nil}. If the query component is present, it is the 181string), or @code{nil}. If the query component is present, it is the
186substring following the first @samp{?} character, and the path 182substring following the first @samp{?} character, and the path
187component is the substring before the @samp{?}. The meaning of these 183component is the substring before the @samp{?}. The meaning of these
188components depends on the service; they do not necessarily refer to a 184components is scheme-dependent; they do not necessarily refer to a
189file on a disk. 185file on a disk.
190 186
191@item target 187@item target
@@ -208,7 +204,7 @@ and/or password) are preceded by @samp{//}.
208@findex url-target 204@findex url-target
209@findex url-attributes 205@findex url-attributes
210@findex url-fullness 206@findex url-fullness
211The above slots have accessors named @code{url-@var{part}}, where 207These slots have accessors named @code{url-@var{part}}, where
212@var{part} is the slot name. For example, the accessor for the 208@var{part} is the slot name. For example, the accessor for the
213@code{host} slot is the function @code{url-host}. The @code{url-port} 209@code{host} slot is the function @code{url-host}. The @code{url-port}
214accessor returns the default port for the URI scheme if the parsed 210accessor returns the default port for the URI scheme if the parsed
@@ -220,40 +216,153 @@ URI's @var{port} slot is @code{nil}.
220(setf (url-port url) 80) 216(setf (url-port url) 80)
221@end example 217@end example
222 218
219@node URI Encoding
220@section URI Encoding
221
222@cindex percent encoding
223 The @code{url-generic-parse-url} parser does not obey RFC 3986 in
224one respect: it allows non-@acronym{ASCII} characters in URI strings.
225
226 Strictly speaking, RFC 3986 compatible URIs may only consist of
227@acronym{ASCII} characters; non-@acronym{ASCII} characters are
228represented by converting them to UTF-8 byte sequences, and performing
229@dfn{percent encoding} on the bytes. For example, the o-umlaut
230character is converted to the UTF-8 byte sequence @samp{\xD3\xA7},
231then percent encoded to @samp{%D3%A7}. (Certain ``reserved''
232@acronym{ASCII} characters must also be percent encoded when they
233appear in URI components.)
234
235 The function @code{url-encode-url} can be used to convert a URI
236string containing arbitrary characters to one that is properly
237percent-encoded in accordance with RFC 3986.
238
239@defun url-encode-url url-string
240This function return a properly URI-encoded version of
241@var{url-string}. It also performs @dfn{URI normalization},
242e.g.@: converting the scheme component to lowercase if it was
243previously uppercase.
244@end defun
245
246 To convert between a string containing arbitrary characters and a
247percent-encoded all-@acronym{ASCII} string, use the functions
248@code{url-hexify-string} and @code{url-unhex-string}:
249
250@defun url-hexify-string string &optional allowed-chars
251This function performs percent-encoding on @var{string}, and returns
252the result.
253
254If @var{string} is multibyte, it is first converted to a UTF-8 byte
255string. Each byte corresponding to an allowed character is left
256as-is, while all other bytes are converted to a three-character
257sequence: @samp{%} followed by two upper-case hex digits.
258
259@vindex url-unreserved-chars
260@cindex unreserved characters
261The allowed characters are specified by @var{allowed-chars}. If this
262argument is @code{nil}, the allowed characters are those specified as
263@dfn{unreserved characters} by RFC 3986 (see the variable
264@code{url-unreserved-chars}). Otherwise, @var{allowed-chars} should
265be a vector whose @var{n}-th element is non-@code{nil} if character
266@var{n} is allowed.
267@end defun
268
269@defun url-unhex-string string &optional allow-newlines
270This function replaces percent-encoding sequences in @var{string} with
271their character equivalents, and returns the resulting string.
272
273If @var{allow-newlines} is non-@code{nil}, it allows the decoding of
274carriage returns and line feeds, which are normally forbidden in URIs.
275@end defun
276
223@node Retrieving URLs 277@node Retrieving URLs
224@chapter Retrieving URLs 278@chapter Retrieving URLs
225 279
280 The @code{url} library defines the following three functions for
281retrieving the data specified by a URL. The actual retrieval protocol
282depends on the URL's URI scheme, and is performed by lower-level
283scheme-specific functions. (Those lower-level functions are not
284documented here, and generally should not be called directly.)
285
286 In each of these functions, the @var{url} argument can be either a
287string or a parsed URL structure. If it is a string, that string is
288passed through @code{url-encode-url} before using it, to ensure that
289it is properly URI-encoded (@pxref{URI Encoding}).
290
226@defun url-retrieve-synchronously url 291@defun url-retrieve-synchronously url
227Retrieve @var{url} synchronously and return a buffer containing the 292This function synchronously retrieves the data specified by @var{url},
228data. @var{url} is either a string or a parsed URL structure. Return 293and returns a buffer containing the data. The return value is
229@code{nil} if there are no data associated with it (the case for dired, 294@code{nil} if there is no data associated with the URL (as is the case
230info, or mailto URLs that need no further processing). 295for @code{dired}, @code{info}, and @code{mailto} URLs).
231@end defun 296@end defun
232 297
233@defun url-retrieve url callback &optional cbargs silent no-cookies 298@defun url-retrieve url callback &optional cbargs silent no-cookies
234Retrieve @var{url} asynchronously and call @var{callback} with args 299This function retrieves @var{url} asynchronously, calling the function
235@var{cbargs} when finished. The callback is called when the object 300@var{callback} when the object has been completely retrieved. The
236has been completely retrieved, with the current buffer containing the 301return value is the buffer into which the data will be inserted, or
237object and any MIME headers associated with it. @var{url} is either a 302@code{nil} if the process has already completed.
238string or a parsed URL structure. Returns the buffer @var{url} will 303
239load into, or @code{nil} if the process has already completed. 304The callback function is called this way:
240If the optional argument @var{silent} is non-@code{nil}, suppress 305
241progress messages. If the optional argument @var{no-cookies} is 306@example
242non-@code{nil}, do not store or send cookies. 307(apply @var{callback} @var{status} @var{cbargs})
308@end example
309
310@noindent
311where @var{status} is a plist representing what happened during the
312retrieval, with most recent events first, or an empty list if no
313events have occurred. Each pair in the plist is one of:
314
315@table @code
316@item (:redirect @var{redirected-to})
317This means that the request was redirected to the URL
318@var{redirected-to}.
319
320@item (:error (@var{error-symbol} . @var{data}))
321This means that an error occurred. If so desired, the error can be
322signaled with @code{(signal @var{error-symbol} @var{data})}.
323@end table
324
325When the callback function is called, the current buffer is the one
326containing the retrieved data (if any). The buffer also contains any
327MIME headers associated with the data retrieval.
328
329If the optional argument @var{silent} is non-@code{nil}, progress
330messages are suppressed. If the optional argument @var{no-cookies} is
331non-@code{nil}, cookies are not stored or sent.
243@end defun 332@end defun
244 333
245@vindex url-queue-parallel-processes
246@vindex url-queue-timeout
247@defun url-queue-retrieve url callback &optional cbargs silent no-cookies 334@defun url-queue-retrieve url callback &optional cbargs silent no-cookies
248This acts like the @code{url-retrieve} function, but with limits on 335This function acts like @code{url-retrieve}, but with limits on the
249the degree of parallelism. The option @code{url-queue-parallel-processes} 336number of concurrently-running network processes. The option
250controls the number of concurrent processes, and the option 337@code{url-queue-parallel-processes} controls the number of concurrent
251@code{url-queue-timeout} sets a timeout in seconds. 338processes, and the option @code{url-queue-timeout} sets a timeout in
339seconds.
340
341To use this function, you must @code{(require 'url-queue)}.
252@end defun 342@end defun
253 343
344@vindex url-queue-parallel-processes
345@defopt url-queue-parallel-processes
346The value of this option is an integer specifying the maximum number
347of concurrent @code{url-queue-retrieve} network processes. If the
348number of @code{url-queue-retrieve} calls is larger than this number,
349later ones are queued until ealier ones are finished.
350@end defopt
351
352@vindex url-queue-timeout
353@defopt url-queue-timeout
354The value of this option is a number specifying the maximum lifetime
355of a @code{url-queue-retrieve} network process, once it is started.
356If a process is not finished by then, it is killed and removed from
357the queue.
358@end defopt
359
254@node Supported URL Types 360@node Supported URL Types
255@chapter Supported URL Types 361@chapter Supported URL Types
256 362
363This chapter describes functions and variables affecting URL retrieval
364for specific schemes.
365
257@menu 366@menu
258* http/https:: Hypertext Transfer Protocol. 367* http/https:: Hypertext Transfer Protocol.
259* file/ftp:: Local files and FTP archives. 368* file/ftp:: Local files and FTP archives.
@@ -264,48 +373,31 @@ controls the number of concurrent processes, and the option
264* irc:: Internet Relay Chat. 373* irc:: Internet Relay Chat.
265* data:: Embedded data URLs. 374* data:: Embedded data URLs.
266* nfs:: Networked File System 375* nfs:: Networked File System
267@c * finger::
268@c * gopher::
269@c * netrek::
270@c * prospero::
271* cid:: Content-ID.
272* about::
273* ldap:: Lightweight Directory Access Protocol 376* ldap:: Lightweight Directory Access Protocol
274* imap:: IMAP mailboxes.
275* man:: Unix man pages. 377* man:: Unix man pages.
276@end menu 378@end menu
277 379
278@node http/https 380@node http/https
279@section @code{http} and @code{https} 381@section @code{http} and @code{https}
280 382
281The scheme @code{http} is Hypertext Transfer Protocol. The library 383The @code{http} scheme refers to the Hypertext Transfer Protocol. The
282supports version 1.1, specified in RFC 2616. (This supersedes 1.0, 384@code{url} library supports HTTP version 1.1, specified in RFC 2616.
283defined in RFC 1945) HTTP URLs have the following form, where most of 385Its default port is 80.
284the parts are optional: 386
285@example 387 The @code{https} scheme is a secure version of @code{http}, with
286http://@var{user}:@var{password}@@@var{host}:@var{port}/@var{path}?@var{searchpart}#@var{fragment} 388transmission via SSL. It is defined in RFC 2069, and its default port
287@end example 389is 443. When using @code{https}, the @code{url} library performs SSL
288@c The @code{:@var{port}} part is optional, and @var{port} defaults to 390encryption via the @code{ssl} library, by forcing the @code{ssl}
289@c 80. The @code{/@var{path}} part, if present, is a slash-separated 391gateway method to be used. @xref{Gateways in general}.
290@c series elements. The @code{?@var{searchpart}}, if present, is the
291@c query for a search or the content of a form submission. The
292@c @code{#fragment} part, if present, is a location in the document.
293
294The scheme @code{https} is a secure version of @code{http}, with
295transmission via SSL. It is defined in RFC 2069. Its default port is
296443. This scheme depends on SSL support in Emacs via the
297@file{ssl.el} library and is actually implemented by forcing the
298@code{ssl} gateway method to be used. @xref{Gateways in general}.
299 392
300@defopt url-honor-refresh-requests 393@defopt url-honor-refresh-requests
301This controls honoring of HTTP @samp{Refresh} headers by which 394If this option is non-@code{nil} (the default), the @code{url} library
302servers can direct clients to reload documents from the same URL or a 395honors the HTTP @samp{Refresh} header, which is used by servers to
303or different one. @code{nil} means they will not be honored, 396direct clients to reload documents from the same URL or a or different
304@code{t} (the default) means they will always be honored, and 397one. If the value is @code{nil}, the @samp{Refresh} header is
305otherwise the user will be asked on each request. 398ignored; any other value means to ask the user on each request.
306@end defopt 399@end defopt
307 400
308
309@menu 401@menu
310* Cookies:: 402* Cookies::
311* HTTP language/coding:: 403* HTTP language/coding::
@@ -437,26 +529,32 @@ emacs-mime, The Emacs MIME Manual}.
437@cindex compressed files 529@cindex compressed files
438@cindex dired 530@cindex dired
439 531
532The @code{ftp} and @code{file} schemes are defined in RFC 1808. The
533@code{url} library treats @samp{ftp:} and @samp{file:} as synonymous.
534Such URLs have the form
535
440@example 536@example
441ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 537ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
442file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 538file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
443@end example 539@end example
444 540
445These schemes are defined in RFC 1808. 541@noindent
446@samp{ftp:} and @samp{file:} are synonymous in this library. They 542If the URL specifies a local file, it is retrieved by reading the file
447allow reading arbitrary files from hosts. Either @samp{ange-ftp} 543contents in the usual way. If it specifies a remote file, it is
448(Emacs) or @samp{efs} (XEmacs) is used to retrieve them from remote 544retrieved using the Ange-FTP package. @xref{Remote Files,,, emacs,
449hosts. Local files are accessed directly. 545The GNU Emacs Manual}.
450 546
451Compressed files are handled, but support is hard-coded so that 547 When retrieving a compressed file, it is automatically uncompressed
452@code{jka-compr-compression-info-list} and so on have no affect. 548if it has the file suffix @file{.z}, @file{.gz}, @file{.Z},
453Suffixes recognized are @samp{.z}, @samp{.gz}, @samp{.Z} and 549@file{.bz2}, or @file{.xz}. (The list of supported suffixes is
454@samp{.bz2}. 550hard-coded, and cannot be altered by customizing
551@code{jka-compr-compression-info-list}.)
455 552
456@defopt url-directory-index-file 553@defopt url-directory-index-file
457The filename to look for when indexing a directory, default 554This option specifies the filename to look for when a @code{file} or
458@samp{"index.html"}. If this file exists, and is readable, then it 555@code{ftp} URL specifies a directory. The default is
459will be viewed instead of using @code{dired} to view the directory. 556@file{index.html}. If this file exists and is readable, it is viewed.
557Otherwise, Emacs visits the directory using Dired.
460@end defopt 558@end defopt
461 559
462@node info 560@node info
@@ -465,47 +563,53 @@ will be viewed instead of using @code{dired} to view the directory.
465@cindex Texinfo 563@cindex Texinfo
466@findex Info-goto-node 564@findex Info-goto-node
467 565
566The @code{info} scheme is non-standard. Such URLs have the form
567
468@example 568@example
469info:@var{file}#@var{node} 569info:@var{file}#@var{node}
470@end example 570@end example
471 571
472Info URLs are not officially defined. They invoke 572@noindent
473@code{Info-goto-node} with argument @samp{(@var{file})@var{node}}. 573and are retrieved by invoking @code{Info-goto-node} with argument
474@samp{#@var{node}} is optional, defaulting to @samp{Top}. 574@samp{(@var{file})@var{node}}. If @samp{#@var{node}} is omitted, the
575@samp{Top} node is opened.
475 576
476@node mailto 577@node mailto
477@section mailto 578@section mailto
478 579
479@cindex mailto 580@cindex mailto
480@cindex email 581@cindex email
481A mailto URL will send an email message to the address in the 582A @code{mailto} URL specifies an email message to be sent to a given
482URL, for example @samp{mailto:foo@@bar.com} would compose a 583email address. For example, @samp{mailto:foo@@bar.com} specifies
483message to @samp{foo@@bar.com}. 584sending a message to @samp{foo@@bar.com}. The ``retrieval method''
484 585for such URLs is to open a mail composition buffer in which the
485@defopt url-mail-command 586appropriate content (e.g.@: the recipient address) has been filled in.
486@vindex mail-user-agent
487The function called whenever url needs to send mail. This should
488normally be left to default from @var{mail-user-agent}. @xref{Mail
489Methods, , Mail-Composition Methods, emacs, The GNU Emacs Manual}.
490@end defopt
491 587
492An @samp{X-Url-From} header field containing the URL of the document 588 As defined in RFC 2368, a @code{mailto} URL has the form
493that contained the mailto URL is added if that URL is known.
494 589
495RFC 2368 extends the definition of mailto URLs in RFC 1738.
496The form of a mailto URL is
497@example 590@example
498@samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]} 591@samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]}
499@end example 592@end example
500@noindent where an arbitrary number of @var{header}s can be added. If the
501@var{header} is @samp{body}, then @var{contents} is put in the body
502otherwise a @var{header} header field is created with @var{contents}
503as its contents. Note that the URL library does not consider any
504headers ``dangerous'' so you should check them before sending the
505message.
506 593
507@c Fixme: update 594@noindent
508Email messages are defined in @sc{rfc}822. 595where an arbitrary number of @var{header}s can be added. If the
596@var{header} is @samp{body}, then @var{contents} is put in the message
597body; otherwise, a @var{header} header field is created with
598@var{contents} as its contents. Note that the @code{url} library does
599not perform any checking of @var{header} or @var{contents}, so you
600should check them before sending the message.
601
602@defopt url-mail-command
603@vindex mail-user-agent
604The value of this variable is the function called whenever url needs
605to send mail. This should normally be left its default, which is the
606standard mail-composition command @code{compose-mail}. @xref{Sending
607Mail,,, emacs, The GNU Emacs Manual}.
608@end defopt
609
610 If the document containing the @code{mailto} URL itself possessed a
611known URL, Emacs automatically inserts an @samp{X-Url-From} header
612field into the mail buffer, specifying that URL.
509 613
510@node news/nntp/snews 614@node news/nntp/snews
511@section @code{news}, @code{nntp} and @code{snews} 615@section @code{news}, @code{nntp} and @code{snews}
@@ -515,11 +619,13 @@ Email messages are defined in @sc{rfc}822.
515@cindex NNTP 619@cindex NNTP
516@cindex snews 620@cindex snews
517 621
518@c draft-gilman-news-url-01 622The @code{news}, @code{nntp}, and @code{snews} schemes, defined in RFC
519The network news URL scheme take the following forms following RFC 6231738, are used for reading Usenet newsgroups. For compatibility with
5201738 except that for compatibility with other clients, host and port 624non-standard-compliant news clients, the @code{url} library allows
521fields may be included in news URLs though they are properly only 625host and port fields to be included in @code{news} URLs, even though
522allowed for nntp an snews. 626they are properly only allowed for @code{nntp} and @code{snews}.
627
628 @code{news} and @code{nntp} URLs have the following form:
523 629
524@table @samp 630@table @samp
525@item news:@var{newsgroup} 631@item news:@var{newsgroup}
@@ -534,24 +640,22 @@ Retrieves a list of all available newsgroups;
534Similar to the @samp{news} versions. 640Similar to the @samp{news} versions.
535@end table 641@end table
536 642
537@samp{:@var{port}} is optional and defaults to :119. 643 The default port for @code{nntp} (and @code{news}) is 119. The
538 644difference between an @code{nntp} URL and a @code{news} URL is that an
539@samp{snews} is the same as @samp{nntp} except that the default port 645@code{nttp} URL may specify an article by its number. The
540is :563. 646@samp{snews} scheme is the same as @samp{nntp}, except that it is
541@cindex SSL 647tunneled through SSL and has default port 563.
542(It is tunneled through SSL.)
543 648
544An @samp{nntp} URL is the same as a news URL, except that the URL may 649 These URLs are retrieved via the Gnus package.
545specify an article by its number.
546 650
547@defopt url-news-server
548This variable can be used to override the default news server.
549Usually this will be set by the Gnus package, which is used to fetch
550news.
551@cindex environment variable 651@cindex environment variable
552@vindex NNTPSERVER 652@vindex NNTPSERVER
553It may be set from the conventional environment variable 653@defopt url-news-server
554@code{NNTPSERVER}. 654This variable specifies the default news server from which to fetch
655news, if no server was specified in the URL. The default value,
656@code{nil}, means to use the server specified by the standard
657environment variable @samp{NNTPSERVER}, or @samp{news} if that
658environment variable is unset.
555@end defopt 659@end defopt
556 660
557@node rlogin/telnet/tn3270 661@node rlogin/telnet/tn3270
@@ -562,12 +666,15 @@ It may be set from the conventional environment variable
562@cindex terminal emulation 666@cindex terminal emulation
563@findex terminal-emulator 667@findex terminal-emulator
564 668
565These URL schemes from RFC 1738 for logon via a terminal emulator have 669These URL schemes are defined in RFC 1738, and are used for logging in
566the form 670via a terminal emulator. They have the form
671
567@example 672@example
568telnet://@var{user}:@var{password}@@@var{host}:@var{port} 673telnet://@var{user}:@var{password}@@@var{host}:@var{port}
569@end example 674@end example
570but the @code{:@var{password}} component is ignored. 675
676@noindent
677but the @var{password} component is ignored.
571 678
572To handle rlogin, telnet and tn3270 URLs, a @code{rlogin}, 679To handle rlogin, telnet and tn3270 URLs, a @code{rlogin},
573@code{telnet} or @code{tn3270} (the program names and arguments are 680@code{telnet} or @code{tn3270} (the program names and arguments are
@@ -581,39 +688,43 @@ Well-known ports are used if the URL does not specify a port.
581@cindex ZEN IRC 688@cindex ZEN IRC
582@cindex ERC 689@cindex ERC
583@cindex rcirc 690@cindex rcirc
584@c Fixme: reference (was http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt) 691
585@dfn{Internet Relay Chat} (IRC) is handled by handing off the @sc{irc} 692 The @code{irc} scheme is defined in the Internet Draft at
586session to a function named in @code{url-irc-function}. 693@url{http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt} (which
694was never approved as an RFC). Such URLs have the form
695
696@example
697irc://@var{host}:@var{port}/@var{target},@var{needpass}
698@end example
699
700@noindent
701and are retrieved by opening an @acronym{IRC} session using the
702function specified by @code{url-irc-function}.
587 703
588@defopt url-irc-function 704@defopt url-irc-function
589A function to actually open an IRC connection. 705The value of this option is a function, which is called to open an IRC
590This function 706connection for @code{irc} URLs. This function must take five
591must take five arguments, @var{host}, @var{port}, @var{channel}, 707arguments, @var{host}, @var{port}, @var{channel}, @var{user} and
592@var{user} and @var{password}. The @var{channel} argument specifies the 708@var{password}. The @var{channel} argument specifies the channel to
593channel to join immediately, this can be @code{nil}. By default this is 709join immediately, and may be @code{nil}.
594@code{url-irc-rcirc}. 710
711The default is @code{url-irc-rcirc}, which uses the Rcirc package.
712Other options are @code{url-irc-erc} (which uses ERC) and
713@code{url-irc-zenirc} (which uses ZenIRC).
595@end defopt 714@end defopt
596@defun url-irc-rcirc host port channel user password
597Processes the arguments and lets @code{rcirc} handle the session.
598@end defun
599@defun url-irc-erc host port channel user password
600Processes the arguments and lets @code{ERC} handle the session.
601@end defun
602@defun url-irc-zenirc host port channel user password
603Processes the arguments and lets @code{zenirc} handle the session.
604@end defun
605 715
606@node data 716@node data
607@section data 717@section data
608@cindex data URLs 718@cindex data URLs
609 719
720 The @code{data} scheme, defined in RFC 2397, contains MIME data in
721the URL itself. Such URLs have the form
722
610@example 723@example
611data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data} 724data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data}
612@end example 725@end example
613 726
614Data URLs contain MIME data in the URL itself. They are defined in 727@noindent
615RFC 2397.
616
617@var{media-type} is a MIME @samp{Content-Type} string, possibly 728@var{media-type} is a MIME @samp{Content-Type} string, possibly
618including parameters. It defaults to 729including parameters. It defaults to
619@samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be 730@samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be
@@ -626,14 +737,14 @@ present, the @var{data} are base64-encoded.
626@cindex Network File System 737@cindex Network File System
627@cindex automounter 738@cindex automounter
628 739
740The @code{nfs} scheme, defined in RFC 2224, is similar to @code{ftp}
741except that it points to a file on a remote host that is handled by an
742NFS automounter on the local host. Such URLs have the form
743
629@example 744@example
630nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 745nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
631@end example 746@end example
632 747
633The @samp{nfs:} scheme is defined in RFC 2224. It is similar to
634@samp{ftp:} except that it points to a file on a remote host that is
635handled by the automounter on the local host.
636
637@defvar url-nfs-automounter-directory-spec 748@defvar url-nfs-automounter-directory-spec
638@end defvar 749@end defvar
639A string saying how to invoke the NFS automounter. Certain @samp{%} 750A string saying how to invoke the NFS automounter. Certain @samp{%}
@@ -656,15 +767,6 @@ A literal @samp{%}.
656 767
657Each can be used any number of times. 768Each can be used any number of times.
658 769
659@node cid
660@section cid
661@cindex Content-ID
662
663RFC 2111
664
665@node about
666@section about
667
668@node ldap 770@node ldap
669@section ldap 771@section ldap
670@cindex LDAP 772@cindex LDAP
@@ -672,50 +774,21 @@ RFC 2111
672 774
673The LDAP scheme is defined in RFC 2255. 775The LDAP scheme is defined in RFC 2255.
674 776
675@node imap
676@section imap
677@cindex IMAP
678
679RFC 2192
680
681@node man 777@node man
682@section man 778@section man
683@cindex @command{man} 779@cindex @command{man}
684@cindex Unix man pages 780@cindex Unix man pages
685@findex man 781@findex man
686 782
783The @code{man} scheme is a non-standard one. Such URLs have the form
784
687@example 785@example
688@samp{man:@var{page-spec}} 786@samp{man:@var{page-spec}}
689@end example 787@end example
690 788
691This is a non-standard scheme. @var{page-spec} is passed directly to 789@noindent
692the Lisp @code{man} function. 790and are retrieved by passing @var{page-spec} to the Lisp function
693 791@code{man}.
694@node Defining New URLs
695@chapter Defining New URLs
696
697@menu
698* Naming conventions::
699* Required functions::
700* Optional functions::
701* Asynchronous fetching::
702* Supporting file-name-handlers::
703@end menu
704
705@node Naming conventions
706@section Naming conventions
707
708@node Required functions
709@section Required functions
710
711@node Optional functions
712@section Optional functions
713
714@node Asynchronous fetching
715@section Asynchronous fetching
716
717@node Supporting file-name-handlers
718@section Supporting file-name-handlers
719 792
720@node General Facilities 793@node General Facilities
721@chapter General Facilities 794@chapter General Facilities
@@ -1136,11 +1209,9 @@ You can use this function to do completion of URLs from the history.
1136@node Customization 1209@node Customization
1137@chapter Customization 1210@chapter Customization
1138 1211
1139@section Environment Variables
1140
1141@cindex environment variables 1212@cindex environment variables
1142The following environment variables affect the library's operation at 1213 The following environment variables affect the @code{url} library's
1143startup. 1214operation at startup.
1144 1215
1145@table @code 1216@table @code
1146@item TMPDIR 1217@item TMPDIR
@@ -1150,10 +1221,21 @@ If this is defined, @var{url-temporary-directory} is initialized from
1150it. 1221it.
1151@end table 1222@end table
1152 1223
1153@section General User Options 1224 The following user options affect the general operation of
1225@code{url} library.
1226
1227@defopt url-configuration-directory
1228@cindex configuration files
1229The value of this variable specifies the name of the directory where
1230the @code{url} library stores its various configuration files, cache
1231files, etc.
1154 1232
1155The following user options, settable with Customize, affect the 1233The default value specifies a subdirectory named @file{url/} in the
1156general operation of the package. 1234standard Emacs user data directory specified by the variable
1235@code{user-emacs-directory} (normally @file{~/.emacs.d}). However,
1236the old default was @file{~/.url}, and this directory is used instead
1237if it exists.
1238@end defopt
1157 1239
1158@defopt url-debug 1240@defopt url-debug
1159@cindex debugging 1241@cindex debugging