diff options
| author | Chong Yidong | 2012-11-09 16:34:17 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-11-09 16:34:17 +0800 |
| commit | 5b6372227ee9db95fdb1e7c88cca5059620e4754 (patch) | |
| tree | e6000dd49d72d6555d56feecc9b8705d68966837 /doc | |
| parent | 847a056110575995e0f68ccdc0c7561e3c563da3 (diff) | |
| download | emacs-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/ChangeLog | 11 | ||||
| -rw-r--r-- | doc/misc/url.texi | 526 |
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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-11-08 Chong Yidong <cyd@gnu.org> | 12 | 2012-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 |
| 21 | This file documents @code{url} Emacs Lisp library. | 21 | This is the manual for the @code{url} Emacs Lisp library. |
| 22 | 22 | ||
| 23 | Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. | 23 | Copyright @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 | ||
| 81 | A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted | 80 | A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted |
| 82 | name, such as an Internet address, which identifies some name or | 81 | name, such as an Internet address, that identifies some name or |
| 83 | resource. The format of URIs is described in RFC 3986, which updates | 82 | resource. The format of URIs is described in RFC 3986, which updates |
| 84 | and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A | 83 | and 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 |
| 86 | term, which basically refers to a URI corresponding to a resource | 85 | term, which basically refers to a URI corresponding to a resource that |
| 87 | which can be accessed over a network. | 86 | can 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 |
| 103 | for parsing URIs and retrieving the resources to which they refer. | 102 | for 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'' | 104 | terminology is regarded as the more general one, and ``URL'' is |
| 106 | is technically obsolete despite its widespread vernacular usage.) | 105 | technically obsolete despite its widespread vernacular usage.) |
| 107 | |||
| 108 | @defvar url-configuration-directory | ||
| 109 | @cindex configuration files | ||
| 110 | The value of this variable specifies the name of the directory in | ||
| 111 | which the @code{url} library stores its various configuration files, | ||
| 112 | cache files, etc. | ||
| 113 | |||
| 114 | The default value specifies a subdirectory named @file{url/} in the | ||
| 115 | standard Emacs user data directory specified by the variable | ||
| 116 | @code{user-emacs-directory} (normally @file{~/.emacs.d}). However, | ||
| 117 | the old default was @file{~/.url}, and this directory is used instead | ||
| 118 | if 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 |
| 137 | provides the Lisp function @code{url-generic-parse-url}, a | 123 | provides the Lisp function @code{url-generic-parse-url}, a (mostly) |
| 138 | standard-compliant URI parser, as well as the unparser | 124 | standard-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 | 126 | string. | |
| 141 | @defun url-generic-parse-url url | 127 | |
| 142 | This function returns a parsed version of the string @var{url}. | 128 | @defun url-generic-parse-url uri-string |
| 129 | This 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 |
| 147 | Given a parsed URI, this function returns a corresponding URI string. | 134 | Given 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 |
| 152 | expected by @code{url-recreate-url}, is a @dfn{parsed URI}, in the | 139 | expected by @code{url-recreate-url}, is a @dfn{parsed URI}: a CL |
| 153 | form of a CL structure whose slots hold the various components of the | 140 | structure whose slots hold the various components of the URI. |
| 154 | URI. @xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, | 141 | @xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, for |
| 155 | for details about CL structures. Most of the other functions in the | 142 | details 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. |
| 157 | contains 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 | |||
| 185 | string), or @code{nil}. If the query component is present, it is the | 181 | string), or @code{nil}. If the query component is present, it is the |
| 186 | substring following the first @samp{?} character, and the path | 182 | substring following the first @samp{?} character, and the path |
| 187 | component is the substring before the @samp{?}. The meaning of these | 183 | component is the substring before the @samp{?}. The meaning of these |
| 188 | components depends on the service; they do not necessarily refer to a | 184 | components is scheme-dependent; they do not necessarily refer to a |
| 189 | file on a disk. | 185 | file 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 |
| 211 | The above slots have accessors named @code{url-@var{part}}, where | 207 | These 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} |
| 214 | accessor returns the default port for the URI scheme if the parsed | 210 | accessor 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 | ||
| 224 | one 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 | ||
| 228 | represented by converting them to UTF-8 byte sequences, and performing | ||
| 229 | @dfn{percent encoding} on the bytes. For example, the o-umlaut | ||
| 230 | character is converted to the UTF-8 byte sequence @samp{\xD3\xA7}, | ||
| 231 | then percent encoded to @samp{%D3%A7}. (Certain ``reserved'' | ||
| 232 | @acronym{ASCII} characters must also be percent encoded when they | ||
| 233 | appear in URI components.) | ||
| 234 | |||
| 235 | The function @code{url-encode-url} can be used to convert a URI | ||
| 236 | string containing arbitrary characters to one that is properly | ||
| 237 | percent-encoded in accordance with RFC 3986. | ||
| 238 | |||
| 239 | @defun url-encode-url url-string | ||
| 240 | This function return a properly URI-encoded version of | ||
| 241 | @var{url-string}. It also performs @dfn{URI normalization}, | ||
| 242 | e.g.@: converting the scheme component to lowercase if it was | ||
| 243 | previously uppercase. | ||
| 244 | @end defun | ||
| 245 | |||
| 246 | To convert between a string containing arbitrary characters and a | ||
| 247 | percent-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 | ||
| 251 | This function performs percent-encoding on @var{string}, and returns | ||
| 252 | the result. | ||
| 253 | |||
| 254 | If @var{string} is multibyte, it is first converted to a UTF-8 byte | ||
| 255 | string. Each byte corresponding to an allowed character is left | ||
| 256 | as-is, while all other bytes are converted to a three-character | ||
| 257 | sequence: @samp{%} followed by two upper-case hex digits. | ||
| 258 | |||
| 259 | @vindex url-unreserved-chars | ||
| 260 | @cindex unreserved characters | ||
| 261 | The allowed characters are specified by @var{allowed-chars}. If this | ||
| 262 | argument 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 | ||
| 265 | be 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 | ||
| 270 | This function replaces percent-encoding sequences in @var{string} with | ||
| 271 | their character equivalents, and returns the resulting string. | ||
| 272 | |||
| 273 | If @var{allow-newlines} is non-@code{nil}, it allows the decoding of | ||
| 274 | carriage 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 | ||
| 281 | retrieving the data specified by a URL. The actual retrieval protocol | ||
| 282 | depends on the URL's URI scheme, and is performed by lower-level | ||
| 283 | scheme-specific functions. (Those lower-level functions are not | ||
| 284 | documented here, and generally should not be called directly.) | ||
| 285 | |||
| 286 | In each of these functions, the @var{url} argument can be either a | ||
| 287 | string or a parsed URL structure. If it is a string, that string is | ||
| 288 | passed through @code{url-encode-url} before using it, to ensure that | ||
| 289 | it is properly URI-encoded (@pxref{URI Encoding}). | ||
| 290 | |||
| 226 | @defun url-retrieve-synchronously url | 291 | @defun url-retrieve-synchronously url |
| 227 | Retrieve @var{url} synchronously and return a buffer containing the | 292 | This function synchronously retrieves the data specified by @var{url}, |
| 228 | data. @var{url} is either a string or a parsed URL structure. Return | 293 | and 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 |
| 230 | info, or mailto URLs that need no further processing). | 295 | for @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 |
| 234 | Retrieve @var{url} asynchronously and call @var{callback} with args | 299 | This 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 |
| 236 | has been completely retrieved, with the current buffer containing the | 301 | return value is the buffer into which the data will be inserted, or |
| 237 | object and any MIME headers associated with it. @var{url} is either a | 302 | @code{nil} if the process has already completed. |
| 238 | string or a parsed URL structure. Returns the buffer @var{url} will | 303 | |
| 239 | load into, or @code{nil} if the process has already completed. | 304 | The callback function is called this way: |
| 240 | If the optional argument @var{silent} is non-@code{nil}, suppress | 305 | |
| 241 | progress messages. If the optional argument @var{no-cookies} is | 306 | @example |
| 242 | non-@code{nil}, do not store or send cookies. | 307 | (apply @var{callback} @var{status} @var{cbargs}) |
| 308 | @end example | ||
| 309 | |||
| 310 | @noindent | ||
| 311 | where @var{status} is a plist representing what happened during the | ||
| 312 | retrieval, with most recent events first, or an empty list if no | ||
| 313 | events have occurred. Each pair in the plist is one of: | ||
| 314 | |||
| 315 | @table @code | ||
| 316 | @item (:redirect @var{redirected-to}) | ||
| 317 | This means that the request was redirected to the URL | ||
| 318 | @var{redirected-to}. | ||
| 319 | |||
| 320 | @item (:error (@var{error-symbol} . @var{data})) | ||
| 321 | This means that an error occurred. If so desired, the error can be | ||
| 322 | signaled with @code{(signal @var{error-symbol} @var{data})}. | ||
| 323 | @end table | ||
| 324 | |||
| 325 | When the callback function is called, the current buffer is the one | ||
| 326 | containing the retrieved data (if any). The buffer also contains any | ||
| 327 | MIME headers associated with the data retrieval. | ||
| 328 | |||
| 329 | If the optional argument @var{silent} is non-@code{nil}, progress | ||
| 330 | messages are suppressed. If the optional argument @var{no-cookies} is | ||
| 331 | non-@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 |
| 248 | This acts like the @code{url-retrieve} function, but with limits on | 335 | This function acts like @code{url-retrieve}, but with limits on the |
| 249 | the degree of parallelism. The option @code{url-queue-parallel-processes} | 336 | number of concurrently-running network processes. The option |
| 250 | controls 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. | 338 | processes, and the option @code{url-queue-timeout} sets a timeout in |
| 339 | seconds. | ||
| 340 | |||
| 341 | To 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 | ||
| 346 | The value of this option is an integer specifying the maximum number | ||
| 347 | of concurrent @code{url-queue-retrieve} network processes. If the | ||
| 348 | number of @code{url-queue-retrieve} calls is larger than this number, | ||
| 349 | later ones are queued until ealier ones are finished. | ||
| 350 | @end defopt | ||
| 351 | |||
| 352 | @vindex url-queue-timeout | ||
| 353 | @defopt url-queue-timeout | ||
| 354 | The value of this option is a number specifying the maximum lifetime | ||
| 355 | of a @code{url-queue-retrieve} network process, once it is started. | ||
| 356 | If a process is not finished by then, it is killed and removed from | ||
| 357 | the 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 | ||
| 363 | This chapter describes functions and variables affecting URL retrieval | ||
| 364 | for 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 | ||
| 281 | The scheme @code{http} is Hypertext Transfer Protocol. The library | 383 | The @code{http} scheme refers to the Hypertext Transfer Protocol. The |
| 282 | supports version 1.1, specified in RFC 2616. (This supersedes 1.0, | 384 | @code{url} library supports HTTP version 1.1, specified in RFC 2616. |
| 283 | defined in RFC 1945) HTTP URLs have the following form, where most of | 385 | Its default port is 80. |
| 284 | the parts are optional: | 386 | |
| 285 | @example | 387 | The @code{https} scheme is a secure version of @code{http}, with |
| 286 | http://@var{user}:@var{password}@@@var{host}:@var{port}/@var{path}?@var{searchpart}#@var{fragment} | 388 | transmission via SSL. It is defined in RFC 2069, and its default port |
| 287 | @end example | 389 | is 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 | 390 | encryption via the @code{ssl} library, by forcing the @code{ssl} |
| 289 | @c 80. The @code{/@var{path}} part, if present, is a slash-separated | 391 | gateway 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 | |||
| 294 | The scheme @code{https} is a secure version of @code{http}, with | ||
| 295 | transmission via SSL. It is defined in RFC 2069. Its default port is | ||
| 296 | 443. 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 |
| 301 | This controls honoring of HTTP @samp{Refresh} headers by which | 394 | If this option is non-@code{nil} (the default), the @code{url} library |
| 302 | servers can direct clients to reload documents from the same URL or a | 395 | honors the HTTP @samp{Refresh} header, which is used by servers to |
| 303 | or different one. @code{nil} means they will not be honored, | 396 | direct clients to reload documents from the same URL or a or different |
| 304 | @code{t} (the default) means they will always be honored, and | 397 | one. If the value is @code{nil}, the @samp{Refresh} header is |
| 305 | otherwise the user will be asked on each request. | 398 | ignored; 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 | ||
| 532 | The @code{ftp} and @code{file} schemes are defined in RFC 1808. The | ||
| 533 | @code{url} library treats @samp{ftp:} and @samp{file:} as synonymous. | ||
| 534 | Such URLs have the form | ||
| 535 | |||
| 440 | @example | 536 | @example |
| 441 | ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} | 537 | ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} |
| 442 | file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} | 538 | file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} |
| 443 | @end example | 539 | @end example |
| 444 | 540 | ||
| 445 | These schemes are defined in RFC 1808. | 541 | @noindent |
| 446 | @samp{ftp:} and @samp{file:} are synonymous in this library. They | 542 | If the URL specifies a local file, it is retrieved by reading the file |
| 447 | allow reading arbitrary files from hosts. Either @samp{ange-ftp} | 543 | contents 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 | 544 | retrieved using the Ange-FTP package. @xref{Remote Files,,, emacs, |
| 449 | hosts. Local files are accessed directly. | 545 | The GNU Emacs Manual}. |
| 450 | 546 | ||
| 451 | Compressed 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. | 548 | if it has the file suffix @file{.z}, @file{.gz}, @file{.Z}, |
| 453 | Suffixes recognized are @samp{.z}, @samp{.gz}, @samp{.Z} and | 549 | @file{.bz2}, or @file{.xz}. (The list of supported suffixes is |
| 454 | @samp{.bz2}. | 550 | hard-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 |
| 457 | The filename to look for when indexing a directory, default | 554 | This 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 |
| 459 | will 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. |
| 557 | Otherwise, 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 | ||
| 566 | The @code{info} scheme is non-standard. Such URLs have the form | ||
| 567 | |||
| 468 | @example | 568 | @example |
| 469 | info:@var{file}#@var{node} | 569 | info:@var{file}#@var{node} |
| 470 | @end example | 570 | @end example |
| 471 | 571 | ||
| 472 | Info URLs are not officially defined. They invoke | 572 | @noindent |
| 473 | @code{Info-goto-node} with argument @samp{(@var{file})@var{node}}. | 573 | and 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 |
| 481 | A mailto URL will send an email message to the address in the | 582 | A @code{mailto} URL specifies an email message to be sent to a given |
| 482 | URL, for example @samp{mailto:foo@@bar.com} would compose a | 583 | email address. For example, @samp{mailto:foo@@bar.com} specifies |
| 483 | message to @samp{foo@@bar.com}. | 584 | sending a message to @samp{foo@@bar.com}. The ``retrieval method'' |
| 484 | 585 | for such URLs is to open a mail composition buffer in which the | |
| 485 | @defopt url-mail-command | 586 | appropriate content (e.g.@: the recipient address) has been filled in. |
| 486 | @vindex mail-user-agent | ||
| 487 | The function called whenever url needs to send mail. This should | ||
| 488 | normally be left to default from @var{mail-user-agent}. @xref{Mail | ||
| 489 | Methods, , Mail-Composition Methods, emacs, The GNU Emacs Manual}. | ||
| 490 | @end defopt | ||
| 491 | 587 | ||
| 492 | An @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 |
| 493 | that contained the mailto URL is added if that URL is known. | ||
| 494 | 589 | ||
| 495 | RFC 2368 extends the definition of mailto URLs in RFC 1738. | ||
| 496 | The 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 | ||
| 502 | otherwise a @var{header} header field is created with @var{contents} | ||
| 503 | as its contents. Note that the URL library does not consider any | ||
| 504 | headers ``dangerous'' so you should check them before sending the | ||
| 505 | message. | ||
| 506 | 593 | ||
| 507 | @c Fixme: update | 594 | @noindent |
| 508 | Email messages are defined in @sc{rfc}822. | 595 | where 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 | ||
| 597 | body; otherwise, a @var{header} header field is created with | ||
| 598 | @var{contents} as its contents. Note that the @code{url} library does | ||
| 599 | not perform any checking of @var{header} or @var{contents}, so you | ||
| 600 | should check them before sending the message. | ||
| 601 | |||
| 602 | @defopt url-mail-command | ||
| 603 | @vindex mail-user-agent | ||
| 604 | The value of this variable is the function called whenever url needs | ||
| 605 | to send mail. This should normally be left its default, which is the | ||
| 606 | standard mail-composition command @code{compose-mail}. @xref{Sending | ||
| 607 | Mail,,, emacs, The GNU Emacs Manual}. | ||
| 608 | @end defopt | ||
| 609 | |||
| 610 | If the document containing the @code{mailto} URL itself possessed a | ||
| 611 | known URL, Emacs automatically inserts an @samp{X-Url-From} header | ||
| 612 | field 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 | 622 | The @code{news}, @code{nntp}, and @code{snews} schemes, defined in RFC |
| 519 | The network news URL scheme take the following forms following RFC | 623 | 1738, are used for reading Usenet newsgroups. For compatibility with |
| 520 | 1738 except that for compatibility with other clients, host and port | 624 | non-standard-compliant news clients, the @code{url} library allows |
| 521 | fields may be included in news URLs though they are properly only | 625 | host and port fields to be included in @code{news} URLs, even though |
| 522 | allowed for nntp an snews. | 626 | they 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; | |||
| 534 | Similar to the @samp{news} versions. | 640 | Similar 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 | 644 | difference 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 |
| 540 | is :563. | 646 | @samp{snews} scheme is the same as @samp{nntp}, except that it is |
| 541 | @cindex SSL | 647 | tunneled through SSL and has default port 563. |
| 542 | (It is tunneled through SSL.) | ||
| 543 | 648 | ||
| 544 | An @samp{nntp} URL is the same as a news URL, except that the URL may | 649 | These URLs are retrieved via the Gnus package. |
| 545 | specify an article by its number. | ||
| 546 | 650 | ||
| 547 | @defopt url-news-server | ||
| 548 | This variable can be used to override the default news server. | ||
| 549 | Usually this will be set by the Gnus package, which is used to fetch | ||
| 550 | news. | ||
| 551 | @cindex environment variable | 651 | @cindex environment variable |
| 552 | @vindex NNTPSERVER | 652 | @vindex NNTPSERVER |
| 553 | It may be set from the conventional environment variable | 653 | @defopt url-news-server |
| 554 | @code{NNTPSERVER}. | 654 | This variable specifies the default news server from which to fetch |
| 655 | news, if no server was specified in the URL. The default value, | ||
| 656 | @code{nil}, means to use the server specified by the standard | ||
| 657 | environment variable @samp{NNTPSERVER}, or @samp{news} if that | ||
| 658 | environment 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 | ||
| 565 | These URL schemes from RFC 1738 for logon via a terminal emulator have | 669 | These URL schemes are defined in RFC 1738, and are used for logging in |
| 566 | the form | 670 | via a terminal emulator. They have the form |
| 671 | |||
| 567 | @example | 672 | @example |
| 568 | telnet://@var{user}:@var{password}@@@var{host}:@var{port} | 673 | telnet://@var{user}:@var{password}@@@var{host}:@var{port} |
| 569 | @end example | 674 | @end example |
| 570 | but the @code{:@var{password}} component is ignored. | 675 | |
| 676 | @noindent | ||
| 677 | but the @var{password} component is ignored. | ||
| 571 | 678 | ||
| 572 | To handle rlogin, telnet and tn3270 URLs, a @code{rlogin}, | 679 | To 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 |
| 586 | session to a function named in @code{url-irc-function}. | 693 | @url{http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt} (which |
| 694 | was never approved as an RFC). Such URLs have the form | ||
| 695 | |||
| 696 | @example | ||
| 697 | irc://@var{host}:@var{port}/@var{target},@var{needpass} | ||
| 698 | @end example | ||
| 699 | |||
| 700 | @noindent | ||
| 701 | and are retrieved by opening an @acronym{IRC} session using the | ||
| 702 | function specified by @code{url-irc-function}. | ||
| 587 | 703 | ||
| 588 | @defopt url-irc-function | 704 | @defopt url-irc-function |
| 589 | A function to actually open an IRC connection. | 705 | The value of this option is a function, which is called to open an IRC |
| 590 | This function | 706 | connection for @code{irc} URLs. This function must take five |
| 591 | must take five arguments, @var{host}, @var{port}, @var{channel}, | 707 | arguments, @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 |
| 593 | channel to join immediately, this can be @code{nil}. By default this is | 709 | join immediately, and may be @code{nil}. |
| 594 | @code{url-irc-rcirc}. | 710 | |
| 711 | The default is @code{url-irc-rcirc}, which uses the Rcirc package. | ||
| 712 | Other 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 | ||
| 597 | Processes the arguments and lets @code{rcirc} handle the session. | ||
| 598 | @end defun | ||
| 599 | @defun url-irc-erc host port channel user password | ||
| 600 | Processes the arguments and lets @code{ERC} handle the session. | ||
| 601 | @end defun | ||
| 602 | @defun url-irc-zenirc host port channel user password | ||
| 603 | Processes 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 | ||
| 721 | the URL itself. Such URLs have the form | ||
| 722 | |||
| 610 | @example | 723 | @example |
| 611 | data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data} | 724 | data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data} |
| 612 | @end example | 725 | @end example |
| 613 | 726 | ||
| 614 | Data URLs contain MIME data in the URL itself. They are defined in | 727 | @noindent |
| 615 | RFC 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 |
| 618 | including parameters. It defaults to | 729 | including 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 | ||
| 740 | The @code{nfs} scheme, defined in RFC 2224, is similar to @code{ftp} | ||
| 741 | except that it points to a file on a remote host that is handled by an | ||
| 742 | NFS automounter on the local host. Such URLs have the form | ||
| 743 | |||
| 629 | @example | 744 | @example |
| 630 | nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} | 745 | nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} |
| 631 | @end example | 746 | @end example |
| 632 | 747 | ||
| 633 | The @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 | ||
| 635 | handled 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 |
| 639 | A string saying how to invoke the NFS automounter. Certain @samp{%} | 750 | A string saying how to invoke the NFS automounter. Certain @samp{%} |
| @@ -656,15 +767,6 @@ A literal @samp{%}. | |||
| 656 | 767 | ||
| 657 | Each can be used any number of times. | 768 | Each can be used any number of times. |
| 658 | 769 | ||
| 659 | @node cid | ||
| 660 | @section cid | ||
| 661 | @cindex Content-ID | ||
| 662 | |||
| 663 | RFC 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 | ||
| 673 | The LDAP scheme is defined in RFC 2255. | 775 | The LDAP scheme is defined in RFC 2255. |
| 674 | 776 | ||
| 675 | @node imap | ||
| 676 | @section imap | ||
| 677 | @cindex IMAP | ||
| 678 | |||
| 679 | RFC 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 | ||
| 783 | The @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 | ||
| 691 | This is a non-standard scheme. @var{page-spec} is passed directly to | 789 | @noindent |
| 692 | the Lisp @code{man} function. | 790 | and 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 |
| 1142 | The following environment variables affect the library's operation at | 1213 | The following environment variables affect the @code{url} library's |
| 1143 | startup. | 1214 | operation 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 | |||
| 1150 | it. | 1221 | it. |
| 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 | ||
| 1229 | The value of this variable specifies the name of the directory where | ||
| 1230 | the @code{url} library stores its various configuration files, cache | ||
| 1231 | files, etc. | ||
| 1154 | 1232 | ||
| 1155 | The following user options, settable with Customize, affect the | 1233 | The default value specifies a subdirectory named @file{url/} in the |
| 1156 | general operation of the package. | 1234 | standard Emacs user data directory specified by the variable |
| 1235 | @code{user-emacs-directory} (normally @file{~/.emacs.d}). However, | ||
| 1236 | the old default was @file{~/.url}, and this directory is used instead | ||
| 1237 | if it exists. | ||
| 1238 | @end defopt | ||
| 1157 | 1239 | ||
| 1158 | @defopt url-debug | 1240 | @defopt url-debug |
| 1159 | @cindex debugging | 1241 | @cindex debugging |