comparison lisp/url/url-vars.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 ;;; url-vars.el,v --- Variables for Uniform Resource Locator tool
2 ;; Author: wmperry
3 ;; Created: 1996/06/03 15:04:57
4 ;; Version: 1.13
5 ;; Keywords: comm, data, processes, hypermedia
6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1993, 1994, 1995 by William M. Perry (wmperry@spry.com)
9 ;;;
10 ;;; This file is not part of GNU Emacs, but the same permissions apply.
11 ;;;
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 2, or (at your option)
15 ;;; any later version.
16 ;;;
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26
27 (defconst url-version (let ((x "1.13"))
28 (if (string-match "Revision: \\([^ \t\n]+\\)" x)
29 (substring x (match-beginning 1) (match-end 1))
30 x))
31 "Version # of URL package.")
32
33
34 ;;; This is so we can use a consistent method of checking for mule support
35 ;;; Emacs-based mule uses (boundp 'MULE), but XEmacs-based mule uses
36 ;;; (featurep 'mule) - I choose to use the latter.
37
38 (if (boundp 'MULE)
39 (provide 'mule))
40
41 (defvar url-current-can-be-cached t
42 "*Whether the current URL can be cached.")
43
44 (defvar url-current-object nil
45 "A parsed representation of the current url")
46
47 (defvar url-current-callback-func nil
48 "*The callback function for the current buffer.")
49
50 (defvar url-current-callback-data nil
51 "*The data to be passed to the callback function. This should be a list,
52 each item in the list will be an argument to the url-current-callback-func.")
53
54 (mapcar 'make-variable-buffer-local '(
55 url-current-callback-data
56 url-current-callback-func
57 url-current-can-be-cached
58 url-current-content-length
59 url-current-file
60 url-current-isindex
61 url-current-mime-encoding
62 url-current-mime-headers
63 url-current-mime-type
64 url-current-mime-viewer
65 url-current-object
66 url-current-port
67 url-current-referer
68 url-current-type
69 url-current-user
70 ))
71
72 (defvar url-default-retrieval-proc 'url-default-callback
73 "*The default action to take when an asynchronous retrieval completes.")
74
75 (defvar url-honor-refresh-requests t
76 "*Whether to do automatic page reloads at the request of the document
77 author or the server via the `Refresh' header in an HTTP/1.0 response.
78 If nil, no refresh requests will be honored.
79 If t, all refresh requests will be honored.
80 If non-nil and not t, the user will be asked for each refresh request.")
81
82 (defvar url-emacs-minor-version
83 (if (boundp 'emacs-minor-version)
84 (symbol-value 'emacs-minor-version)
85 (if (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
86 (string-to-int
87 (substring emacs-version
88 (match-beginning 1) (match-end 1)))
89 0))
90 "What minor version of emacs we are using.")
91
92 (defvar url-inhibit-mime-parsing nil
93 "Whether to parse out (and delete) the MIME headers from a message.")
94
95 (defvar url-forms-based-ftp nil
96 "*If non-nil, local and remote file access of directories will be shown
97 as an HTML 3.0 form, allowing downloads of multiple files at once.")
98
99 (defvar url-automatic-caching nil
100 "*If non-nil, all documents will be automatically cached to the local
101 disk.")
102
103 (defvar url-cache-expired
104 (function (lambda (t1 t2) (>= (- (car t2) (car t1)) 5)))
105 "*A function (`funcall'able) that takes two times as its arguments, and
106 returns non-nil if the second time is 'too old' when compared to the first
107 time.")
108
109 (defvar url-check-md5s nil
110 "*Whether to check md5s of retrieved documents or not.")
111
112 (defvar url-expected-md5 nil "What md5 we expect to see.")
113
114 (defvar url-broken-resolution nil
115 "*Whether to use [ange|efs]-ftp-nslookup-host.")
116
117 (defvar url-bug-address "wmperry@spry.com" "Where to send bug reports.")
118
119 (defvar url-personal-mail-address nil
120 "*Your full email address. This is what is sent to HTTP/1.0 servers as
121 the FROM field. If not set when url-do-setup is run, it defaults to
122 the value of url-pgp/pem-entity.")
123
124 (defvar url-mule-retrieval-coding-system (if (featurep 'mule) *euc-japan*
125 nil)
126 "Coding system for retrieval, used before hexified.")
127
128 (defvar url-directory-index-file "index.html"
129 "*The filename to look for when indexing a directory. If this file
130 exists, and is readable, then it will be viewed instead of
131 automatically creating the directory listing.")
132
133 (defvar url-pgp/pem-entity nil
134 "*The users PGP/PEM id - usually their email address.")
135
136 (defvar url-privacy-level 'none
137 "*How private you want your requests to be.
138 HTTP/1.0 has header fields for various information about the user, including
139 operating system information, email addresses, the last page you visited, etc.
140 This variable controls how much of this information is sent.
141
142 This should a symbol or a list.
143 Valid values if a symbol are:
144 none -- Send all information
145 low -- Don't send the last location
146 high -- Don't send the email address or last location
147 paranoid -- Don't send anything
148
149 If a list, this should be a list of symbols of what NOT to send.
150 Valid symbols are:
151 email -- the email address
152 os -- the operating system info
153 lastloc -- the last location
154 agent -- Do not send the User-Agent string
155
156 Samples:
157
158 (setq url-privacy-level 'high)
159 (setq url-privacy-level '(email lastloc)) ;; equivalent to 'high
160 (setq url-privacy-level '(os))
161
162 ::NOTE::
163 This variable controls several other variables and is _NOT_ automatically
164 updated. Call the function `url-setup-privacy-info' after modifying this
165 variable.
166 ")
167
168 (defvar url-uudecode-program "uudecode" "*The UUdecode executable.")
169
170 (defvar url-uuencode-program "uuencode" "*The UUencode executable.")
171
172 (defvar url-history-list nil "List of urls visited this session.")
173
174 (defvar url-inhibit-uncompression nil "Do not do decompression if non-nil.")
175
176 (defvar url-keep-history nil
177 "*Controls whether to keep a list of all the URLS being visited. If
178 non-nil, url will keep track of all the URLS visited.
179 If eq to `t', then the list is saved to disk at the end of each emacs
180 session.")
181
182 (defvar url-uncompressor-alist '((".z" . "x-gzip")
183 (".gz" . "x-gzip")
184 (".uue" . "x-uuencoded")
185 (".hqx" . "x-hqx")
186 (".Z" . "x-compress"))
187 "*An assoc list of file extensions and the appropriate uncompression
188 programs for each.")
189
190 (defvar url-xterm-command "xterm -title %s -ut -e %s %s %s"
191 "*Command used to start an xterm window.")
192
193 (defvar url-tn3270-emulator "tn3270"
194 "The client to run in a subprocess to connect to a tn3270 machine.")
195
196 (defvar url-use-transparent nil
197 "*Whether to use the transparent package by Brian Tompsett instead of
198 the builtin telnet functions. Using transparent allows you to have full
199 vt100 emulation in the telnet and tn3270 links.")
200
201 (defvar url-mail-command 'url-mail
202 "*This function will be called whenever url needs to send mail. It should
203 enter a mail-mode-like buffer in the current window.
204 The commands mail-to and mail-subject should still work in this
205 buffer, and it should use mail-header-separator if possible.")
206
207 (defvar url-local-exec-path nil
208 "*A list of possible locations for x-exec scripts.")
209
210 (defvar url-proxy-services nil
211 "*An assoc list of access types and servers that gateway them.
212 Looks like ((\"http\" . \"url://for/proxy/server/\") ....) This is set up
213 from the ACCESS_proxy environment variables in url-do-setup.")
214
215 (defvar url-global-history-file nil
216 "*The global history file used by both Mosaic/X and the url package.
217 This file contains a list of all the URLs you have visited. This file
218 is parsed at startup and used to provide URL completion.")
219
220 (defvar url-global-history-save-interval 3600
221 "*The number of seconds between automatic saves of the history list.
222 Default is 1 hour. Note that if you change this variable after `url-do-setup'
223 has been run, you need to run the `url-setup-save-timer' function manually.")
224
225 (defvar url-global-history-timer nil)
226
227 (defvar url-passwd-entry-func nil
228 "*This is a symbol indicating which function to call to read in a
229 password. It will be set up depending on whether you are running EFS
230 or ange-ftp at startup if it is nil. This function should accept the
231 prompt string as its first argument, and the default value as its
232 second argument.")
233
234 (defvar url-gopher-labels
235 '(("0" . "(TXT)")
236 ("1" . "(DIR)")
237 ("2" . "(CSO)")
238 ("3" . "(ERR)")
239 ("4" . "(MAC)")
240 ("5" . "(PCB)")
241 ("6" . "(UUX)")
242 ("7" . "(???)")
243 ("8" . "(TEL)")
244 ("T" . "(TN3)")
245 ("9" . "(BIN)")
246 ("g" . "(GIF)")
247 ("I" . "(IMG)")
248 ("h" . "(WWW)")
249 ("s" . "(SND)"))
250 "*An assoc list of gopher types and how to describe them in the gopher
251 menus. These can be any string, but HTML/HTML+ entities should be
252 used when necessary, or it could disrupt formatting of the document
253 later on. It is also a good idea to make sure all the strings are the
254 same length after entity references are removed, on a strictly
255 stylistic level.")
256
257 (defvar url-gopher-icons
258 '(
259 ("0" . "&text.document;")
260 ("1" . "&folder;")
261 ("2" . "&index;")
262 ("3" . "&stop;")
263 ("4" . "&binhex.document;")
264 ("5" . "&binhex.document;")
265 ("6" . "&uuencoded.document;")
266 ("7" . "&index;")
267 ("8" . "&telnet;")
268 ("T" . "&tn3270;")
269 ("9" . "&binary.document;")
270 ("g" . "ℑ")
271 ("I" . "ℑ")
272 ("s" . "&audio;"))
273 "*An assoc list of gopher types and the graphic entity references to
274 show when possible.")
275
276 (defvar url-standalone-mode nil "*Rely solely on the cache?")
277 (defvar url-working-buffer " *URL*" "The buffer to do all the processing in.")
278 (defvar url-current-annotation nil "URL of document we are annotating...")
279 (defvar url-current-referer nil "Referer of this page.")
280 (defvar url-current-content-length nil "Current content length.")
281 (defvar url-current-file nil "Filename of current document.")
282 (defvar url-current-isindex nil "Is the current document a searchable index?")
283 (defvar url-current-mime-encoding nil "MIME encoding of current document.")
284 (defvar url-current-mime-headers nil "An alist of MIME headers.")
285 (defvar url-current-mime-type nil "MIME type of current document.")
286 (defvar url-current-mime-viewer nil "How to view the current MIME doc.")
287 (defvar url-current-nntp-server nil "What nntp server currently opened.")
288 (defvar url-current-passwd-count 0 "How many times password has failed.")
289 (defvar url-current-port nil "Port # of the current document.")
290 (defvar url-current-server nil "Server of the current document.")
291 (defvar url-current-user nil "Username for ftp login.")
292 (defvar url-current-type nil "We currently in http or file mode?")
293 (defvar url-gopher-types "0123456789+gIThws:;<"
294 "A string containing character representations of all the gopher types.")
295 (defvar url-mime-separator-chars (mapcar 'identity
296 (concat "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
297 "abcdefghijklmnopqrstuvwxyz"
298 "0123456789'()+_,-./=?"))
299 "Characters allowable in a MIME multipart separator.")
300
301 (defvar url-bad-port-list
302 '("25" "119" "19")
303 "*List of ports to warn the user about connecting to. Defaults to just
304 the mail, chargen, and NNTP ports so you cannot be tricked into sending
305 fake mail or forging messages by a malicious HTML document.")
306
307 (defvar url-be-anal-about-file-attributes nil
308 "*Whether to use HTTP/1.0 to figure out file attributes
309 or just guess based on file extension, etc.")
310
311 (defvar url-be-asynchronous nil
312 "*Controls whether document retrievals over HTTP should be done in
313 the background. This allows you to keep working in other windows
314 while large downloads occur.")
315 (make-variable-buffer-local 'url-be-asynchronous)
316
317 (defvar url-request-data nil "Any data to send with the next request.")
318
319 (defvar url-request-extra-headers nil
320 "A list of extra headers to send with the next request. Should be
321 an assoc list of headers/contents.")
322
323 (defvar url-request-method nil "The method to use for the next request.")
324
325 (defvar url-mime-encoding-string nil
326 "String to send to the server in the Accept-encoding: field in HTTP/1.0
327 requests. This is created automatically from mm-content-transfer-encodings.")
328
329 (defvar url-mime-language-string "*/*"
330 "String to send to the server in the Accept-language: field in
331 HTTP/1.0 requests.")
332
333 (defvar url-mime-accept-string nil
334 "String to send to the server in the Accept: field in HTTP/1.0 requests.
335 This is created automatically from url-mime-viewers, after the mailcap file
336 has been parsed.")
337
338 (defvar url-history-changed-since-last-save nil
339 "Whether the history list has changed since the last save operation.")
340
341 (defvar url-proxy-basic-authentication nil
342 "Internal structure - do not modify!")
343
344 (defvar url-registered-protocols nil
345 "Internal structure - do not modify! See `url-register-protocol'")
346
347 (defvar url-package-version "Unknown" "Version # of package using URL.")
348
349 (defvar url-package-name "Unknown" "Version # of package using URL.")
350
351 (defvar url-system-type nil "What type of system we are on.")
352 (defvar url-os-type nil "What OS we are on.")
353
354 (defvar url-max-password-attempts 5
355 "*Maximum number of times a password will be prompted for when a
356 protected document is denied by the server.")
357
358 (defvar url-wais-to-mime
359 '(
360 ("WSRC" . "application/x-wais-source") ; A database description
361 ("TEXT" . "text/plain") ; plain text
362 )
363 "An assoc list of wais doctypes and their corresponding MIME
364 content-types.")
365
366 (defvar url-waisq-prog "waisq"
367 "*Name of the waisq executable on this system. This should be the
368 waisq program from think.com's wais8-b5.1 distribution.")
369
370 (defvar url-wais-gateway-server "www.ncsa.uiuc.edu"
371 "*The machine name where the WAIS gateway lives.")
372
373 (defvar url-wais-gateway-port "8001"
374 "*The port # of the WAIS gateway.")
375
376 (defvar url-temporary-directory "/tmp" "*Where temporary files go.")
377
378 (defvar url-show-status t
379 "*Whether to show a running total of bytes transferred. Can cause a
380 large hit if using a remote X display over a slow link, or a terminal
381 with a slow modem.")
382
383 (defvar url-using-proxy nil
384 "Either nil or the fully qualified proxy URL in use, e.g.
385 http://www.domain.com/")
386
387 (defvar url-news-server nil
388 "*The default news server to get newsgroups/articles from if no server
389 is specified in the URL. Defaults to the environment variable NNTPSERVER
390 or \"news\" if NNTPSERVER is undefined.")
391
392 (defvar url-gopher-to-mime
393 '((?0 . "text/plain") ; It's a file
394 (?1 . "www/gopher") ; Gopher directory
395 (?2 . "www/gopher-cso-search") ; CSO search
396 (?3 . "text/plain") ; Error
397 (?4 . "application/mac-binhex40") ; Binhexed macintosh file
398 (?5 . "application/pc-binhex40") ; DOS binary archive of some sort
399 (?6 . "archive/x-uuencode") ; Unix uuencoded file
400 (?7 . "www/gopher-search") ; Gopher search!
401 (?9 . "application/octet-stream") ; Binary file!
402 (?g . "image/gif") ; Gif file
403 (?I . "image/gif") ; Some sort of image
404 (?h . "text/html") ; HTML source
405 (?s . "audio/basic") ; Sound file
406 )
407 "*An assoc list of gopher types and their corresponding MIME types.")
408
409 (defvar url-use-hypertext-gopher t
410 "*Controls how gopher documents are retrieved.
411 If non-nil, the gopher pages will be converted into HTML and parsed
412 just like any other page. If nil, the requests will be passed off to
413 the gopher.el package by Scott Snyder. Using the gopher.el package
414 will lose the gopher+ support, and inlined searching.")
415
416 (defvar url-global-history-hash-table nil
417 "Hash table for global history completion.")
418
419 (defvar url-nonrelative-link
420 "^\\([-a-zA-Z0-9+.]+:\\)"
421 "A regular expression that will match an absolute URL.")
422
423 (defvar url-configuration-directory nil
424 "*Where the URL configuration files can be found.")
425
426 (defvar url-confirmation-func 'y-or-n-p
427 "*What function to use for asking yes or no functions. Possible
428 values are 'yes-or-no-p or 'y-or-n-p, or any function that takes a
429 single argument (the prompt), and returns t only if a positive answer
430 is gotten.")
431
432 (defvar url-connection-retries 5
433 "*# of times to try for a connection before bailing.
434 If for some reason url-open-stream cannot make a connection to a host
435 right away, it will sit for 1 second, then try again, up to this many
436 tries.")
437
438 (defvar url-find-this-link nil "Link to go to within a document.")
439
440 (defvar url-show-http2-transfer t
441 "*Whether to show the total # of bytes, size of file, and percentage
442 transferred when retrieving a document over HTTP/1.0 and it returns a
443 valid content-length header. This can mess up some people behind
444 gateways.")
445
446 (defvar url-gateway-method 'native
447 "*The type of gateway support to use.
448 Should be a symbol specifying how we are to get a connection off of the
449 local machine.
450
451 Currently supported methods:
452 'program :: Run a program in a subprocess to connect
453 (examples are itelnet, an expect script, etc)
454 'native :: Use the native open-network-stream in emacs
455 'tcp :: Use the excellent tcp.el package from gnus.
456 This simply does a (require 'tcp), then sets
457 url-gateway-method to be 'native.")
458
459 (defvar url-gateway-shell-is-telnet nil
460 "*Whether the login shell of the remote host is telnet.")
461
462 (defvar url-gateway-program-interactive nil
463 "*Whether url needs to hand-hold the login program on the remote machine.")
464
465 (defvar url-gateway-handholding-login-regexp "ogin:"
466 "*Regexp for when to send the username to the remote process.")
467
468 (defvar url-gateway-handholding-password-regexp "ord:"
469 "*Regexp for when to send the password to the remote process.")
470
471 (defvar url-gateway-host-prompt-pattern "^[^#$%>;]*[#$%>;] *"
472 "*Regexp used to detect when the login is finished on the remote host.")
473
474 (defvar url-gateway-telnet-ready-regexp "Escape character is .*"
475 "*A regular expression that signifies url-gateway-telnet-program is
476 ready to accept input.")
477
478 (defvar url-local-rlogin-prog "rlogin"
479 "*Program for local telnet connections.")
480
481 (defvar url-remote-rlogin-prog "rlogin"
482 "*Program for remote telnet connections.")
483
484 (defvar url-local-telnet-prog "telnet"
485 "*Program for local telnet connections.")
486
487 (defvar url-remote-telnet-prog "telnet"
488 "*Program for remote telnet connections.")
489
490 (defvar url-gateway-telnet-program "itelnet"
491 "*Program to run in a subprocess when using gateway-method 'program.")
492
493 (defvar url-gateway-local-host-regexp nil
494 "*If a host being connected to matches this regexp then the
495 connection is done natively, otherwise the process is started on
496 `url-gateway-host' instead.")
497
498 (defvar url-use-hypertext-dired t
499 "*How to format directory listings.
500
501 If value is non-nil, use directory-files to list them out and
502 transform them into a hypertext document, then pass it through the
503 parse like any other document.
504
505 If value nil, just pass the directory off to dired using find-file.")
506
507 (defconst monthabbrev-alist
508 '(("Jan" . 1) ("Feb" . 2) ("Mar" . 3) ("Apr" . 4) ("May" . 5) ("Jun" . 6)
509 ("Jul" . 7) ("Aug" . 8) ("Sep" . 9) ("Oct" . 10) ("Nov" . 11) ("Dec" . 12)))
510
511 (defvar url-default-ports '(("http" . "80")
512 ("gopher" . "70")
513 ("telnet" . "23")
514 ("news" . "119")
515 ("https" . "443")
516 ("shttp" . "80"))
517 "An assoc list of protocols and default port #s")
518
519 (defvar url-setup-done nil "*Has setup configuration been done?")
520
521 (defvar url-source nil
522 "*Whether to force a sourcing of the next buffer. This forces local
523 files to be read into a buffer, no matter what. Gets around the
524 optimization that if you are passing it to a viewer, just make a
525 symbolic link, which looses if you want the source for inlined
526 images/etc.")
527
528 (defconst weekday-alist
529 '(("Sunday" . 0) ("Monday" . 1) ("Tuesday" . 2) ("Wednesday" . 3)
530 ("Thursday" . 4) ("Friday" . 5) ("Saturday" . 6)
531 ("Tues" . 2) ("Thurs" . 4)
532 ("Sun" . 0) ("Mon" . 1) ("Tue" . 2) ("Wed" . 3)
533 ("Thu" . 4) ("Fri" . 5) ("Sat" . 6)))
534
535 (defconst monthabbrev-alist
536 '(("Jan" . 1) ("Feb" . 2) ("Mar" . 3) ("Apr" . 4) ("May" . 5) ("Jun" . 6)
537 ("Jul" . 7) ("Aug" . 8) ("Sep" . 9) ("Oct" . 10) ("Nov" . 11) ("Dec" . 12))
538 )
539
540 (defvar url-lazy-message-time 0)
541
542 (defvar url-extensions-header "Security/Digest Security/SSL")
543
544 (defvar url-mailserver-syntax-table
545 (copy-syntax-table emacs-lisp-mode-syntax-table)
546 "*A syntax table for parsing the mailserver URL")
547
548 (modify-syntax-entry ?' "\"" url-mailserver-syntax-table)
549 (modify-syntax-entry ?` "\"" url-mailserver-syntax-table)
550 (modify-syntax-entry ?< "(>" url-mailserver-syntax-table)
551 (modify-syntax-entry ?> ")<" url-mailserver-syntax-table)
552 (modify-syntax-entry ?/ " " url-mailserver-syntax-table)
553
554 ;;; Make OS/2 happy - yeeks
555 (defvar tcp-binary-process-input-services nil
556 "*Make OS/2 happy with our CRLF pairs...")
557
558 (provide 'url-vars)