comparison lisp/w3/url-vars.el @ 14:9ee227acff29 r19-15b90

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