aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-11-09 03:03:49 +0800
committerChong Yidong2012-11-09 03:03:49 +0800
commit82f84fa3cdebaa4083621e7226f7abab3b8ba88f (patch)
treedadb28318e8a0998b144a3cbf55a19655a8f9042
parentfedb154e30405ae0f4be8a582a6252a4d3eb75b5 (diff)
downloademacs-82f84fa3cdebaa4083621e7226f7abab3b8ba88f.tar.gz
emacs-82f84fa3cdebaa4083621e7226f7abab3b8ba88f.zip
Update the URL library manual.
* doc/misc/url.texi (Introduction): Rename from Getting Started. Rewrite the introduction. (URI Parsing): Rewrite. Omit the obsolete attributes slot.
-rw-r--r--doc/misc/ChangeLog6
-rw-r--r--doc/misc/url.texi198
-rw-r--r--etc/NEWS9
3 files changed, 126 insertions, 87 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 700d432ef44..d7af0d79c68 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,9 @@
12012-11-08 Chong Yidong <cyd@gnu.org>
2
3 * url.texi (Introduction): Rename from Getting Started. Rewrite
4 the introduction.
5 (URI Parsing): Rewrite. Omit the obsolete attributes slot.
6
12012-11-07 Glenn Morris <rgm@gnu.org> 72012-11-07 Glenn Morris <rgm@gnu.org>
2 8
3 * cl.texi (Obsolete Setf Customization): 9 * cl.texi (Obsolete Setf Customization):
diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index 898a9994a86..9124edfcf73 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 the Emacs Lisp URL loading package. 21This file documents @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
@@ -57,7 +57,8 @@ developing GNU and promoting software freedom.''
57@end ifnottex 57@end ifnottex
58 58
59@menu 59@menu
60* Getting Started:: Preparing your program to use URLs. 60* Introduction:: About the @code{url} library.
61* URI Parsing:: Parsing (and unparsing) URIs.
61* Retrieving URLs:: How to use this package to retrieve a URL. 62* Retrieving URLs:: How to use this package to retrieve a URL.
62* Supported URL Types:: Descriptions of URL types currently supported. 63* Supported URL Types:: Descriptions of URL types currently supported.
63* Defining New URLs:: How to define a URL loader for a new protocol. 64* Defining New URLs:: How to define a URL loader for a new protocol.
@@ -70,93 +71,132 @@ developing GNU and promoting software freedom.''
70* Concept Index:: 71* Concept Index::
71@end menu 72@end menu
72 73
73@node Getting Started 74@node Introduction
74@chapter Getting Started 75@chapter Introduction
75@cindex URLs, definition 76@cindex URL
76@cindex URIs 77@cindex URI
78@cindex uniform resource identifier
79@cindex uniform resource locator
77 80
78@dfn{Uniform Resource Locators} (URLs) are a specific form of 81A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted
79@dfn{Uniform Resource Identifiers} (URI) described in RFC 2396 which 82name, such as an Internet address, which identifies some name or
80updates RFC 1738 and RFC 1808. RFC 2016 defines uniform resource 83resource. The format of URIs is described in RFC 3986, which updates
81agents. 84and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A
85@dfn{Uniform Resource Locator} (URL) is an older but still-common
86term, which basically refers to a URI corresponding to a resource
87which can be accessed over a network.
82 88
83URIs have the form @var{scheme}:@var{scheme-specific-part}, where the 89 Here are some examples of URIs (taken from RFC 3986):
84@var{scheme}s supported by this library are described below.
85@xref{Supported URL Types}.
86
87FTP, NFS, HTTP, HTTPS, @code{rlogin}, @code{telnet}, tn3270,
88IRC and gopher URLs all have the form
89 90
90@example 91@example
91@var{scheme}://@r{[}@var{userinfo}@@@r{]}@var{hostname}@r{[}:@var{port}@r{]}@r{[}/@var{path}@r{]} 92ftp://ftp.is.co.za/rfc/rfc1808.txt
93http://www.ietf.org/rfc/rfc2396.txt
94ldap://[2001:db8::7]/c=GB?objectClass?one
95mailto:John.Doe@@example.com
96news:comp.infosystems.www.servers.unix
97tel:+1-816-555-1212
98telnet://192.0.2.16:80/
99urn:oasis:names:specification:docbook:dtd:xml:4.1.2
92@end example 100@end example
93@noindent
94where @samp{@r{[}} and @samp{@r{]}} delimit optional parts.
95@var{userinfo} sometimes takes the form @var{username}:@var{password}
96but you should beware of the security risks of sending cleartext
97passwords. @var{hostname} may be a domain name or a dotted decimal
98address. If the @samp{:@var{port}} is omitted then the library will
99use the ``well known'' port for that service when accessing URLs. With
100the possible exception of @code{telnet}, it is rare for ports to be
101specified, and it is possible using a non-standard port may have
102undesired consequences if a different service is listening on that
103port (e.g., an HTTP URL specifying the SMTP port can cause mail to be
104sent). @c , but @xref{Other Variables, url-bad-port-list}.
105The meaning of the @var{path} component depends on the service.
106
107@menu
108* Configuration::
109* Parsed URLs:: URLs are parsed into vector structures.
110@end menu
111 101
112@node Configuration 102 This manual describes the @code{url} library, an Emacs Lisp library
113@section Configuration 103for parsing URIs and retrieving the resources to which they refer.
104(The library is so-named due to historical reasons; nowadays, the
105``URI'' terminology is regarded as the more general one, and ``URL''
106is technically obsolete despite its widespread vernacular usage.)
114 107
115@defvar url-configuration-directory 108@defvar url-configuration-directory
116@cindex @file{~/.url}
117@cindex configuration files 109@cindex configuration files
118The directory in which URL configuration files, the cache etc., 110The value of this variable specifies the name of the directory in
119reside. The old default was @file{~/.url}, and this directory 111which the @code{url} library stores its various configuration files,
120is still used if it exists. The new default is a @file{url/} 112cache files, etc.
121directory in @code{user-emacs-directory}, which is normally 113
122@file{~/.emacs.d}. 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.
123@end defvar 119@end defvar
124 120
125@node Parsed URLs 121@node URI Parsing
126@section Parsed URLs 122@chapter URI Parsing
127@cindex parsed URLs 123
128The library functions typically operate on @dfn{parsed} versions of 124 A URI consists of several @dfn{components}, each having a different
129URLs. These are actually CL structures (vectors) of the form: 125meaning. For example, the URI
130 126
131@example 127@example
132[cl-struct-url @var{type} @var{user} @var{password} @var{host} @var{port} @var{filename} @var{target} @var{attributes} @var{fullness} @var{use-cookies}] 128http://www.gnu.org/software/emacs/
133@end example 129@end example
134 130
135@noindent where 131@noindent
136@table @var 132specifies the scheme component @samp{http}, the hostname component
133@samp{www.gnu.org}, and the path component @samp{/software/emacs/}.
134
135@cindex parsed URIs
136 The URI format is specified by RFC 3986. The @code{url} library
137provides the Lisp function @code{url-generic-parse-url}, a
138standard-compliant URI parser, as well as the unparser
139@code{url-recreate-url}:
140
141@defun url-generic-parse-url url
142This function returns a parsed version of the string @var{url}.
143@end defun
144
145@defun url-recreate-url uri
146@cindex unparsing URLs
147Given a parsed URI, this function returns a corresponding URI string.
148@end defun
149
150@cindex parsed URI
151 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
153form of a CL structure whose slots hold the various components of the
154URI. @xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation},
155for details about CL structures. Most of the other functions in the
156@code{url} library act on parsed URIs. Each parsed URI structure
157contains the following slots:
158
159@table @code
137@item type 160@item type
138is the type of the URL scheme, e.g., @code{http} 161The URI scheme (a string, e.g.@: @code{http}). @xref{Supported URL
162Types}, for a list of schemes that the @code{url} library knows how to
163process. This slot can also be @code{nil}, if the URI is not fully
164specified.
165
139@item user 166@item user
140is the username associated with it, or @code{nil}; 167The user name (a string), or @code{nil}.
168
141@item password 169@item password
142is the user password associated with it, or @code{nil}; 170The user password (a string), or @code{nil}. The use of this URI
171component is strongly discouraged; nowadays, passwords are transmitted
172by other means, not as part of a URI.
173
143@item host 174@item host
144is the host name associated with it, or @code{nil}; 175The host name (a string), or @code{nil}. If present, this is
176typically a domain name or IP address.
177
145@item port 178@item port
146is the port number associated with it, or @code{nil}; 179The port number (an integer), or @code{nil}. Omitting this component
180usually means to use the ``standard'' port associated with the URI
181scheme.
182
147@item filename 183@item filename
148is the ``file'' part of it, or @code{nil}. This doesn't necessarily 184The combination of the ``path'' and ``query'' components of the URI (a
149actually refer to a file; 185string), or @code{nil}. If the query component is present, it is the
186substring following the first @samp{?} character, and the path
187component is the substring before the @samp{?}. The meaning of these
188components depends on the service; they do not necessarily refer to a
189file on a disk.
190
150@item target 191@item target
151is the target part, or @code{nil}; 192The fragment component (a string), or @code{nil}. The fragment
152@item attributes 193component specifies a ``secondary resource'', such as a section of a
153is the attributes associated with it, or @code{nil}; 194webpage.
195
154@item fullness 196@item fullness
155is @code{t} for a fully-specified URL, with a host part indicated by 197This is @code{t} if the URI is fully specified, i.e.@: the
156@samp{//} after the scheme part. 198hierarchical components of the URI (the hostname and/or username
157@item use-cookies 199and/or password) are preceded by @samp{//}.
158is @code{nil} to neither send or store cookies to the server, @code{t}
159otherwise.
160@end table 200@end table
161 201
162@findex url-type 202@findex url-type
@@ -168,30 +208,18 @@ otherwise.
168@findex url-target 208@findex url-target
169@findex url-attributes 209@findex url-attributes
170@findex url-fullness 210@findex url-fullness
171These attributes have accessors named @code{url-@var{part}}, where 211The above slots have accessors named @code{url-@var{part}}, where
172@var{part} is the name of one of the elements above, e.g., 212@var{part} is the slot name. For example, the accessor for the
173@code{url-host}. These attributes can be set with the same accessors 213@code{host} slot is the function @code{url-host}. The @code{url-port}
174using @code{setf}: 214accessor returns the default port for the URI scheme if the parsed
215URI's @var{port} slot is @code{nil}.
216
217 The slots can be set using @code{setf}. For example:
175 218
176@example 219@example
177(setf (url-port url) 80) 220(setf (url-port url) 80)
178@end example 221@end example
179 222
180If @var{port} is @var{nil}, @code{url-port} returns the default port
181of the protocol.
182
183There are functions for parsing and unparsing between the string and
184vector forms.
185
186@defun url-generic-parse-url url
187Return a parsed version of the string @var{url}.
188@end defun
189
190@defun url-recreate-url url
191@cindex unparsing URLs
192Recreates a URL string from the parsed @var{url}.
193@end defun
194
195@node Retrieving URLs 223@node Retrieving URLs
196@chapter Retrieving URLs 224@chapter Retrieving URLs
197 225
diff --git a/etc/NEWS b/etc/NEWS
index e241bdba3cb..926f3c4cec6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -454,7 +454,9 @@ specifying URL types which should be converted to remote file names at
454the FFAP prompt. The default is now '("ftp"). 454the FFAP prompt. The default is now '("ftp").
455 455
456** Generic-x 456** Generic-x
457`javascript-generic-mode' is now an obsolete alias for `js-mode'. 457
458---
459*** `javascript-generic-mode' is now an obsolete alias for `js-mode'.
458 460
459** Ibuffer 461** Ibuffer
460 462
@@ -531,6 +533,7 @@ python-send-string | python-shell-send-string
531python-switch-to-python | python-shell-switch-to-shell 533python-switch-to-python | python-shell-switch-to-shell
532python-describe-symbol | python-eldoc-at-point 534python-describe-symbol | python-eldoc-at-point
533 535
536---
534** reStructuredText mode 537** reStructuredText mode
535 538
536*** Rebind nearly all keys making room for more keys and complying 539*** Rebind nearly all keys making room for more keys and complying
@@ -561,6 +564,7 @@ the experience for Sphinx users.
561 564
562*** Support `imenu' and `which-func'. 565*** Support `imenu' and `which-func'.
563 566
567---
564** SH Script mode 568** SH Script mode
565 569
566*** Pairing of parens/quotes uses electric-pair-mode instead of skeleton-pair. 570*** Pairing of parens/quotes uses electric-pair-mode instead of skeleton-pair.
@@ -575,6 +579,7 @@ the experience for Sphinx users.
575for a new asynchronous shell command when the default output buffer 579for a new asynchronous shell command when the default output buffer
576`*Async Shell Command*' is already taken by another running command. 580`*Async Shell Command*' is already taken by another running command.
577 581
582---
578** SQL Mode 583** SQL Mode
579 584
580*** DB2 added `sql-db2-escape-newlines' 585*** DB2 added `sql-db2-escape-newlines'
@@ -605,7 +610,7 @@ definitions. See the manual for details.
605*** Remote processes are now supported also on remote Windows host. 610*** Remote processes are now supported also on remote Windows host.
606 611
607** URL 612** URL
608 613+++
609*** Structs made by `url-generic-parse-url' have nil `attributes' slot. 614*** Structs made by `url-generic-parse-url' have nil `attributes' slot.
610Previously, this slot stored semicolon-separated attribute-value pairs 615Previously, this slot stored semicolon-separated attribute-value pairs
611appended to some imap URLs, but this is not compatible with RFC 3986. 616appended to some imap URLs, but this is not compatible with RFC 3986.