]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | '\" |
2 | .\" (C) Copyright 1999-2000 David A. Wheeler (dwheeler@dwheeler.com) | |
3 | .\" | |
4 | .\" Permission is granted to make and distribute verbatim copies of this | |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
23 | .\" | |
24 | .\" Fragments of this document are directly derived from IETF standards. | |
25 | .\" For those fragments which are directly derived from such standards, | |
26 | .\" the following notice applies, which is the standard copyright and | |
27 | .\" rights announcement of The Internet Society: | |
28 | .\" | |
29 | .\" Copyright (C) The Internet Society (1998). All Rights Reserved. | |
30 | .\" This document and translations of it may be copied and furnished to | |
31 | .\" others, and derivative works that comment on or otherwise explain it | |
32 | .\" or assist in its implementation may be prepared, copied, published | |
33 | .\" and distributed, in whole or in part, without restriction of any | |
34 | .\" kind, provided that the above copyright notice and this paragraph are | |
35 | .\" included on all such copies and derivative works. However, this | |
36 | .\" document itself may not be modified in any way, such as by removing | |
37 | .\" the copyright notice or references to the Internet Society or other | |
38 | .\" Internet organizations, except as needed for the purpose of | |
39 | .\" developing Internet standards in which case the procedures for | |
40 | .\" copyrights defined in the Internet Standards process must be | |
41 | .\" followed, or as required to translate it into languages other than English. | |
42 | .\" | |
43 | .\" Modified Fri Jul 25 23:00:00 1999 by David A. Wheeler (dwheeler@dwheeler.com) | |
44 | .\" Modified Fri Aug 21 23:00:00 1999 by David A. Wheeler (dwheeler@dwheeler.com) | |
45 | .\" Modified Tue Mar 14 2000 by David A. Wheeler (dwheeler@dwheeler.com) | |
46 | .\" | |
47 | .TH URI 7 2000-03-14 "Linux" "Linux Programmer's Manual" | |
48 | .SH NAME | |
49 | uri, url, urn \- uniform resource identifier (URI), including a URL or URN | |
50 | .SH SYNOPSIS | |
51 | .nf | |
52 | .HP 0.2i | |
53 | URI = [ absoluteURI | relativeURI ] [ "#" fragment ] | |
54 | .HP | |
55 | absoluteURI = scheme ":" ( hierarchical_part | opaque_part ) | |
56 | .HP | |
57 | relativeURI = ( net_path | absolute_path | relative_path ) [ "?" query ] | |
fea681da MK |
58 | .HP |
59 | scheme = "http" | "ftp" | "gopher" | "mailto" | "news" | "telnet" | "file" | "man" | "info" | "whatis" | "ldap" | "wais" | \&... | |
60 | .HP | |
61 | hierarchical_part = ( net_path | absolute_path ) [ "?" query ] | |
fea681da MK |
62 | .HP |
63 | net_path = "//" authority [ absolute_path ] | |
64 | .HP | |
65 | absolute_path = "/" path_segments | |
66 | .HP | |
67 | relative_path = relative_segment [ absolute_path ] | |
68 | .fi | |
69 | .SH DESCRIPTION | |
70 | .PP | |
71 | A Uniform Resource Identifier (URI) is a short string of characters | |
72 | identifying an abstract or physical resource (for example, a web page). | |
73 | A Uniform Resource Locator (URL) is a URI | |
74 | that identifies a resource through its primary access | |
75 | mechanism (e.g., its network "location"), rather than | |
76 | by name or some other attribute of that resource. | |
77 | A Uniform Resource Name (URN) is a URI | |
78 | that must remain globally unique and persistent even when | |
79 | the resource ceases to exist or becomes unavailable. | |
80 | .PP | |
81 | URIs are the standard way to name hypertext link destinations | |
82 | for tools such as web browsers. | |
83 | The string "http://www.kernelnotes.org" is a URL (and thus it's a URI). | |
84 | Many people use the term URL loosely as a synonym for URI | |
85 | (though technically URLs are a subset of URIs). | |
86 | .PP | |
87 | URIs can be absolute or relative. | |
88 | An absolute identifier refers to a resource independent of | |
89 | context, while a relative | |
90 | identifier refers to a resource by describing the difference | |
91 | from the current context. | |
92 | Within a relative path reference, the complete path segments "." and | |
93 | ".." have special meanings: "the current hierarchy level" and "the | |
94 | level above this hierarchy level", respectively, just like they do in | |
95 | Unix-like systems. | |
96 | A path segment which contains a colon | |
97 | character can't be used as the first segment of a relative URI path | |
98 | (e.g., "this:that"), because it would be mistaken for a scheme name; | |
99 | precede such segments with ./ (e.g., "./this:that"). | |
b9560046 | 100 | Note that descendants of MS-DOS (e.g., Microsoft Windows) replace |
fea681da MK |
101 | devicename colons with the vertical bar ("|") in URIs, so "C:" becomes "C|". |
102 | .PP | |
103 | A fragment identifier, if included, refers to a particular named portion | |
104 | (fragment) of a resource; text after a '#' identifies the fragment. | |
105 | A URI beginning with '#' refers to that fragment in the current resource. | |
106 | .SH USAGE | |
107 | There are many different URI schemes, each with specific | |
108 | additional rules and meanings, but they are intentionally made to be | |
109 | as similar as possible. | |
110 | For example, many URL schemes | |
111 | permit the authority to be the following format, called here an | |
112 | .I ip_server | |
113 | (square brackets show what's optional): | |
114 | .HP | |
115 | .IR "ip_server = " [ user " [ : " password " ] @ ] " host " [ : " port ] | |
116 | .PP | |
117 | This format allows you to optionally insert a user name, | |
118 | a user plus password, and/or a port number. | |
119 | The | |
120 | .I host | |
121 | is the name of the host computer, either its name as determined by DNS | |
122 | or an IP address (numbers separated by periods). | |
123 | Thus the URI | |
124 | <http://fred:fredpassword@xyz.com:8080/> | |
125 | logs into a web server on host xyz.com | |
126 | as fred (using fredpassword) using port 8080. | |
127 | Avoid including a password in a URI if possible because of the many | |
128 | security risks of having a password written down. | |
129 | If the URL supplies a user name but no password, and the remote | |
130 | server requests a password, the program interpreting the URL | |
131 | should request one from the user. | |
132 | .PP | |
133 | Here are some of the most common schemes in use on Unix-like systems | |
134 | that are understood by many tools. | |
135 | Note that many tools using URIs also have internal schemes or specialized | |
136 | schemes; see those tools' documentation for information on those schemes. | |
4d9b6984 | 137 | .SS "http \- Web (HTTP) server" |
fea681da MK |
138 | .RI http:// ip_server / path |
139 | .br | |
140 | .RI http:// ip_server / path ? query | |
141 | .PP | |
142 | This is a URL accessing a web (HTTP) server. | |
143 | The default port is 80. | |
144 | If the path refers to a directory, the web server will choose what | |
145 | to return; usually if there is a file named "index.html" or "index.htm" | |
146 | its content is returned, otherwise, a list of the files in the current | |
147 | directory (with appropriate links) is generated and returned. | |
148 | An example is <http://lwn.net>. | |
149 | .PP | |
150 | A query can be given in the archaic "isindex" format, consisting of a | |
151 | word or phrase and not including an equal sign (=). | |
152 | A query can also be in the longer "GET" format, which has one or more | |
153 | query entries of the form | |
154 | .IR key = value | |
155 | separated by the ampersand character (&). | |
156 | Note that | |
157 | .I key | |
158 | can be repeated more than once, though it's up to the web server | |
159 | and its application programs to determine if there's any meaning to that. | |
160 | There is an unfortunate interaction with HTML/XML/SGML and | |
161 | the GET query format; when such URIs with more than one key | |
162 | are embedded in SGML/XML documents (including HTML), the ampersand | |
163 | (&) has to be rewritten as &. | |
164 | Note that not all queries use this format; larger forms | |
165 | may be too long to store as a URI, so they use a different | |
166 | interaction mechanism (called POST) which does not include the data in the URI. | |
167 | See the Common Gateway Interface specification at | |
168 | <http://www.w3.org/CGI> for more information. | |
4d9b6984 | 169 | .SS "ftp \- File Transfer Protocol (FTP)" |
fea681da MK |
170 | .RI ftp:// ip_server / path |
171 | .PP | |
172 | This is a URL accessing a file through the file transfer protocol (FTP). | |
173 | The default port (for control) is 21. | |
174 | If no username is included, the user name "anonymous" is supplied, and | |
175 | in that case many clients provide as the password the requestor's | |
176 | Internet email address. | |
177 | An example is | |
178 | <ftp://ftp.is.co.za/rfc/rfc1808.txt>. | |
4d9b6984 | 179 | .SS "gopher \- Gopher server" |
fea681da MK |
180 | .RI gopher:// ip_server / "gophertype selector" |
181 | .br | |
182 | .RI gopher:// ip_server / "gophertype selector" %09 search | |
183 | .br | |
184 | .RI gopher:// ip_server / "gophertype selector" %09 search %09 gopher+_string | |
185 | .br | |
186 | .PP | |
187 | The default gopher port is 70. | |
188 | .I gophertype | |
189 | is a single-character field to denote the | |
190 | Gopher type of the resource to | |
191 | which the URL refers. | |
192 | The entire path may also be empty, in | |
193 | which case the delimiting "/" is also optional and the gophertype | |
194 | defaults to "1". | |
195 | .PP | |
196 | .I selector | |
c13182ef MK |
197 | is the Gopher selector string. |
198 | In the Gopher protocol, | |
fea681da MK |
199 | Gopher selector strings are a sequence of octets which may contain |
200 | any octets except 09 hexadecimal (US-ASCII HT or tab), 0A hexadecimal | |
201 | (US-ASCII character LF), and 0D (US-ASCII character CR). | |
4d9b6984 | 202 | .SS "mailto \- Email address" |
fea681da MK |
203 | .RI mailto: email-address |
204 | .PP | |
205 | This is an email address, usually of the form | |
206 | .IR name @ hostname . | |
207 | See | |
208 | .BR mailaddr (7) | |
209 | for more information on the correct format of an email address. | |
210 | Note that any % character must be rewritten as %25. | |
211 | An example is <mailto:dwheeler@dwheeler.com>. | |
4d9b6984 | 212 | .SS "news \- Newsgroup or News message" |
fea681da MK |
213 | .RI news: newsgroup-name |
214 | .br | |
215 | .RI news: message-id | |
216 | .PP | |
217 | A | |
218 | .I newsgroup-name | |
219 | is a period-delimited hierarchical name, such as | |
220 | "comp.infosystems.www.misc". | |
221 | If <newsgroup-name> is "*" (as in <news:*>), it is used to refer | |
222 | to "all available news groups". | |
223 | An example is <news:comp.lang.ada>. | |
224 | .PP | |
225 | A | |
226 | .I message-id | |
227 | corresponds to the Message-ID of | |
defcceb3 | 228 | .URL http://www.ietf.org/rfc/rfc1036.txt |
331da7c3 | 229 | IETF RFC\ 1036, |
fea681da MK |
230 | .UE |
231 | without the enclosing "<" | |
232 | and ">"; it takes the form | |
233 | .IR unique @ full_domain_name . | |
234 | A message identifier may be distinguished from a news group name by the | |
235 | presence of the "@" character. | |
4d9b6984 | 236 | .SS "telnet \- Telnet login" |
fea681da MK |
237 | .RI telnet:// ip_server / |
238 | .PP | |
239 | The Telnet URL scheme is used to designate interactive text services that | |
c13182ef MK |
240 | may be accessed by the Telnet protocol. |
241 | The final "/" character may be omitted. | |
fea681da MK |
242 | The default port is 23. |
243 | An example is <telnet://melvyl.ucop.edu/>. | |
4d9b6984 | 244 | .SS "file \- Normal file" |
fea681da MK |
245 | .RI file:// ip_server / path_segments |
246 | .br | |
247 | .RI file: path_segments | |
248 | .PP | |
249 | This represents a file or directory accessible locally. | |
250 | As a special case, | |
251 | .I host | |
252 | can be the string "localhost" or the empty | |
253 | string; this is interpreted as `the machine from which the URL is | |
254 | being interpreted'. | |
255 | If the path is to a directory, the viewer should display the | |
256 | directory's contents with links to each containee; | |
257 | not all viewers currently do this. | |
258 | KDE supports generated files through the URL <file:/cgi-bin>. | |
259 | If the given file isn't found, browser writers may want to try to expand | |
260 | the filename via filename globbing | |
261 | (see | |
262 | .BR glob (7) | |
263 | and | |
264 | .BR glob (3)). | |
265 | .PP | |
266 | The second format (e.g., <file:/etc/passwd>) | |
267 | is a correct format for referring to | |
c13182ef MK |
268 | a local file. |
269 | However, older standards did not permit this format, | |
fea681da MK |
270 | and some programs don't recognize this as a URI. |
271 | A more portable syntax is to use an empty string as the server name, e.g., | |
272 | <file:///etc/passwd>; this form does the same thing | |
273 | and is easily recognized by pattern matchers and older programs as a URI. | |
274 | Note that if you really mean to say "start from the current location," don't | |
275 | specify the scheme at all; use a relative address like <../test.txt>, | |
276 | which has the side-effect of being scheme-independent. | |
277 | An example of this scheme is <file:///etc/passwd>. | |
4d9b6984 | 278 | .SS "man \- Man page documentation" |
fea681da MK |
279 | .RI man: command-name |
280 | .br | |
281 | .RI man: command-name ( section ) | |
282 | .PP | |
283 | This refers to local online manual (man) reference pages. | |
284 | The command name can optionally be followed by a parenthesis and section number; | |
285 | see | |
286 | .BR man (7) | |
287 | for more information on the meaning of the section numbers. | |
288 | This URI scheme is unique to Unix-like systems (such as Linux) | |
289 | and is not currently registered by the IETF. | |
290 | An example is <man:ls(1)>. | |
4d9b6984 | 291 | .SS "info \- Info page documentation" |
fea681da MK |
292 | .RI info: virtual-filename |
293 | .br | |
294 | .RI info: virtual-filename # nodename | |
295 | .br | |
296 | .RI info:( virtual-filename ) | |
297 | .br | |
298 | .RI info:( virtual-filename ) nodename | |
299 | .PP | |
300 | This scheme refers to online info reference pages (generated from | |
301 | texinfo files), a documentation format used by programs such as the GNU tools. | |
302 | This URI scheme is unique to Unix-like systems (such as Linux) | |
303 | and is not currently registered by the IETF. | |
304 | As of this writing, GNOME and KDE differ in their URI syntax | |
305 | and do not accept the other's syntax. | |
306 | The first two formats are the GNOME format; in nodenames all spaces | |
307 | are written as underscores. | |
308 | The second two formats are the KDE format; | |
309 | spaces in nodenames must be written as spaces, even though this | |
310 | is forbidden by the URI standards. | |
311 | It's hoped that in the future most tools will understand all of these | |
312 | formats and will always accept underscores for spaces in nodenames. | |
313 | In both GNOME and KDE, if the form without the nodename is used the | |
314 | nodename is assumed to be "Top". | |
315 | Examples of the GNOME format are <info:gcc> and <info:gcc#G++_and_GCC>. | |
316 | Examples of the KDE format are <info:(gcc)> and <info:(gcc)G++ and GCC>. | |
4d9b6984 | 317 | .SS "whatis \- Documentation search" |
fea681da MK |
318 | .RI whatis: string |
319 | .PP | |
320 | This scheme searches the database of short (one-line) descriptions of commands | |
321 | and returns a list of descriptions containing that string. | |
322 | Only complete word matches are returned. | |
323 | See | |
324 | .BR whatis (1). | |
325 | This URI scheme is unique to Unix-like systems (such as Linux) | |
326 | and is not currently registered by the IETF. | |
4d9b6984 | 327 | .SS "ghelp \- GNOME help documentation" |
fea681da MK |
328 | .RI ghelp: name-of-application |
329 | .PP | |
330 | This loads GNOME help for the given application. | |
331 | Note that not much documentation currently exists in this format. | |
4d9b6984 | 332 | .SS "ldap \- Lightweight Directory Access Protocol" |
fea681da MK |
333 | .RI ldap:// hostport |
334 | .br | |
335 | .RI ldap:// hostport / | |
336 | .br | |
337 | .RI ldap:// hostport / dn | |
338 | .br | |
339 | .RI ldap:// hostport / dn ? attributes | |
340 | .br | |
341 | .RI ldap:// hostport / dn ? attributes ? scope | |
342 | .br | |
343 | .RI ldap:// hostport / dn ? attributes ? scope ? filter | |
344 | .br | |
345 | .RI ldap:// hostport / dn ? attributes ? scope ? filter ? extensions | |
346 | .PP | |
347 | This scheme supports queries to the | |
348 | Lightweight Directory Access Protocol (LDAP), a protocol for querying | |
349 | a set of servers for hierarchically-organized information | |
350 | (such as people and computing resources). | |
351 | More information on the LDAP URL scheme is available in | |
352 | .UR http://www.ietf.org/rfc/rfc2255.txt | |
331da7c3 | 353 | RFC\ 2255. |
fea681da MK |
354 | .UE |
355 | The components of this URL are: | |
356 | .IP hostport 12 | |
357 | the LDAP server to query, written as a hostname optionally followed by | |
358 | a colon and the port number. | |
c13182ef | 359 | The default LDAP port is TCP port 389. |
fea681da MK |
360 | If empty, the client determines which the LDAP server to use. |
361 | .IP dn | |
362 | the LDAP Distinguished Name, which identifies | |
363 | the base object of the LDAP search (see | |
364 | .UR http://www.ietf.org/rfc/rfc2253.txt | |
331da7c3 | 365 | RFC\ 2253 |
fea681da MK |
366 | .UE |
367 | section 3). | |
368 | .IP attributes | |
369 | a comma-separated list of attributes to be returned; | |
c13182ef | 370 | see RFC\ 2251 section 4.1.5. |
331da7c3 | 371 | If omitted, all attributes should be returned. |
fea681da MK |
372 | .IP scope |
373 | specifies the scope of the search, which can be one of | |
374 | "base" (for a base object search), "one" (for a one-level search), | |
c13182ef MK |
375 | or "sub" (for a subtree search). |
376 | If scope is omitted, "base" is assumed. | |
fea681da MK |
377 | .IP filter |
378 | specifies the search filter (subset of entries | |
c13182ef MK |
379 | to return). |
380 | If omitted, all entries should be returned. | |
fea681da MK |
381 | See |
382 | .UR http://www.ietf.org/rfc/rfc2254.txt | |
331da7c3 | 383 | RFC\ 2254 |
fea681da MK |
384 | .UE |
385 | section 4. | |
386 | .IP extensions | |
387 | a comma-separated list of type=value | |
388 | pairs, where the =value portion may be omitted for options not | |
c13182ef MK |
389 | requiring it. |
390 | An extension prefixed with a '!' is critical | |
fea681da MK |
391 | (must be supported to be valid), otherwise it's non-critical (optional). |
392 | .PP | |
393 | LDAP queries are easiest to explain by example. | |
394 | Here's a query that asks ldap.itd.umich.edu for information about | |
395 | the University of Michigan in the U.S.: | |
396 | .RS | |
397 | ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US | |
398 | .RE | |
399 | .PP | |
400 | To just get its postal address attribute, request: | |
401 | .RS | |
402 | ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress | |
403 | .RE | |
404 | .PP | |
405 | To ask a host.com at port 6666 for information about the person | |
406 | with common name (cn) "Babs Jensen" at University of Michigan, request: | |
407 | .RS | |
408 | ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen) | |
409 | .RE | |
4d9b6984 | 410 | .SS "wais \- Wide Area Information Servers" |
fea681da MK |
411 | .RI wais:// hostport / database |
412 | .br | |
413 | .RI wais:// hostport / database ? search | |
414 | .br | |
415 | .RI wais:// hostport / database / wtype / wpath | |
416 | .PP | |
417 | This scheme designates a WAIS database, search, or document | |
418 | (see | |
419 | .UR http://www.ietf.org/rfc/rfc1625.txt | |
331da7c3 | 420 | IETF RFC\ 1625 |
fea681da MK |
421 | .UE |
422 | for more information on WAIS). | |
423 | Hostport is the hostname, optionally followed by a colon and port number | |
424 | (the default port number is 210). | |
425 | .PP | |
426 | The first form designates a WAIS database for searching. | |
427 | The second form designates a particular search of the WAIS database | |
428 | .IR database . | |
429 | The third form designates a particular document within a WAIS | |
430 | database to be retrieved. | |
431 | .I wtype | |
432 | is the WAIS designation of the type of the object and | |
433 | .I wpath | |
434 | is the WAIS document-id. | |
435 | .SS "other schemes" | |
436 | There are many other URI schemes. | |
437 | Most tools that accept URIs support a set of internal URIs | |
438 | (e.g., Mozilla has the about: scheme for internal information, | |
439 | and the GNOME help browser has the toc: scheme for various starting | |
440 | locations). | |
441 | There are many schemes that have been defined but are not as widely | |
442 | used at the current time | |
443 | (e.g., prospero). | |
444 | The nntp: scheme is deprecated in favor of the news: scheme. | |
445 | URNs are to be supported by the urn: scheme, with a hierarchical name space | |
446 | (e.g., urn:ietf:... would identify IETF documents); at this time | |
447 | URNs are not widely implemented. | |
448 | Not all tools support all schemes. | |
449 | .SH "CHARACTER ENCODING" | |
450 | .PP | |
451 | URIs use a limited number of characters so that they can be | |
452 | typed in and used in a variety of situations. | |
453 | .PP | |
454 | The following characters are reserved, that is, they may appear in a | |
455 | URI but their use is limited to their reserved purpose | |
456 | (conflicting data must be escaped before forming the URI): | |
457 | .IP | |
458 | ; / ? : @ & = + $ , | |
459 | .PP | |
460 | Unreserved characters may be included in a URI. | |
461 | Unreserved characters | |
1954b6a9 | 462 | include upper and lower case English letters, |
fea681da MK |
463 | decimal digits, and the following |
464 | limited set of punctuation marks and symbols: | |
465 | .IP | |
4d9b6984 | 466 | \- _ . ! ~ * ' ( ) |
fea681da MK |
467 | .PP |
468 | All other characters must be escaped. | |
469 | An escaped octet is encoded as a character triplet, consisting of the | |
470 | percent character "%" followed by the two hexadecimal digits | |
471 | representing the octet code (you can use upper or lower case letters | |
c13182ef MK |
472 | for the hexadecimal digits). |
473 | For example, a blank space must be escaped | |
fea681da MK |
474 | as "%20", a tab character as "%09", and the "&" as "%26". |
475 | Because the percent "%" character always has the reserved purpose of | |
476 | being the escape indicator, it must be escaped as "%25". | |
477 | It is common practice to escape space characters as the plus symbol (+) | |
478 | in query text; this practice isn't uniformly defined | |
479 | in the relevant RFCs (which recommend %20 instead) but any tool accepting | |
480 | URIs with query text should be prepared for them. | |
481 | A URI is always shown in its "escaped" form. | |
482 | .PP | |
483 | Unreserved characters can be escaped without changing the semantics | |
484 | of the URI, but this should not be done unless the URI is being used | |
485 | in a context that does not allow the unescaped character to appear. | |
486 | For example, "%7e" is sometimes used instead of "~" in an http URL | |
487 | path, but the two are equivalent for an http URL. | |
488 | .PP | |
489 | For URIs which must handle characters outside the US ASCII character set, | |
490 | the HTML 4.01 specification (section B.2) and | |
331da7c3 | 491 | IETF RFC\ 2718 (section 2.2.5) recommend the following approach: |
fea681da | 492 | .IP 1. 4 |
331da7c3 | 493 | translate the character sequences into UTF-8 (IETF RFC\ 2279) \(em see |
fea681da | 494 | .BR utf-8 (7) |
4d9b6984 | 495 | \(em and then |
fea681da MK |
496 | .IP 2. |
497 | use the URI escaping mechanism, that is, | |
498 | use the %HH encoding for unsafe octets. | |
499 | .SH "WRITING A URI" | |
500 | When written, URIs should be placed inside doublequotes | |
501 | (e.g., "http://www.kernelnotes.org"), | |
502 | enclosed in angle brackets (e.g., <http://lwn.net>), | |
503 | or placed on a line by themselves. | |
504 | A warning for those who use double-quotes: | |
505 | .B never | |
506 | move extraneous punctuation (such as the period ending a sentence or the | |
507 | comma in a list) | |
508 | inside a URI, since this will change the value of the URI. | |
509 | Instead, use angle brackets instead, or | |
510 | switch to a quoting system that never includes extraneous characters | |
511 | inside quotation marks. | |
512 | This latter system, called the 'new' or 'logical' quoting system by | |
513 | "Hart's Rules" and the "Oxford Dictionary for Writers and Editors", | |
514 | is preferred practice in Great Britain and hackers worldwide | |
515 | (see the | |
defcceb3 MK |
516 | Jargon File's section on Hacker Writing Style, |
517 | .IR http://www.fwi.uva.nl/~mes/jargon/h/HackerWritingStyle.html , | |
fea681da | 518 | for more information). |
c13182ef | 519 | Older documents suggested inserting the prefix "URL:" |
fea681da MK |
520 | just before the URI, but this form has never caught on. |
521 | .PP | |
522 | The URI syntax was designed to be unambiguous. | |
523 | However, as URIs have become commonplace, traditional media | |
524 | (television, radio, newspapers, billboards, etc.) have increasingly | |
525 | used abbreviated URI references consisting of | |
526 | only the authority and path portions of the identified resource | |
527 | (e.g., <www.w3.org/Addressing>). | |
528 | Such references are primarily | |
529 | intended for human interpretation rather than machine, with the | |
530 | assumption that context-based heuristics are sufficient to complete | |
531 | the URI (e.g., hostnames beginning with "www" are likely to have | |
532 | a URI prefix of "http://" and hostnames beginning with "ftp" likely | |
533 | to have a prefix of "ftp://"). | |
534 | Many client implementations heuristically resolve these references. | |
535 | Such heuristics may | |
536 | change over time, particularly when new schemes are introduced. | |
537 | Since an abbreviated URI has the same syntax as a relative URL path, | |
538 | abbreviated URI references cannot be used where relative URIs are | |
539 | permitted, and can only be used when there is no defined base | |
540 | (such as in dialog boxes). | |
541 | Don't use abbreviated URIs as hypertext links inside a document; | |
542 | use the standard format as described here. | |
543 | .SH NOTES | |
544 | Any tool accepting URIs (e.g., a web browser) on a Linux system should | |
545 | be able to handle (directly or indirectly) all of the schemes described here, | |
546 | including the man: and info: schemes. | |
547 | Handling them by invoking some other program is fine and in fact encouraged. | |
548 | .PP | |
549 | Technically the fragment isn't part of the URI. | |
550 | .PP | |
551 | For information on how to embed URIs (including URLs) in a data format, | |
552 | see documentation on that format. | |
553 | HTML uses the format <A HREF="\fIuri\fP"> | |
554 | .I text | |
555 | </A>. | |
556 | Texinfo files use the format @uref{\fIuri\fP}. | |
557 | Man and mdoc have the recently-added UR macro, or just include the | |
558 | URI in the text (viewers should be able to detect :// as part of a URI). | |
559 | .PP | |
560 | The GNOME and KDE desktop environments currently vary in the URIs they accept, | |
561 | in particular in their respective help browsers. | |
562 | To list man pages, GNOME uses <toc:man> while KDE uses <man:(index)>, and | |
563 | to list info pages, GNOME uses <toc:info> while KDE uses <info:(dir)> | |
564 | (the author of this man page prefers the KDE approach here, though a more | |
565 | regular format would be even better). | |
566 | In general, KDE uses <file:/cgi-bin/> as a prefix to a set of generated | |
567 | files. | |
568 | KDE prefers documentation in HTML, accessed via the | |
569 | <file:/cgi-bin/helpindex>. | |
570 | GNOME prefers the ghelp scheme to store and find documentation. | |
571 | Neither browser handles file: references to directories at the time | |
572 | of this writing, making it difficult to refer to an entire directory with | |
573 | a browsable URI. | |
574 | As noted above, these environments differ in how they handle the info: scheme, | |
575 | probably the most important variation. | |
576 | It is expected that GNOME and KDE | |
577 | will converge to common URI formats, and a future | |
578 | version of this man page will describe the converged result. | |
579 | Efforts to aid this convergence are encouraged. | |
580 | .SH SECURITY | |
581 | .PP | |
582 | A URI does not in itself pose a security threat. | |
583 | There is no general guarantee that a URL, which at one time | |
c13182ef MK |
584 | located a given resource, will continue to do so. |
585 | Nor is there any | |
fea681da MK |
586 | guarantee that a URL will not locate a different resource at some |
587 | later point in time; such a guarantee can only be | |
588 | obtained from the person(s) controlling that namespace and the | |
589 | resource in question. | |
590 | .PP | |
591 | It is sometimes possible to construct a URL such that an attempt to | |
592 | perform a seemingly harmless operation, such as the | |
593 | retrieval of an entity associated with the resource, will in fact | |
c13182ef MK |
594 | cause a possibly damaging remote operation to occur. |
595 | The unsafe URL | |
fea681da | 596 | is typically constructed by specifying a port number other than that |
c13182ef MK |
597 | reserved for the network protocol in question. |
598 | The client unwittingly contacts a site that is in fact | |
599 | running a different protocol. | |
600 | The content of the URL contains instructions that, when | |
fea681da | 601 | interpreted according to this other protocol, cause an unexpected |
c13182ef MK |
602 | operation. |
603 | An example has been the use of a gopher URL to cause an | |
fea681da MK |
604 | unintended or impersonating message to be sent via a SMTP server. |
605 | .PP | |
606 | Caution should be used when using any URL that specifies a port | |
607 | number other than the default for the protocol, especially when it is | |
608 | a number within the reserved space. | |
609 | .PP | |
610 | Care should be taken when a URI contains escaped delimiters for a | |
611 | given protocol (for example, CR and LF characters for telnet | |
c13182ef MK |
612 | protocols) that these are not unescaped before transmission. |
613 | This might violate the protocol, but avoids the potential for such | |
fea681da MK |
614 | characters to be used to simulate an extra operation or parameter in |
615 | that protocol, which might lead to an unexpected and possibly harmful | |
616 | remote operation to be performed. | |
617 | .PP | |
618 | It is clearly unwise to use a URI that contains a password which is | |
c13182ef MK |
619 | intended to be secret. |
620 | In particular, the use of a password within | |
b9560046 | 621 | the 'userinfo' component of a URI is strongly recommended against except |
fea681da MK |
622 | in those rare cases where the 'password' parameter is intended to be public. |
623 | .SH "CONFORMING TO" | |
624 | .PP | |
defcceb3 MK |
625 | .IR http://www.ietf.org/rfc/rfc2396.txt |
626 | (IETF RFC\ 2396), | |
627 | .I http://www.w3.org/TR/REC-html40 | |
628 | (HTML 4.0). | |
fea681da MK |
629 | .UE |
630 | .SH BUGS | |
631 | .PP | |
632 | Documentation may be placed in a variety of locations, so there | |
633 | currently isn't a good URI scheme for general online documentation | |
634 | in arbitrary formats. | |
635 | References of the form | |
636 | <file:///usr/doc/ZZZ> don't work because different distributions and | |
637 | local installation requirements may place the files in different | |
638 | directories | |
639 | (it may be in /usr/doc, or /usr/local/doc, or /usr/share, or somewhere else). | |
640 | Also, the directory ZZZ usually changes when a version changes | |
641 | (though filename globbing could partially overcome this). | |
642 | Finally, using the file: scheme doesn't easily support people who dynamically | |
643 | load documentation from the Internet (instead of loading the files | |
644 | onto a local filesystem). | |
645 | A future URI scheme may be added (e.g., "userdoc:") to permit | |
646 | programs to include cross-references to more detailed documentation without | |
647 | having to know the exact location of that documentation. | |
648 | Alternatively, a future version of the filesystem specification may | |
649 | specify file locations sufficiently so that the file: scheme will | |
650 | be able to locate documentation. | |
651 | .PP | |
652 | Many programs and file formats don't include a way to incorporate | |
653 | or implement links using URIs. | |
654 | .PP | |
655 | Many programs can't handle all of these different URI formats; there | |
656 | should be a standard mechanism to load an arbitrary URI that automatically | |
657 | detects the users' environment (e.g., text or graphics, desktop environment, | |
658 | local user preferences, and currently-executing tools) and invokes the | |
659 | right tool for any URI. | |
660 | .SH AUTHOR | |
661 | David A. Wheeler (dwheeler@dwheeler.com) wrote this man page. | |
662 | .SH "SEE ALSO" | |
663 | .BR lynx (1), | |
664 | .BR man2html (1), | |
665 | .BR mailaddr (7), | |
666 | .BR utf-8 (7) | |
667 | .UR http://www.ietf.org/rfc/rfc2255.txt | |
331da7c3 | 668 | IETF RFC\ 2255. |
fea681da | 669 | .UE |