url.texi 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376
  1. \input texinfo
  2. @setfilename ../../info/url.info
  3. @settitle URL Programmer's Manual
  4. @include docstyle.texi
  5. @iftex
  6. @c @finalout
  7. @end iftex
  8. @c @setchapternewpage odd
  9. @c @smallbook
  10. @tex
  11. \overfullrule=0pt
  12. %\global\baselineskip 30pt % for printing in double space
  13. @end tex
  14. @dircategory Emacs lisp libraries
  15. @direntry
  16. * URL: (url). URL loading package.
  17. @end direntry
  18. @copying
  19. This is the manual for the @code{url} Emacs Lisp library.
  20. Copyright @copyright{} 1993--1999, 2002, 2004--2017 Free Software
  21. Foundation, Inc.
  22. @quotation
  23. Permission is granted to copy, distribute and/or modify this document
  24. under the terms of the GNU Free Documentation License, Version 1.3 or
  25. any later version published by the Free Software Foundation; with no
  26. Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
  27. and with the Back-Cover Texts as in (a) below. A copy of the license
  28. is included in the section entitled ``GNU Free Documentation License''.
  29. (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
  30. modify this GNU manual.''
  31. @end quotation
  32. @end copying
  33. @c
  34. @titlepage
  35. @title URL Programmer's Manual
  36. @subtitle First Edition, URL Version 2.0
  37. @author William M. Perry @email{wmperry@@gnu.org}
  38. @author David Love @email{fx@@gnu.org}
  39. @page
  40. @vskip 0pt plus 1filll
  41. @insertcopying
  42. @end titlepage
  43. @contents
  44. @node Top
  45. @top URL
  46. @ifnottex
  47. @insertcopying
  48. @end ifnottex
  49. @menu
  50. * Introduction:: About the @code{url} library.
  51. * URI Parsing:: Parsing (and unparsing) URIs.
  52. * Retrieving URLs:: How to use this package to retrieve a URL.
  53. * Supported URL Types:: Descriptions of URL types currently supported.
  54. * General Facilities:: URLs can be cached, accessed via a gateway
  55. and tracked in a history list.
  56. * Customization:: Variables you can alter.
  57. * GNU Free Documentation License:: The license for this documentation.
  58. * Function Index::
  59. * Variable Index::
  60. * Concept Index::
  61. @end menu
  62. @node Introduction
  63. @chapter Introduction
  64. @cindex URL
  65. @cindex URI
  66. @cindex uniform resource identifier
  67. @cindex uniform resource locator
  68. A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted
  69. name, such as an Internet address, that identifies some name or
  70. resource. The format of URIs is described in RFC 3986, which updates
  71. and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A
  72. @dfn{Uniform Resource Locator} (URL) is an older but still-common
  73. term, which basically refers to a URI corresponding to a resource that
  74. can be accessed (usually over a network) in a specific way.
  75. Here are some examples of URIs (taken from RFC 3986):
  76. @example
  77. ftp://ftp.is.co.za/rfc/rfc1808.txt
  78. http://www.ietf.org/rfc/rfc2396.txt
  79. ldap://[2001:db8::7]/c=GB?objectClass?one
  80. mailto:John.Doe@@example.com
  81. news:comp.infosystems.www.servers.unix
  82. tel:+1-816-555-1212
  83. telnet://192.0.2.16:80/
  84. urn:oasis:names:specification:docbook:dtd:xml:4.1.2
  85. @end example
  86. This manual describes the @code{url} library, an Emacs Lisp library
  87. for parsing URIs and retrieving the resources to which they refer.
  88. (The library is so-named for historical reasons; nowadays, the ``URI''
  89. terminology is regarded as the more general one, and ``URL'' is
  90. technically obsolete despite its widespread vernacular usage.)
  91. @node URI Parsing
  92. @chapter URI Parsing
  93. A URI consists of several @dfn{components}, each having a different
  94. meaning. For example, the URI
  95. @example
  96. http://www.gnu.org/software/emacs/
  97. @end example
  98. @noindent
  99. specifies the scheme component @samp{http}, the hostname component
  100. @samp{www.gnu.org}, and the path component @samp{/software/emacs/}.
  101. @cindex parsed URIs
  102. The format of URIs is specified by RFC 3986. The @code{url} library
  103. provides the Lisp function @code{url-generic-parse-url}, a (mostly)
  104. standard-compliant URI parser, as well as function
  105. @code{url-recreate-url}, which converts a parsed URI back into a URI
  106. string.
  107. @defun url-generic-parse-url uri-string
  108. This function returns a parsed version of the string @var{uri-string}.
  109. @end defun
  110. @defun url-recreate-url uri-obj
  111. @cindex unparsing URLs
  112. Given a parsed URI, this function returns the corresponding URI string.
  113. @end defun
  114. @cindex parsed URI
  115. The return value of @code{url-generic-parse-url}, and the argument
  116. expected by @code{url-recreate-url}, is a @dfn{parsed URI}: a CL
  117. structure whose slots hold the various components of the URI@.
  118. @xref{Top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, for
  119. details about CL structures. Most of the other functions in the
  120. @code{url} library act on parsed URIs.
  121. @menu
  122. * Parsed URIs:: Format of parsed URI structures.
  123. * URI Encoding:: Non-@acronym{ASCII} characters in URIs.
  124. @end menu
  125. @node Parsed URIs
  126. @section Parsed URI structures
  127. Each parsed URI structure contains the following slots:
  128. @table @code
  129. @item type
  130. The URI scheme (a string, e.g., @code{http}). @xref{Supported URL
  131. Types}, for a list of schemes that the @code{url} library knows how to
  132. process. This slot can also be @code{nil}, if the URI is not fully
  133. specified.
  134. @item user
  135. The user name (a string), or @code{nil}.
  136. @item password
  137. The user password (a string), or @code{nil}. The use of this URI
  138. component is strongly discouraged; nowadays, passwords are transmitted
  139. by other means, not as part of a URI.
  140. @item host
  141. The host name (a string), or @code{nil}. If present, this is
  142. typically a domain name or IP address.
  143. @item port
  144. The port number (an integer), or @code{nil}. Omitting this component
  145. usually means to use the ``standard'' port associated with the URI
  146. scheme.
  147. @item filename
  148. The combination of the ``path'' and ``query'' components of the URI (a
  149. string), or @code{nil}. If the query component is present, it is the
  150. substring following the first @samp{?} character, and the path
  151. component is the substring before the @samp{?}. The meaning of these
  152. components is scheme-dependent; they do not necessarily refer to a
  153. file on a disk.
  154. @item target
  155. The fragment component (a string), or @code{nil}. The fragment
  156. component specifies a ``secondary resource'', such as a section of a
  157. webpage.
  158. @item fullness
  159. This is @code{t} if the URI is fully specified, i.e., the
  160. hierarchical components of the URI (the hostname and/or username
  161. and/or password) are preceded by @samp{//}.
  162. @end table
  163. @findex url-type
  164. @findex url-user
  165. @findex url-password
  166. @findex url-host
  167. @findex url-port
  168. @findex url-filename
  169. @findex url-target
  170. @findex url-attributes
  171. @findex url-fullness
  172. These slots have accessors named @code{url-@var{part}}, where
  173. @var{part} is the slot name. For example, the accessor for the
  174. @code{host} slot is the function @code{url-host}. The @code{url-port}
  175. accessor returns the default port for the URI scheme if the parsed
  176. URI's @var{port} slot is @code{nil}.
  177. The slots can be set using @code{setf}. For example:
  178. @example
  179. (setf (url-port url) 80)
  180. @end example
  181. @node URI Encoding
  182. @section URI Encoding
  183. @cindex percent encoding
  184. The @code{url-generic-parse-url} parser does not obey RFC 3986 in
  185. one respect: it allows non-@acronym{ASCII} characters in URI strings.
  186. Strictly speaking, RFC 3986 compatible URIs may only consist of
  187. @acronym{ASCII} characters; non-@acronym{ASCII} characters are
  188. represented by converting them to UTF-8 byte sequences, and performing
  189. @dfn{percent encoding} on the bytes. For example, the o-umlaut
  190. character is converted to the UTF-8 byte sequence @samp{\xD3\xA7},
  191. then percent encoded to @samp{%D3%A7}. (Certain ``reserved''
  192. @acronym{ASCII} characters must also be percent encoded when they
  193. appear in URI components.)
  194. The function @code{url-encode-url} can be used to convert a URI
  195. string containing arbitrary characters to one that is properly
  196. percent-encoded in accordance with RFC 3986.
  197. @defun url-encode-url url-string
  198. This function return a properly URI-encoded version of
  199. @var{url-string}. It also performs @dfn{URI normalization},
  200. e.g., converting the scheme component to lowercase if it was
  201. previously uppercase.
  202. @end defun
  203. To convert between a string containing arbitrary characters and a
  204. percent-encoded all-@acronym{ASCII} string, use the functions
  205. @code{url-hexify-string} and @code{url-unhex-string}:
  206. @defun url-hexify-string string &optional allowed-chars
  207. This function performs percent-encoding on @var{string}, and returns
  208. the result.
  209. If @var{string} is multibyte, it is first converted to a UTF-8 byte
  210. string. Each byte corresponding to an allowed character is left
  211. as-is, while all other bytes are converted to a three-character
  212. sequence: @samp{%} followed by two upper-case hex digits.
  213. @vindex url-unreserved-chars
  214. @cindex unreserved characters
  215. The allowed characters are specified by @var{allowed-chars}. If this
  216. argument is @code{nil}, the allowed characters are those specified as
  217. @dfn{unreserved characters} by RFC 3986 (see the variable
  218. @code{url-unreserved-chars}). Otherwise, @var{allowed-chars} should
  219. be a vector whose @var{n}-th element is non-@code{nil} if character
  220. @var{n} is allowed.
  221. @end defun
  222. @defun url-unhex-string string &optional allow-newlines
  223. This function replaces percent-encoding sequences in @var{string} with
  224. their character equivalents, and returns the resulting string.
  225. If @var{allow-newlines} is non-@code{nil}, it allows the decoding of
  226. carriage returns and line feeds, which are normally forbidden in URIs.
  227. @end defun
  228. @node Retrieving URLs
  229. @chapter Retrieving URLs
  230. The @code{url} library defines the following three functions for
  231. retrieving the data specified by a URL@. The actual retrieval protocol
  232. depends on the URL's URI scheme, and is performed by lower-level
  233. scheme-specific functions. (Those lower-level functions are not
  234. documented here, and generally should not be called directly.)
  235. In each of these functions, the @var{url} argument can be either a
  236. string or a parsed URL structure. If it is a string, that string is
  237. passed through @code{url-encode-url} before using it, to ensure that
  238. it is properly URI-encoded (@pxref{URI Encoding}).
  239. @defun url-retrieve-synchronously url &optional silent no-cookies timeout
  240. This function synchronously retrieves the data specified by @var{url},
  241. and returns a buffer containing the data. The return value is
  242. @code{nil} if there is no data associated with the URL (as is the case
  243. for @code{dired}, @code{info}, and @code{mailto} URLs).
  244. If the optional argument @var{silent} is non-@code{nil}, progress
  245. messages are suppressed. If the optional argument @var{no-cookies} is
  246. non-@code{nil}, cookies are not stored or sent. If the optional
  247. argument @var{timeout} is non-@code{nil}, it should be a number that
  248. says (in seconds) how long to wait for a response before giving up.
  249. @end defun
  250. @defun url-retrieve url callback &optional cbargs silent no-cookies
  251. This function retrieves @var{url} asynchronously, calling the function
  252. @var{callback} when the object has been completely retrieved. The
  253. return value is the buffer into which the data will be inserted, or
  254. @code{nil} if the process has already completed.
  255. The callback function is called this way:
  256. @example
  257. (apply @var{callback} @var{status} @var{cbargs})
  258. @end example
  259. @noindent
  260. where @var{status} is a plist representing what happened during the
  261. retrieval, with most recent events first, or an empty list if no
  262. events have occurred. Each pair in the plist is one of:
  263. @table @code
  264. @item (:redirect @var{redirected-to})
  265. This means that the request was redirected to the URL
  266. @var{redirected-to}.
  267. @item (:error (@var{error-symbol} . @var{data}))
  268. This means that an error occurred. If so desired, the error can be
  269. signaled with @code{(signal @var{error-symbol} @var{data})}.
  270. @end table
  271. When the callback function is called, the current buffer is the one
  272. containing the retrieved data (if any). The buffer also contains any
  273. MIME headers associated with the data retrieval.
  274. If the optional argument @var{silent} is non-@code{nil}, progress
  275. messages are suppressed. If the optional argument @var{no-cookies} is
  276. non-@code{nil}, cookies are not stored or sent.
  277. @end defun
  278. @defun url-queue-retrieve url callback &optional cbargs silent no-cookies
  279. This function acts like @code{url-retrieve}, but with limits on the
  280. number of concurrently-running network processes. The option
  281. @code{url-queue-parallel-processes} controls the number of concurrent
  282. processes, and the option @code{url-queue-timeout} sets a timeout in
  283. seconds.
  284. To use this function, you must @code{(require 'url-queue)}.
  285. @end defun
  286. @vindex url-queue-parallel-processes
  287. @defopt url-queue-parallel-processes
  288. The value of this option is an integer specifying the maximum number
  289. of concurrent @code{url-queue-retrieve} network processes. If the
  290. number of @code{url-queue-retrieve} calls is larger than this number,
  291. later ones are queued until earlier ones are finished.
  292. @end defopt
  293. @vindex url-queue-timeout
  294. @defopt url-queue-timeout
  295. The value of this option is a number specifying the maximum lifetime
  296. of a @code{url-queue-retrieve} network process, once it is started.
  297. If a process is not finished by then, it is killed and removed from
  298. the queue.
  299. @end defopt
  300. @node Supported URL Types
  301. @chapter Supported URL Types
  302. This chapter describes functions and variables affecting URL retrieval
  303. for specific schemes.
  304. @menu
  305. * http/https:: Hypertext Transfer Protocol.
  306. * file/ftp:: Local files and FTP archives.
  307. * info:: Emacs "Info" pages.
  308. * mailto:: Sending email.
  309. * news/nntp/snews:: Usenet news.
  310. * rlogin/telnet/tn3270:: Remote host connectivity.
  311. * irc:: Internet Relay Chat.
  312. * data:: Embedded data URLs.
  313. * nfs:: Networked File System.
  314. * ldap:: Lightweight Directory Access Protocol.
  315. * man:: Unix man pages.
  316. * Tramp:: Schemes supported via Tramp.
  317. @end menu
  318. @node http/https
  319. @section @code{http} and @code{https}
  320. The @code{http} scheme refers to the Hypertext Transfer Protocol. The
  321. @code{url} library supports HTTP version 1.1, specified in RFC 2616.
  322. Its default port is 80.
  323. The @code{https} scheme is a secure version of @code{http}, with
  324. transmission via SSL@. It is defined in RFC 2069, and its default port
  325. is 443. When using @code{https}, the @code{url} library performs SSL
  326. encryption via the @code{ssl} library, by forcing the @code{ssl}
  327. gateway method to be used. @xref{Gateways in general}.
  328. @defopt url-honor-refresh-requests
  329. If this option is non-@code{nil} (the default), the @code{url} library
  330. honors the HTTP @samp{Refresh} header, which is used by servers to
  331. direct clients to reload documents from the same URL or a or different
  332. one. If the value is @code{nil}, the @samp{Refresh} header is
  333. ignored; any other value means to ask the user on each request.
  334. @end defopt
  335. @menu
  336. * Cookies::
  337. * HTTP language/coding::
  338. * HTTP URL Options::
  339. * Dealing with HTTP documents::
  340. @end menu
  341. @node Cookies
  342. @subsection Cookies
  343. @findex url-cookie-delete
  344. @defun url-cookie-list
  345. This command creates a @file{*url cookies*} buffer listing the current
  346. cookies, if there are any. You can remove a cookie using the
  347. @kbd{C-k} (@code{url-cookie-delete}) command.
  348. @end defun
  349. @defun url-cookie-delete-cookies &optional regexp
  350. This function takes a regular expression as its parameters and deletes
  351. all cookies from that domain. If @var{regexp} is @code{nil}, delete
  352. all cookies.
  353. @end defun
  354. @defopt url-cookie-file
  355. The file in which cookies are stored, defaulting to @file{cookies} in
  356. the directory specified by @code{url-configuration-directory}.
  357. @end defopt
  358. @defopt url-cookie-confirmation
  359. Specifies whether confirmation is required to accept cookies.
  360. @end defopt
  361. @defopt url-cookie-multiple-line
  362. Specifies whether to put all cookies for the server on one line in the
  363. HTTP request to satisfy broken servers like
  364. @url{http://www.hotmail.com}.
  365. @end defopt
  366. @defopt url-cookie-trusted-urls
  367. A list of regular expressions matching URLs from which to accept
  368. cookies always.
  369. @end defopt
  370. @defopt url-cookie-untrusted-urls
  371. A list of regular expressions matching URLs from which to reject
  372. cookies always.
  373. @end defopt
  374. @defopt url-cookie-save-interval
  375. The number of seconds between automatic saves of cookies to disk.
  376. Default is one hour.
  377. @end defopt
  378. @node HTTP language/coding
  379. @subsection Language and Encoding Preferences
  380. HTTP allows clients to express preferences for the language and
  381. encoding of documents which servers may honor. For each of these
  382. variables, the value is a string; it can specify a single choice, or
  383. it can be a comma-separated list.
  384. Normally, this list is ordered by descending preference. However, each
  385. element can be followed by @samp{;q=@var{priority}} to specify its
  386. preference level, a decimal number from 0 to 1; e.g., for
  387. @code{url-mime-language-string}, @w{@code{"de, en-gb;q=0.8,
  388. en;q=0.7"}}. An element that has no @samp{;q} specification has
  389. preference level 1.
  390. @defopt url-mime-charset-string
  391. @cindex character sets
  392. @cindex coding systems
  393. This variable specifies a preference for character sets when documents
  394. can be served in more than one encoding.
  395. HTTP allows specifying a series of MIME charsets which indicate your
  396. preferred character set encodings, e.g., Latin-9 or Big5, and these
  397. can be weighted. The default series is generated automatically from
  398. the associated MIME types of all defined coding systems, sorted by the
  399. coding system priority specified in Emacs. @xref{Recognize Coding, ,
  400. Recognizing Coding Systems, emacs, The GNU Emacs Manual}.
  401. @end defopt
  402. @defopt url-mime-language-string
  403. @cindex language preferences
  404. A string specifying the preferred language when servers can serve
  405. files in several languages. Use RFC 1766 abbreviations, e.g.,
  406. @samp{en} for English, @samp{de} for German.
  407. The string can be @code{"*"} to get the first available language (as
  408. opposed to the default).
  409. @end defopt
  410. @node HTTP URL Options
  411. @subsection HTTP URL Options
  412. HTTP supports an @samp{OPTIONS} method describing things supported by
  413. the URL@.
  414. @defun url-http-options url
  415. Returns a property list describing options available for URL@. The
  416. property list members are:
  417. @table @code
  418. @item methods
  419. A list of symbols specifying what HTTP methods the resource
  420. supports.
  421. @item dav
  422. @cindex DAV
  423. A list of numbers specifying what DAV protocol/schema versions are
  424. supported.
  425. @item dasl
  426. @cindex DASL
  427. A list of supported DASL search types supported (string form).
  428. @item ranges
  429. A list of the units available for use in partial document fetches.
  430. @item p3p
  431. @cindex P3P
  432. The @dfn{Platform For Privacy Protection} description for the resource.
  433. Currently this is just the raw header contents.
  434. @end table
  435. @end defun
  436. @node Dealing with HTTP documents
  437. @subsection Dealing with HTTP documents
  438. HTTP URLs are retrieved into a buffer containing the HTTP headers
  439. followed by the body. Since the headers are quasi-MIME, they may be
  440. processed using the MIME library. @xref{Top,, Emacs MIME,
  441. emacs-mime, The Emacs MIME Manual}.
  442. @node file/ftp
  443. @section file and ftp
  444. @cindex files
  445. @cindex FTP
  446. @cindex File Transfer Protocol
  447. @cindex compressed files
  448. @cindex dired
  449. The @code{ftp} and @code{file} schemes are defined in RFC 1808. The
  450. @code{url} library treats @samp{ftp:} and @samp{file:} as synonymous.
  451. Such URLs have the form
  452. @example
  453. ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
  454. file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
  455. @end example
  456. @noindent
  457. If the URL specifies a local file, it is retrieved by reading the file
  458. contents in the usual way. If it specifies a remote file, it is
  459. retrieved using either the Tramp or the Ange-FTP package.
  460. @xref{Remote Files,,, emacs, The GNU Emacs Manual}.
  461. When retrieving a compressed file, it is automatically uncompressed
  462. if it has the file suffix @file{.z}, @file{.gz}, @file{.Z},
  463. @file{.bz2}, or @file{.xz}. (The list of supported suffixes is
  464. hard-coded, and cannot be altered by customizing
  465. @code{jka-compr-compression-info-list}.)
  466. @defopt url-directory-index-file
  467. This option specifies the filename to look for when a @code{file} or
  468. @code{ftp} URL specifies a directory. The default is
  469. @file{index.html}. If this file exists and is readable, it is viewed.
  470. Otherwise, Emacs visits the directory using Dired.
  471. @end defopt
  472. @node info
  473. @section info
  474. @cindex Info
  475. @cindex Texinfo
  476. @findex Info-goto-node
  477. The @code{info} scheme is non-standard. Such URLs have the form
  478. @example
  479. info:@var{file}#@var{node}
  480. @end example
  481. @noindent
  482. and are retrieved by invoking @code{Info-goto-node} with argument
  483. @samp{(@var{file})@var{node}}. If @samp{#@var{node}} is omitted, the
  484. @samp{Top} node is opened.
  485. @node mailto
  486. @section mailto
  487. @cindex mailto
  488. @cindex email
  489. A @code{mailto} URL specifies an email message to be sent to a given
  490. email address. For example, @samp{mailto:foo@@bar.com} specifies
  491. sending a message to @samp{foo@@bar.com}. The ``retrieval method''
  492. for such URLs is to open a mail composition buffer in which the
  493. appropriate content (e.g., the recipient address) has been filled in.
  494. As defined in RFC 6068, a @code{mailto} URL can have the form
  495. @example
  496. @samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]}
  497. @end example
  498. @noindent
  499. where an arbitrary number of @var{header}s can be added. If the
  500. @var{header} is @samp{body}, then @var{contents} is put in the message
  501. body; otherwise, a @var{header} header field is created with
  502. @var{contents} as its contents. Note that the @code{url} library does
  503. not perform any checking of @var{header} or @var{contents}, so you
  504. should check them before sending the message.
  505. @defopt url-mail-command
  506. @vindex mail-user-agent
  507. The value of this variable is the function called whenever url needs
  508. to send mail. This should normally be left its default, which is the
  509. standard mail-composition command @code{compose-mail}. @xref{Sending
  510. Mail,,, emacs, The GNU Emacs Manual}.
  511. @end defopt
  512. If the document containing the @code{mailto} URL itself possessed a
  513. known URL, Emacs automatically inserts an @samp{X-Url-From} header
  514. field into the mail buffer, specifying that URL.
  515. @node news/nntp/snews
  516. @section @code{news}, @code{nntp} and @code{snews}
  517. @cindex news
  518. @cindex network news
  519. @cindex usenet
  520. @cindex NNTP
  521. @cindex snews
  522. The @code{news}, @code{nntp}, and @code{snews} schemes, defined in RFC
  523. 1738, are used for reading Usenet newsgroups. For compatibility with
  524. non-standard-compliant news clients, the @code{url} library allows
  525. host and port fields to be included in @code{news} URLs, even though
  526. they are properly only allowed for @code{nntp} and @code{snews}.
  527. @code{news} and @code{nntp} URLs have the following form:
  528. @table @samp
  529. @item news:@var{newsgroup}
  530. Retrieves a list of messages in @var{newsgroup};
  531. @item news:@var{message-id}
  532. Retrieves the message with the given @var{message-id};
  533. @item news:*
  534. Retrieves a list of all available newsgroups;
  535. @item nntp://@var{host}:@var{port}/@var{newsgroup}
  536. @itemx nntp://@var{host}:@var{port}/@var{message-id}
  537. @itemx nntp://@var{host}:@var{port}/*
  538. Similar to the @samp{news} versions.
  539. @end table
  540. The default port for @code{nntp} (and @code{news}) is 119. The
  541. difference between an @code{nntp} URL and a @code{news} URL is that an
  542. @code{nttp} URL may specify an article by its number. The
  543. @samp{snews} scheme is the same as @samp{nntp}, except that it is
  544. tunneled through SSL and has default port 563.
  545. These URLs are retrieved via the Gnus package.
  546. @cindex environment variable
  547. @vindex NNTPSERVER
  548. @defopt url-news-server
  549. This variable specifies the default news server from which to fetch
  550. news, if no server was specified in the URL@. The default value,
  551. @code{nil}, means to use the server specified by the standard
  552. environment variable @samp{NNTPSERVER}, or @samp{news} if that
  553. environment variable is unset.
  554. @end defopt
  555. @node rlogin/telnet/tn3270
  556. @section rlogin, telnet and tn3270
  557. @cindex rlogin
  558. @cindex telnet
  559. @cindex tn3270
  560. @cindex terminal emulation
  561. @findex terminal-emulator
  562. These URL schemes are defined in RFC 1738, and are used for logging in
  563. via a terminal emulator. They have the form
  564. @example
  565. telnet://@var{user}:@var{password}@@@var{host}:@var{port}
  566. @end example
  567. @noindent
  568. but the @var{password} component is ignored. By default, the
  569. @code{telnet} scheme is handled via Tramp (@pxref{Tramp}).
  570. To handle rlogin, telnet and tn3270 URLs, a @code{rlogin},
  571. @code{telnet} or @code{tn3270} (the program names and arguments are
  572. hardcoded) session is run in a @code{terminal-emulator} buffer.
  573. Well-known ports are used if the URL does not specify a port.
  574. @node irc
  575. @section irc
  576. @cindex IRC
  577. @cindex Internet Relay Chat
  578. @cindex ZEN IRC
  579. @cindex ERC
  580. @cindex rcirc
  581. The @code{irc} scheme is defined in the Internet Draft at
  582. @url{http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt} (which
  583. was never approved as an RFC). Such URLs have the form
  584. @example
  585. irc://@var{host}:@var{port}/@var{target},@var{needpass}
  586. @end example
  587. @noindent
  588. and are retrieved by opening an @acronym{IRC} session using the
  589. function specified by @code{url-irc-function}.
  590. @defopt url-irc-function
  591. The value of this option is a function, which is called to open an IRC
  592. connection for @code{irc} URLs. This function must take five
  593. arguments, @var{host}, @var{port}, @var{channel}, @var{user} and
  594. @var{password}. The @var{channel} argument specifies the channel to
  595. join immediately, and may be @code{nil}.
  596. The default is @code{url-irc-rcirc}, which uses the Rcirc package.
  597. Other options are @code{url-irc-erc} (which uses ERC) and
  598. @code{url-irc-zenirc} (which uses ZenIRC).
  599. @end defopt
  600. @node data
  601. @section data
  602. @cindex data URLs
  603. The @code{data} scheme, defined in RFC 2397, contains MIME data in
  604. the URL itself. Such URLs have the form
  605. @example
  606. data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data}
  607. @end example
  608. @noindent
  609. @var{media-type} is a MIME @samp{Content-Type} string, possibly
  610. including parameters. It defaults to
  611. @samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be
  612. omitted but the charset parameter supplied. If @samp{;base64} is
  613. present, the @var{data} are base64-encoded.
  614. @node nfs
  615. @section nfs
  616. @cindex NFS
  617. @cindex Network File System
  618. @cindex automounter
  619. The @code{nfs} scheme, defined in RFC 2224, is similar to @code{ftp}
  620. except that it points to a file on a remote host that is handled by an
  621. NFS automounter on the local host. Such URLs have the form
  622. @example
  623. nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
  624. @end example
  625. @defvar url-nfs-automounter-directory-spec
  626. @end defvar
  627. A string saying how to invoke the NFS automounter. Certain @samp{%}
  628. sequences are recognized:
  629. @table @samp
  630. @item %h
  631. The hostname of the NFS server;
  632. @item %n
  633. The port number of the NFS server;
  634. @item %u
  635. The username to use to authenticate;
  636. @item %p
  637. The password to use to authenticate;
  638. @item %f
  639. The filename on the remote server;
  640. @item %%
  641. A literal @samp{%}.
  642. @end table
  643. Each can be used any number of times.
  644. @node ldap
  645. @section ldap
  646. @cindex LDAP
  647. @cindex Lightweight Directory Access Protocol
  648. The LDAP scheme is defined in RFC 2255.
  649. @node man
  650. @section man
  651. @cindex @command{man}
  652. @cindex Unix man pages
  653. @findex man
  654. The @code{man} scheme is a non-standard one. Such URLs have the form
  655. @example
  656. @samp{man:@var{page-spec}}
  657. @end example
  658. @noindent
  659. and are retrieved by passing @var{page-spec} to the Lisp function
  660. @code{man}.
  661. @node Tramp
  662. @section URL Types Supported via Tramp
  663. @vindex url-tramp-protocols
  664. Some additional URL types are supported by passing them to Tramp
  665. (@pxref{Top, The Tramp Manual,, tramp, The Tramp Manual}). These
  666. protocols are listed in the @code{url-tramp-protocols} variable, which
  667. you can customize. The default value includes the following
  668. protocols:
  669. @table @code
  670. @item ftp
  671. The file transfer protocol. @xref{file/ftp}.
  672. @item ssh
  673. @cindex ssh
  674. The secure shell protocol. @xref{Inline methods,,, tramp, The Tramp
  675. Manual}.
  676. @item scp
  677. @cindex scp
  678. The secure file copy protocol. @xref{External methods,,, tramp, The
  679. Tramp Manual}.
  680. @item rsync
  681. @cindex rsync
  682. The remote sync protocol.
  683. @item telnet
  684. The telnet protocol.
  685. @end table
  686. @node General Facilities
  687. @chapter General Facilities
  688. @menu
  689. * Disk Caching::
  690. * Proxies::
  691. * Gateways in general::
  692. * History::
  693. @end menu
  694. @node Disk Caching
  695. @section Disk Caching
  696. @cindex Caching
  697. @cindex Persistent Cache
  698. @cindex Disk Cache
  699. The disk cache stores retrieved documents locally, whence they can be
  700. retrieved more quickly. When requesting a URL that is in the cache,
  701. the library checks to see if the page has changed since it was last
  702. retrieved from the remote machine. If not, the local copy is used,
  703. saving the transmission over the network.
  704. @cindex Cleaning the cache
  705. @cindex Clearing the cache
  706. @cindex Cache cleaning
  707. Currently the cache isn't cleared automatically.
  708. @c Running the @code{clean-cache} shell script
  709. @c fist is recommended, to allow for future cleaning of the cache. This
  710. @c shell script will remove all files that have not been accessed since it
  711. @c was last run. To keep the cache pared down, it is recommended that this
  712. @c script be run from @i{at} or @i{cron} (see the manual pages for
  713. @c crontab(5) or at(1) for more information)
  714. @defopt url-automatic-caching
  715. Setting this variable non-@code{nil} causes documents to be cached
  716. automatically.
  717. @end defopt
  718. @defopt url-cache-directory
  719. This variable specifies the
  720. directory to store the cache files. It defaults to sub-directory
  721. @file{cache} of @code{url-configuration-directory}.
  722. @end defopt
  723. @defopt url-cache-creation-function
  724. The cache relies on a scheme for mapping URLs to files in the cache.
  725. This variable names a function which sets the type of cache to use.
  726. It takes a URL as argument and returns the absolute file name of the
  727. corresponding cache file. The two supplied possibilities are
  728. @code{url-cache-create-filename-using-md5} and
  729. @code{url-cache-create-filename-human-readable}.
  730. @end defopt
  731. @defun url-cache-create-filename-using-md5 url
  732. Creates a cache file name from @var{url} using MD5 hashing.
  733. This is creates entries with very few cache collisions and is fast.
  734. @cindex MD5
  735. @smallexample
  736. (url-cache-create-filename-using-md5 "http://www.example.com/foo/bar")
  737. @result{} "/home/fx/.url/cache/fx/http/com/example/www/b8a35774ad20db71c7c3409a5410e74f"
  738. @end smallexample
  739. @end defun
  740. @defun url-cache-create-filename-human-readable url
  741. Creates a cache file name from @var{url} more obviously connected to
  742. @var{url} than for @code{url-cache-create-filename-using-md5}, but
  743. more likely to conflict with other files.
  744. @smallexample
  745. (url-cache-create-filename-human-readable "http://www.example.com/foo/bar")
  746. @result{} "/home/fx/.url/cache/fx/http/com/example/www/foo/bar"
  747. @end smallexample
  748. @end defun
  749. @defun url-cache-expired
  750. This function returns non-@code{nil} if a cache entry has expired (or is absent).
  751. The arguments are a URL and optional expiration delay in seconds
  752. (default @var{url-cache-expire-time}).
  753. @end defun
  754. @defopt url-cache-expire-time
  755. This variable is the default number of seconds to use for the
  756. expire-time argument of the function @code{url-cache-expired}.
  757. @end defopt
  758. @defun url-fetch-from-cache
  759. This function takes a URL as its argument and returns a buffer
  760. containing the data cached for that URL.
  761. @end defun
  762. @c Fixme: never actually used currently?
  763. @c @defopt url-standalone-mode
  764. @c @cindex Relying on cache
  765. @c @cindex Cache only mode
  766. @c @cindex Standalone mode
  767. @c If this variable is non-@code{nil}, the library relies solely on the
  768. @c cache for fetching documents and avoids checking if they have changed
  769. @c on remote servers.
  770. @c @end defopt
  771. @c With a large cache of documents on the local disk, it can be very handy
  772. @c when traveling, or any other time the network connection is not active
  773. @c (a laptop with a dial-on-demand PPP connection, etc.). Emacs/W3 can rely
  774. @c solely on its cache, and avoid checking to see if the page has changed
  775. @c on the remote server. In the case of a dial-on-demand PPP connection,
  776. @c this will keep the phone line free as long as possible, only bringing up
  777. @c the PPP connection when asking for a page that is not located in the
  778. @c cache. This is very useful for demonstrations as well.
  779. @node Proxies
  780. @section Proxies and Gatewaying
  781. @c fixme: check/document url-ns stuff
  782. @cindex proxy servers
  783. @cindex proxies
  784. @cindex environment variables
  785. @vindex HTTP_PROXY
  786. Proxy servers are commonly used to provide gateways through firewalls
  787. or as caches serving some more-or-less local network. Each protocol
  788. (HTTP, FTP, etc.)@: can have a different gateway server. Proxying is
  789. conventionally configured commonly amongst different programs through
  790. environment variables of the form @code{@var{protocol}_proxy}, where
  791. @var{protocol} is one of the supported network protocols (@code{http},
  792. @code{ftp} etc.). The library recognizes such variables in either
  793. upper or lower case. Their values are of one of the forms:
  794. @itemize @bullet
  795. @item @code{@var{host}:@var{port}}
  796. @item A full URL;
  797. @item Simply a host name.
  798. @end itemize
  799. @vindex NO_PROXY
  800. The @code{NO_PROXY} environment variable specifies URLs that should be
  801. excluded from proxying (on servers that should be contacted directly).
  802. This should be a comma-separated list of hostnames, domain names, or a
  803. mixture of both. Asterisks can be used as wildcards, but other
  804. clients may not support that. Domain names may be indicated by a
  805. leading dot. For example:
  806. @example
  807. NO_PROXY="*.aventail.com,home.com,.seanet.com"
  808. @end example
  809. @noindent says to contact all machines in the @samp{aventail.com} and
  810. @samp{seanet.com} domains directly, as well as the machine named
  811. @samp{home.com}. If @code{NO_PROXY} isn't defined, @code{no_PROXY}
  812. and @code{no_proxy} are also tried, in that order.
  813. Proxies may also be specified directly in Lisp.
  814. @defopt url-proxy-services
  815. This variable is an alist of URL schemes and proxy servers that
  816. gateway them. The items are of the form @w{@code{(@var{scheme}
  817. . @var{host}:@var{portnumber})}}, says that the URL @var{scheme} is
  818. gatewayed through @var{portnumber} on the specified @var{host}. An
  819. exception is the pseudo scheme @code{"no_proxy"}, which is paired with
  820. a regexp matching host names not to be proxied. This variable is
  821. initialized from the environment as above.
  822. @example
  823. (setq url-proxy-services
  824. '(("http" . "proxy.aventail.com:80")
  825. ("no_proxy" . "^.*\\(aventail\\|seanet\\)\\.com")))
  826. @end example
  827. @end defopt
  828. @node Gateways in general
  829. @section Gateways in General
  830. @cindex gateways
  831. @cindex firewalls
  832. The library provides a general gateway layer through which all
  833. networking passes. It can both control access to the network and
  834. provide access through gateways in firewalls. This may make direct
  835. connections in some cases and pass through some sort of gateway in
  836. others.@footnote{Proxies (which only operate over HTTP) are
  837. implemented using this.} The library's basic function responsible for
  838. making connections is @code{url-open-stream}.
  839. @defun url-open-stream name buffer host service
  840. @cindex opening a stream
  841. @cindex stream, opening
  842. Open a stream to @var{host}, possibly via a gateway. The other
  843. arguments are as for @code{open-network-stream}. This will not make a
  844. connection if @code{url-gateway-unplugged} is non-@code{nil}.
  845. @end defun
  846. @defvar url-gateway-local-host-regexp
  847. This is a regular expression that matches local hosts that do not
  848. require the use of a gateway. If @code{nil}, all connections are made
  849. through the gateway.
  850. @end defvar
  851. @defvar url-gateway-method
  852. This variable controls which gateway method is used. It may be useful
  853. to bind it temporarily in some applications. It has values taken from
  854. a list of symbols. Possible values are:
  855. @table @code
  856. @item telnet
  857. @cindex @command{telnet}
  858. Use this method if you must first telnet and log into a gateway host,
  859. and then run telnet from that host to connect to outside machines.
  860. @item rlogin
  861. @cindex @command{rlogin}
  862. This method is identical to @code{telnet}, but uses @command{rlogin}
  863. to log into the remote machine without having to send the username and
  864. password over the wire every time.
  865. @item socks
  866. @cindex @sc{socks}
  867. Use if the firewall has a @sc{socks} gateway running on it. The
  868. @sc{socks} v5 protocol is defined in RFC 1928.
  869. @c @item ssl
  870. @c This probably shouldn't be documented
  871. @c Fixme: why not? -- fx
  872. @item native
  873. This method uses Emacs's builtin networking directly. This is the
  874. default. It can be used only if there is no firewall blocking access.
  875. @end table
  876. @end defvar
  877. The following variables control the gateway methods.
  878. @defopt url-gateway-telnet-host
  879. The gateway host to telnet to. Once logged in there, you then telnet
  880. out to the hosts you want to connect to.
  881. @end defopt
  882. @defopt url-gateway-telnet-parameters
  883. This should be a list of parameters to pass to the @command{telnet} program.
  884. @end defopt
  885. @defopt url-gateway-telnet-password-prompt
  886. This is a regular expression that matches the password prompt when
  887. logging in.
  888. @end defopt
  889. @defopt url-gateway-telnet-login-prompt
  890. This is a regular expression that matches the username prompt when
  891. logging in.
  892. @end defopt
  893. @defopt url-gateway-telnet-user-name
  894. The username to log in with.
  895. @end defopt
  896. @defopt url-gateway-telnet-password
  897. The password to send when logging in.
  898. @end defopt
  899. @defopt url-gateway-prompt-pattern
  900. This is a regular expression that matches the shell prompt.
  901. @end defopt
  902. @defopt url-gateway-rlogin-host
  903. Host to @samp{rlogin} to before telnetting out.
  904. @end defopt
  905. @defopt url-gateway-rlogin-parameters
  906. Parameters to pass to @samp{rsh}.
  907. @end defopt
  908. @defopt url-gateway-rlogin-user-name
  909. User name to use when logging in to the gateway.
  910. @end defopt
  911. @defopt url-gateway-prompt-pattern
  912. This is a regular expression that matches the shell prompt.
  913. @end defopt
  914. @defopt socks-server
  915. This specifies the default server, it takes the form
  916. @w{@code{("Default server" @var{server} @var{port} @var{version})}}
  917. where @var{version} can be either 4 or 5.
  918. @end defopt
  919. @defvar socks-password
  920. If this is @code{nil} then you will be asked for the password,
  921. otherwise it will be used as the password for authenticating you to
  922. the @sc{socks} server.
  923. @end defvar
  924. @defvar socks-username
  925. This is the username to use when authenticating yourself to the
  926. @sc{socks} server. By default this is your login name.
  927. @end defvar
  928. @defvar socks-timeout
  929. This controls how long, in seconds, to wait for responses from the
  930. @sc{socks} server; it is 5 by default.
  931. @end defvar
  932. @c fixme: these have been effectively commented-out in the code
  933. @c @defopt socks-server-aliases
  934. @c This a list of server aliases. It is a list of aliases of the form
  935. @c @var{(alias hostname port version)}.
  936. @c @end defopt
  937. @c @defopt socks-network-aliases
  938. @c This a list of network aliases. Each entry in the list takes the form
  939. @c @var{(alias (network))} where @var{alias} is a string that names the
  940. @c @var{network}. The networks can contain a pair (not a dotted pair) of
  941. @c @sc{ip} addresses which specify a range of @sc{ip} addresses, an @sc{ip}
  942. @c address and a netmask, a domain name or a unique hostname or @sc{ip}
  943. @c address.
  944. @c @end defopt
  945. @c @defopt socks-redirection-rules
  946. @c This a list of redirection rules. Each rule take the form
  947. @c @var{(Destination network Connection type)} where @var{Destination
  948. @c network} is a network alias from @code{socks-network-aliases} and
  949. @c @var{Connection type} can be @code{nil} in which case a direct
  950. @c connection is used, or it can be an alias from
  951. @c @code{socks-server-aliases} in which case that server is used as a
  952. @c proxy.
  953. @c @end defopt
  954. @defopt socks-nslookup-program
  955. @cindex @command{nslookup}
  956. This the @samp{nslookup} program. It is @code{"nslookup"} by default.
  957. @end defopt
  958. @menu
  959. * Suppressing network connections::
  960. @end menu
  961. @c * Broken hostname resolution::
  962. @node Suppressing network connections
  963. @subsection Suppressing Network Connections
  964. @cindex network connections, suppressing
  965. @cindex suppressing network connections
  966. @cindex bugs, HTML
  967. @cindex HTML ``bugs''
  968. In some circumstances it is desirable to suppress making network
  969. connections. A typical case is when rendering HTML in a mail user
  970. agent, when external URLs should not be activated, particularly to
  971. avoid ``bugs'' which ``call home'' by fetch single-pixel images and the
  972. like. To arrange this, bind the following variable for the duration
  973. of such processing.
  974. @defvar url-gateway-unplugged
  975. If this variable is non-@code{nil} new network connections are never
  976. opened by the URL library.
  977. @end defvar
  978. @c @node Broken hostname resolution
  979. @c @subsection Broken Hostname Resolution
  980. @c @cindex hostname resolver
  981. @c @cindex resolver, hostname
  982. @c Some C libraries do not include the hostname resolver routines in
  983. @c their static libraries. If Emacs was linked statically, and was not
  984. @c linked with the resolver libraries, it will not be able to get to any
  985. @c machines off the local network. This is characterized by being able
  986. @c to reach someplace with a raw ip number, but not its hostname
  987. @c (@url{http://129.79.254.191/} works, but
  988. @c @url{http://www.cs.indiana.edu/} doesn't). This used to happen on
  989. @c SunOS4 and Ultrix, but is now probably now rare. If Emacs can't be
  990. @c rebuilt linked against the resolver library, it can use the external
  991. @c @command{nslookup} program instead.
  992. @c @defopt url-gateway-broken-resolution
  993. @c @cindex @code{nslookup} program
  994. @c @cindex program, @code{nslookup}
  995. @c If non-@code{nil}, this variable says to use the program specified by
  996. @c @code{url-gateway-nslookup-program} program to do hostname resolution.
  997. @c @end defopt
  998. @c @defopt url-gateway-nslookup-program
  999. @c The name of the program to do hostname lookup if Emacs can't do it
  1000. @c directly. This program should expect a single argument on the command
  1001. @c line---the hostname to resolve---and should produce output similar to
  1002. @c the standard Unix @command{nslookup} program:
  1003. @c @example
  1004. @c Name: www.cs.indiana.edu
  1005. @c Address: 129.79.254.191
  1006. @c @end example
  1007. @c @end defopt
  1008. @node History
  1009. @section History
  1010. @findex url-do-setup
  1011. The library can maintain a global history list tracking URLs accessed.
  1012. URL completion can be done from it. The history mechanism is set up
  1013. automatically via @code{url-do-setup} when it is configured to be on.
  1014. Note that the size of the history list is currently not limited.
  1015. @vindex url-history-hash-table
  1016. The history ``list'' is actually a hash table,
  1017. @code{url-history-hash-table}. It contains access times keyed by URL
  1018. strings. The times are in the format returned by @code{current-time}.
  1019. @defun url-history-update-url url time
  1020. This function updates the history table with an entry for @var{url}
  1021. accessed at the given @var{time}.
  1022. @end defun
  1023. @defopt url-history-track
  1024. If non-@code{nil}, the library will keep track of all the URLs
  1025. accessed. If it is @code{t}, the list is saved to disk at the end of
  1026. each Emacs session. The default is @code{nil}.
  1027. @end defopt
  1028. @defopt url-history-file
  1029. The file storing the history list between sessions. It defaults to
  1030. @file{history} in @code{url-configuration-directory}.
  1031. @end defopt
  1032. @defopt url-history-save-interval
  1033. @findex url-history-setup-save-timer
  1034. The number of seconds between automatic saves of the history list.
  1035. Default is one hour. Note that if you change this variable directly,
  1036. rather than using Custom, after @code{url-do-setup} has been run, you
  1037. need to run the function @code{url-history-setup-save-timer}.
  1038. @end defopt
  1039. @defun url-history-parse-history &optional fname
  1040. Parses the history file @var{fname} (default @code{url-history-file})
  1041. and sets up the history list.
  1042. @end defun
  1043. @defun url-history-save-history &optional fname
  1044. Saves the current history to file @var{fname} (default
  1045. @code{url-history-file}).
  1046. @end defun
  1047. @defun url-completion-function string predicate function
  1048. You can use this function to do completion of URLs from the history.
  1049. @end defun
  1050. @node Customization
  1051. @chapter Customization
  1052. @cindex environment variables
  1053. The following environment variables affect the @code{url} library's
  1054. operation at startup.
  1055. @table @code
  1056. @item TMPDIR
  1057. @vindex TMPDIR
  1058. @vindex url-temporary-directory
  1059. If this is defined, @var{url-temporary-directory} is initialized from
  1060. it.
  1061. @end table
  1062. The following user options affect the general operation of
  1063. @code{url} library.
  1064. @defopt url-configuration-directory
  1065. @cindex configuration files
  1066. The value of this variable specifies the name of the directory where
  1067. the @code{url} library stores its various configuration files, cache
  1068. files, etc.
  1069. The default value specifies a subdirectory named @file{url/} in the
  1070. standard Emacs user data directory specified by the variable
  1071. @code{user-emacs-directory} (normally @file{~/.emacs.d}). However,
  1072. the old default was @file{~/.url}, and this directory is used instead
  1073. if it exists.
  1074. @end defopt
  1075. @defopt url-debug
  1076. @cindex debugging
  1077. Specifies the types of debug messages which are logged to
  1078. the @file{*URL-DEBUG*} buffer.
  1079. @code{t} means log all messages.
  1080. A number means log all messages and show them with @code{message}.
  1081. It may also be a list of the types of messages to be logged.
  1082. @end defopt
  1083. @defopt url-personal-mail-address
  1084. @end defopt
  1085. @defopt url-privacy-level
  1086. @end defopt
  1087. @defopt url-uncompressor-alist
  1088. @end defopt
  1089. @defopt url-passwd-entry-func
  1090. @end defopt
  1091. @defopt url-standalone-mode
  1092. @end defopt
  1093. @defopt url-bad-port-list
  1094. @end defopt
  1095. @defopt url-max-password-attempts
  1096. @end defopt
  1097. @defopt url-temporary-directory
  1098. @end defopt
  1099. @defopt url-show-status
  1100. @end defopt
  1101. @defopt url-confirmation-func
  1102. The function to use for asking yes or no functions. This is normally
  1103. either @code{y-or-n-p} or @code{yes-or-no-p}, but could be another
  1104. function taking a single argument (the prompt) and returning @code{t}
  1105. only if an affirmative answer is given.
  1106. @end defopt
  1107. @defopt url-gateway-method
  1108. @c fixme: describe gatewaying
  1109. A symbol specifying the type of gateway support to use for connections
  1110. from the local machine. The supported methods are:
  1111. @table @code
  1112. @item telnet
  1113. Run telnet in a subprocess to connect;
  1114. @item rlogin
  1115. Rlogin to another machine to connect;
  1116. @item socks
  1117. Connect through a socks server;
  1118. @item ssl
  1119. Connect with SSL;
  1120. @item native
  1121. Connect directly.
  1122. @end table
  1123. @end defopt
  1124. @defopt url-user-agent
  1125. The User Agent string used for sending @acronym{HTTP}/@acronym{HTTPS}
  1126. requests. The value should be @code{nil}, which means that no
  1127. @samp{User-Agent} header is generated, @code{default}, which means
  1128. that a string is generated based on the setting of
  1129. @code{url-privacy-leve}, a string or a function of no arguments that
  1130. returns a string.
  1131. The default is @code{default}, which means that the
  1132. @w{@samp{User-Agent: @var{package-name} URL/Emacs}} string will be
  1133. generated, where @var{package-name} is the value of
  1134. @code{url-package-name} and its version, if they are non-@code{nil}.
  1135. @end defopt
  1136. @node GNU Free Documentation License
  1137. @appendix GNU Free Documentation License
  1138. @include doclicense.texi
  1139. @node Function Index
  1140. @unnumbered Command and Function Index
  1141. @printindex fn
  1142. @node Variable Index
  1143. @unnumbered Variable Index
  1144. @printindex vr
  1145. @node Concept Index
  1146. @unnumbered Concept Index
  1147. @printindex cp
  1148. @bye