54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1 ;;; url-vars.el --- Variables for Uniform Resource Locator tool
|
57614
|
2
|
110307
|
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2006, 2007,
|
|
4 ;; 2008, 2009, 2010 Free Software Foundation, Inc.
|
57614
|
5
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
6 ;; Keywords: comm, data, processes, hypermedia
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
7
|
57614
|
8 ;; This file is part of GNU Emacs.
|
|
9
|
94668
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
|
57614
|
11 ;; it under the terms of the GNU General Public License as published by
|
94668
|
12 ;; the Free Software Foundation, either version 3 of the License, or
|
|
13 ;; (at your option) any later version.
|
57614
|
14
|
|
15 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 ;; GNU General Public License for more details.
|
|
19
|
|
20 ;; You should have received a copy of the GNU General Public License
|
94668
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
57614
|
22
|
|
23 ;;; Code:
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 (require 'mm-util)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26
|
54770
|
27 (defconst url-version "Emacs"
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 "Version number of URL package.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
29
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 (defgroup url nil
|
63993
ef9f3b48923d
(url, url-file, url-cache, url-mime, url-hairy): Finish `defgroup' description
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
31 "Uniform Resource Locator tool."
|
59996
|
32 :version "22.1"
|
107379
3c0cd76e49ff
Fix last change to use existing comm Custom group instead of `net'.
Chong Yidong <cyd@stupidchicken.com>
diff
changeset
|
33 :group 'comm)
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 (defgroup url-file nil
|
63993
ef9f3b48923d
(url, url-file, url-cache, url-mime, url-hairy): Finish `defgroup' description
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
36 "URL storage."
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 :prefix "url-"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
38 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
39
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
40 (defgroup url-cache nil
|
63993
ef9f3b48923d
(url, url-file, url-cache, url-mime, url-hairy): Finish `defgroup' description
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
41 "URL cache."
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 :prefix "url-"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 :prefix "url-cache-"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
44 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
45
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
46 (defgroup url-mime nil
|
63993
ef9f3b48923d
(url, url-file, url-cache, url-mime, url-hairy): Finish `defgroup' description
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
47 "MIME options of URL."
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 :prefix "url-"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 (defgroup url-hairy nil
|
63993
ef9f3b48923d
(url, url-file, url-cache, url-mime, url-hairy): Finish `defgroup' description
Juanma Barranquero <lekktu@gmail.com>
diff
changeset
|
52 "Hairy options of URL."
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 :prefix "url-"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
56
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 (defvar url-current-object nil
|
96486
|
58 "A parsed representation of the current URL.")
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
59
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
60 (defvar url-current-mime-headers nil
|
96486
|
61 "A parsed representation of the MIME headers for the current URL.")
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62
|
84930
|
63 (mapc 'make-variable-buffer-local
|
|
64 '(
|
|
65 url-current-object
|
|
66 url-current-referer
|
|
67 url-current-mime-headers
|
|
68 ))
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
69
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
70 (defcustom url-honor-refresh-requests t
|
110307
|
71 "Whether to do automatic page reloads.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
72 These are done at the request of the document author or the server via
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
73 the `Refresh' header in an HTTP response. If nil, no refresh
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
74 requests will be honored. If t, all refresh requests will be honored.
|
96486
|
75 If non-nil and not t, the user will be asked for each refresh request."
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
76 :type '(choice (const :tag "off" nil)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
77 (const :tag "on" t)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
78 (const :tag "ask" 'ask))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
79 :group 'url-hairy)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
80
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
81 (defcustom url-automatic-caching nil
|
110307
|
82 "If non-nil, all documents will be automatically cached to the local disk."
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
83 :type 'boolean
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
84 :group 'url-cache)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
85
|
54804
|
86 (defconst url-bug-address "bug-gnu-emacs@gnu.org"
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
87 "Where to send bug reports.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
88
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
89 (defcustom url-personal-mail-address nil
|
110307
|
90 "Your full email address.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 This is what is sent to HTTP servers as the FROM field in an HTTP
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
92 request."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
93 :type '(choice (const :tag "Unspecified" nil) string)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
94 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
95
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
96 (defcustom url-directory-index-file "index.html"
|
110307
|
97 "The filename to look for when indexing a directory.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
98 If this file exists, and is readable, then it will be viewed instead of
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
99 using `dired' to view the directory."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
100 :type 'string
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
101 :group 'url-file)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
102
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 (defcustom url-privacy-level '(email)
|
68121
|
104 "How private you want your requests to be.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
105 HTTP has header fields for various information about the user, including
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
106 operating system information, email addresses, the last page you visited, etc.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
107 This variable controls how much of this information is sent.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
108
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
109 This should a symbol or a list.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110 Valid values if a symbol are:
|
96486
|
111 none -- send all information
|
|
112 low -- don't send the last location
|
|
113 high -- don't send the email address or last location
|
|
114 paranoid -- don't send anything
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
116 If a list, this should be a list of symbols of what NOT to send.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 Valid symbols are:
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
118 email -- the email address
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
119 os -- the operating system info
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 lastloc -- the last location
|
96486
|
121 agent -- do not send the User-Agent string
|
108999
|
122 cookies -- never accept HTTP cookies
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124 Samples:
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
126 (setq url-privacy-level 'high)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
127 (setq url-privacy-level '(email lastloc)) ;; equivalent to 'high
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
128 (setq url-privacy-level '(os))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
129
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
130 ::NOTE::
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 This variable controls several other variables and is _NOT_ automatically
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
132 updated. Call the function `url-setup-privacy-info' after modifying this
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
133 variable."
|
68121
|
134 :initialize 'custom-initialize-default
|
|
135 :set (lambda (sym val) (set-default sym val) (url-setup-privacy-info))
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
136 :type '(radio (const :tag "None (you believe in the basic goodness of humanity)"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
137 :value none)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
138 (const :tag "Low (do not reveal last location)"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
139 :value low)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
140 (const :tag "High (no email address or last location)"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
141 :value high)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 (const :tag "Paranoid (reveal nothing!)"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
143 :value paranoid)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
144 (checklist :tag "Custom"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
145 (const :tag "Email address" :value email)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
146 (const :tag "Operating system" :value os)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 (const :tag "Last location" :value lastloc)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
148 (const :tag "Browser identification" :value agent)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
149 (const :tag "No cookies" :value cookie)))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
150 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
151
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
152 (defvar url-inhibit-uncompression nil "Do not do decompression if non-nil.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
153
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
154 (defcustom url-uncompressor-alist '((".z" . "x-gzip")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
155 (".gz" . "x-gzip")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
156 (".uue" . "x-uuencoded")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
157 (".hqx" . "x-hqx")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
158 (".Z" . "x-compress")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
159 (".bz2" . "x-bzip2"))
|
110307
|
160 "An alist of file extensions and appropriate content-transfer-encodings."
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
161 :type '(repeat (cons :format "%v"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
162 (string :tag "Extension")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
163 (string :tag "Encoding")))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
164 :group 'url-mime)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
165
|
65559
|
166 (defcustom url-mail-command 'compose-mail
|
110307
|
167 "This function will be called whenever URL needs to send mail.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
168 It should enter a mail-mode-like buffer in the current window.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
169 The commands `mail-to' and `mail-subject' should still work in this
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
170 buffer, and it should use `mail-header-separator' if possible."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
171 :type 'function
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
172 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
173
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
174 (defcustom url-proxy-services nil
|
110307
|
175 "An alist of schemes and proxy servers that gateway them.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
176 Looks like ((\"http\" . \"hostname:portnumber\") ...). This is set up
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
177 from the ACCESS_proxy environment variables."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
178 :type '(repeat (cons :format "%v"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
179 (string :tag "Protocol")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
180 (string :tag "Proxy")))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
181 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
182
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
183 (defcustom url-standalone-mode nil
|
110307
|
184 "Rely solely on the cache?"
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
185 :type 'boolean
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
186 :group 'url-cache)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
187
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
188 (defvar url-mime-separator-chars (mapcar 'identity
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
189 (concat "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
190 "abcdefghijklmnopqrstuvwxyz"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
191 "0123456789'()+_,-./=?"))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
192 "Characters allowable in a MIME multipart separator.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
193
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
194 (defcustom url-bad-port-list
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
195 '("25" "119" "19")
|
110307
|
196 "List of ports to warn the user about connecting to.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
197 Defaults to just the mail, chargen, and NNTP ports so you cannot be
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
198 tricked into sending fake mail or forging messages by a malicious HTML
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
199 document."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
200 :type '(repeat (string :tag "Port"))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
201 :group 'url-hairy)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
202
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
203 (defvar url-mime-content-type-charset-regexp
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
204 ";[ \t]*charset=\"?\\([^\"]+\\)\"?"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
205 "Regexp used in parsing `Content-Type' for a charset indication.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
206
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
207 (defvar url-request-data nil "Any data to send with the next request.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
208
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
209 (defvar url-request-extra-headers nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
210 "A list of extra headers to send with the next request.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
211 Should be an assoc list of headers/contents.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
212
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
213 (defvar url-request-method nil "The method to use for the next request.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
214
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
215 ;; FIXME!! (RFC 2616 gives examples like `compress, gzip'.)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
216 (defvar url-mime-encoding-string nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
217 "*String to send in the Accept-encoding: field in HTTP requests.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
218
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
219 ;; Perhaps the first few should actually be given decreasing `q's and
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
220 ;; the list should be trimmed significantly.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
221 ;; Fixme: do something sane if we don't have `sort-coding-systems'
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
222 ;; (Emacs 20, XEmacs).
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
223 (defun url-mime-charset-string ()
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
224 "Generate a list of preferred MIME charsets for HTTP requests.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
225 Generated according to current coding system priorities."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
226 (if (fboundp 'sort-coding-systems)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
227 (let ((ordered (sort-coding-systems
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
228 (let (accum)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
229 (dolist (elt mm-mime-mule-charset-alist)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
230 (if (mm-coding-system-p (car elt))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
231 (push (car elt) accum)))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
232 (nreverse accum)))))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
233 (concat (format "%s;q=1, " (pop ordered))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
234 (mapconcat 'symbol-name ordered ";q=0.5, ")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
235 ";q=0.5"))))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
236
|
110727
c6fdea2b097e
url-vars.el (url-mime-charset-string): Changed the default to nil to
Lars Magne Ingebrigtsen <larsi@gnus.org>
diff
changeset
|
237 (defvar url-mime-charset-string nil
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
238 "*String to send in the Accept-charset: field in HTTP requests.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
239 The MIME charset corresponding to the most preferred coding system is
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
240 given priority 1 and the rest are given priority 0.5.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
241
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
242 (defun url-set-mime-charset-string ()
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
243 (setq url-mime-charset-string (url-mime-charset-string)))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
244 ;; Regenerate if the language environment changes.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
245 (add-hook 'set-language-environment-hook 'url-set-mime-charset-string)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
246
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
247 ;; Fixme: set from the locale.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
248 (defcustom url-mime-language-string nil
|
110307
|
249 "String to send in the Accept-language: field in HTTP requests.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
250
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
251 Specifies the preferred language when servers can serve documents in
|
96486
|
252 several languages. Use RFC 1766 abbreviations, e.g.: `en' for
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
253 English, `de' for German. A comma-separated specifies descending
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
254 order of preference. The ordering can be made explicit using `q'
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
255 factors defined by HTTP, e.g. `de,en-gb;q=0.8,en;q=0.7'. `*' means
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
256 get the first available language (as opposed to the default)."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
257 :type '(radio
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
258 (const :tag "None (get default language version)" :value nil)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
259 (const :tag "Any (get first available language version)" :value "*")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
260 (string :tag "Other"))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
261 :group 'url-mime
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
262 :group 'i18n)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
263
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
264 (defvar url-mime-accept-string nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
265 "String to send to the server in the Accept: field in HTTP requests.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
266
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
267 (defvar url-package-version nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
268 "Version number of package using URL.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
269
|
68121
|
270 (defvar url-package-name nil "Name of package using URL.")
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
271
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
272 (defvar url-system-type nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
273 "What type of system we are on.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
274 (defvar url-os-type nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
275 "What OS we are on.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
276
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
277 (defcustom url-max-password-attempts 5
|
110307
|
278 "Maximum number of times a password will be prompted for.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
279 Applies when a protected document is denied by the server."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
280 :type 'integer
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
281 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
282
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
283 (defcustom url-temporary-directory (or (getenv "TMPDIR") "/tmp")
|
110307
|
284 "Where temporary files go."
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
285 :type 'directory
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
286 :group 'url-file)
|
101886
|
287 (make-obsolete-variable 'url-temporary-directory
|
|
288 'temporary-file-directory "23.1")
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
289
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
290 (defcustom url-show-status t
|
110307
|
291 "Whether to show a running total of bytes transferred.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
292 Can cause a large hit if using a remote X display over a slow link, or
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
293 a terminal with a slow modem."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
294 :type 'boolean
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
295 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
296
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
297 (defvar url-using-proxy nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
298 "Either nil or the fully qualified proxy URL in use, e.g.
|
96486
|
299 http://www.example.com/")
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
300
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
301 (defcustom url-news-server nil
|
110307
|
302 "The default news server from which to get newsgroups/articles.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
303 Applies if no server is specified in the URL. Defaults to the
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
304 environment variable NNTPSERVER or \"news\" if NNTPSERVER is
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
305 undefined."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
306 :type '(choice (const :tag "None" :value nil) string)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
307 :group 'url)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
308
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
309 (defvar url-nonrelative-link
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
310 "\\`\\([-a-zA-Z0-9+.]+:\\)"
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
311 "A regular expression that will match an absolute URL.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
312
|
77178
|
313 (defcustom url-max-redirections 30
|
110307
|
314 "The maximum number of redirection requests to honor in a HTTP connection.
|
77178
|
315 A negative number means to honor an unlimited number of redirection requests."
|
|
316 :type 'integer
|
|
317 :group 'url)
|
|
318
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
319 (defcustom url-confirmation-func 'y-or-n-p
|
110307
|
320 "What function to use for asking yes or no functions.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
321 Possible values are `yes-or-no-p' or `y-or-n-p', or any function that
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
322 takes a single argument (the prompt), and returns t only if a positive
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
323 answer is given."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
324 :type '(choice (const :tag "Short (y or n)" :value y-or-n-p)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
325 (const :tag "Long (yes or no)" :value yes-or-no-p)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
326 (function :tag "Other"))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
327 :group 'url-hairy)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
328
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
329 (defcustom url-gateway-method 'native
|
110307
|
330 "The type of gateway support to use.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
331 Should be a symbol specifying how to get a connection from the local machine.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
332
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
333 Currently supported methods:
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
334 `telnet': Run telnet in a subprocess to connect;
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
335 `rlogin': Rlogin to another machine to connect;
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
336 `socks': Connect through a socks server;
|
57449
|
337 `tls': Connect with TLS;
|
|
338 `ssl': Connect with SSL (deprecated, use `tls' instead);
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
339 `native': Connect directy."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
340 :type '(radio (const :tag "Telnet to gateway host" :value telnet)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
341 (const :tag "Rlogin to gateway host" :value rlogin)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
342 (const :tag "Use SOCKS proxy" :value socks)
|
57449
|
343 (const :tag "Use SSL/TLS for all connections" :value tls)
|
|
344 (const :tag "Use SSL for all connections (obsolete)" :value ssl)
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
345 (const :tag "Direct connection" :value native))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
346 :group 'url-hairy)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
347
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
348 (defvar url-setup-done nil "Has setup configuration been done?")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
349
|
57514
|
350 (defconst url-weekday-alist
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
351 '(("Sunday" . 0) ("Monday" . 1) ("Tuesday" . 2) ("Wednesday" . 3)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
352 ("Thursday" . 4) ("Friday" . 5) ("Saturday" . 6)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
353 ("Tues" . 2) ("Thurs" . 4)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
354 ("Sun" . 0) ("Mon" . 1) ("Tue" . 2) ("Wed" . 3)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
355 ("Thu" . 4) ("Fri" . 5) ("Sat" . 6)))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
356
|
57514
|
357 (defconst url-monthabbrev-alist
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
358 '(("Jan" . 1) ("Feb" . 2) ("Mar" . 3) ("Apr" . 4) ("May" . 5) ("Jun" . 6)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
359 ("Jul" . 7) ("Aug" . 8) ("Sep" . 9) ("Oct" . 10) ("Nov" . 11)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
360 ("Dec" . 12)))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
361
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
362 (defvar url-lazy-message-time 0)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
363
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
364 ;; Fixme: We may not be able to run SSL.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
365 (defvar url-extensions-header "Security/Digest Security/SSL")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
366
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
367 (defvar url-parse-syntax-table
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
368 (copy-syntax-table emacs-lisp-mode-syntax-table)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
369 "*A syntax table for parsing URLs.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
370
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
371 (modify-syntax-entry ?' "\"" url-parse-syntax-table)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
372 (modify-syntax-entry ?` "\"" url-parse-syntax-table)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
373 (modify-syntax-entry ?< "(>" url-parse-syntax-table)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
374 (modify-syntax-entry ?> ")<" url-parse-syntax-table)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
375 (modify-syntax-entry ?/ " " url-parse-syntax-table)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
376
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
377 (defvar url-load-hook nil
|
94429
|
378 "*Hooks to be run after initializing the URL library.")
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
379
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
380 ;;; Make OS/2 happy - yeeks
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
381 ;; (defvar tcp-binary-process-input-services nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
382 ;; "*Make OS/2 happy with our CRLF pairs...")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
383
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
384 (defconst url-working-buffer " *url-work")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
385
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
386 (defvar url-gateway-unplugged nil
|
63619
|
387 "Non-nil means don't open new network connections.
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
388 This should be set, e.g. by mail user agents rendering HTML to avoid
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
389 `bugs' which call home.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
390
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
391 (provide 'url-vars)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
392
|
93975
|
393 ;; arch-tag: 29205e5f-c5ce-433c-8d5d-38cbaed64b49
|
54695
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
394 ;;; url-vars.el ends here
|