Next: Supported URL Types, Previous: URI Parsing, Up: Top
The url library defines the following three functions for
retrieving the data specified by a URL. The actual retrieval protocol
depends on the URL's URI scheme, and is performed by lower-level
scheme-specific functions. (Those lower-level functions are not
documented here, and generally should not be called directly.)
In each of these functions, the url argument can be either a
string or a parsed URL structure. If it is a string, that string is
passed through url-encode-url before using it, to ensure that
it is properly URI-encoded (see URI Encoding).
This function synchronously retrieves the data specified by url, and returns a buffer containing the data. The return value is
nilif there is no data associated with the URL (as is the case fordired,info, andmailtoURLs).If the optional argument silent is non-
nil, progress messages are suppressed. If the optional argument no-cookies is non-nil, cookies are not stored or sent.
This function retrieves url asynchronously, calling the function callback when the object has been completely retrieved. The return value is the buffer into which the data will be inserted, or
nilif the process has already completed.The callback function is called this way:
(apply callback status cbargs)where status is a plist representing what happened during the retrieval, with most recent events first, or an empty list if no events have occurred. Each pair in the plist is one of:
(:redirectredirected-to)- This means that the request was redirected to the URL redirected-to.
(:error (error-symbol.data))- This means that an error occurred. If so desired, the error can be signaled with
(signalerror-symbol data).When the callback function is called, the current buffer is the one containing the retrieved data (if any). The buffer also contains any MIME headers associated with the data retrieval.
If the optional argument silent is non-
nil, progress messages are suppressed. If the optional argument no-cookies is non-nil, cookies are not stored or sent.
This function acts like
url-retrieve, but with limits on the number of concurrently-running network processes. The optionurl-queue-parallel-processescontrols the number of concurrent processes, and the optionurl-queue-timeoutsets a timeout in seconds.To use this function, you must
(require 'url-queue).