Silence some url compilation warnings on systems without zlib
[bpt/emacs.git] / lisp / url / url-vars.el
index 65622a0..a34111c 100644 (file)
@@ -1,7 +1,7 @@
 ;;; url-vars.el --- Variables for Uniform Resource Locator tool
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2001, 2004-2013 Free Software Foundation,
+;; Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -22,8 +22,6 @@
 
 ;;; Code:
 
-(require 'mm-util)
-
 (defconst url-version "Emacs"
   "Version number of URL package.")
 
 (mapc 'make-variable-buffer-local
       '(
        url-current-object
-       url-current-referer
        url-current-mime-headers
        ))
 
 (defcustom url-honor-refresh-requests t
-  "*Whether to do automatic page reloads.
+  "Whether to do automatic page reloads.
 These are done at the request of the document author or the server via
 the `Refresh' header in an HTTP response.  If nil, no refresh
 requests will be honored.  If t, all refresh requests will be honored.
@@ -79,31 +76,22 @@ If non-nil and not t, the user will be asked for each refresh request."
   :group 'url-hairy)
 
 (defcustom url-automatic-caching nil
-  "*If non-nil, all documents will be automatically cached to the local disk."
+  "If non-nil, all documents will be automatically cached to the local disk."
   :type 'boolean
   :group 'url-cache)
 
-;; Fixme: sanitize this.
-(defcustom url-cache-expired
-  (lambda (t1 t2) (>= (- (car t2) (car t1)) 5))
-  "*A function determining if a cached item has expired.
-It takes two times (numbers) as its arguments, and returns non-nil if
-the second time is 'too old' when compared to the first time."
-  :type 'function
-  :group 'url-cache)
-
 (defconst url-bug-address "bug-gnu-emacs@gnu.org"
   "Where to send bug reports.")
 
 (defcustom url-personal-mail-address nil
-  "*Your full email address.
+  "Your full email address.
 This is what is sent to HTTP servers as the FROM field in an HTTP
 request."
   :type '(choice (const :tag "Unspecified" nil) string)
   :group 'url)
 
 (defcustom url-directory-index-file "index.html"
-  "*The filename to look for when indexing a directory.
+  "The filename to look for when indexing a directory.
 If this file exists, and is readable, then it will be viewed instead of
 using `dired' to view the directory."
   :type 'string
@@ -165,15 +153,16 @@ variable."
                                    (".uue" . "x-uuencoded")
                                    (".hqx" . "x-hqx")
                                    (".Z"  . "x-compress")
-                                   (".bz2"  . "x-bzip2"))
-  "*An alist of file extensions and appropriate content-transfer-encodings."
+                                   (".bz2" . "x-bzip2")
+                                   (".xz" . "x-xz"))
+  "An alist of file extensions and appropriate content-transfer-encodings."
   :type '(repeat (cons :format "%v"
                       (string :tag "Extension")
                       (string :tag "Encoding")))
   :group 'url-mime)
 
 (defcustom url-mail-command 'compose-mail
-  "*This function will be called whenever URL needs to send mail.
+  "This function will be called whenever URL needs to send mail.
 It should enter a mail-mode-like buffer in the current window.
 The commands `mail-to' and `mail-subject' should still work in this
 buffer, and it should use `mail-header-separator' if possible."
@@ -181,7 +170,7 @@ buffer, and it should use `mail-header-separator' if possible."
   :group 'url)
 
 (defcustom url-proxy-services nil
-  "*An alist of schemes and proxy servers that gateway them.
+  "An alist of schemes and proxy servers that gateway them.
 Looks like ((\"http\" . \"hostname:portnumber\") ...).  This is set up
 from the ACCESS_proxy environment variables."
   :type '(repeat (cons :format "%v"
@@ -190,7 +179,7 @@ from the ACCESS_proxy environment variables."
   :group 'url)
 
 (defcustom url-standalone-mode nil
-  "*Rely solely on the cache?"
+  "Rely solely on the cache?"
   :type 'boolean
   :group 'url-cache)
 
@@ -202,7 +191,7 @@ from the ACCESS_proxy environment variables."
 
 (defcustom url-bad-port-list
   '("25" "119" "19")
-  "*List of ports to warn the user about connecting to.
+  "List of ports to warn the user about connecting to.
 Defaults to just the mail, chargen, and NNTP ports so you cannot be
 tricked into sending fake mail or forging messages by a malicious HTML
 document."
@@ -221,9 +210,13 @@ Should be an assoc list of headers/contents.")
 
 (defvar url-request-method nil "The method to use for the next request.")
 
-;; FIXME!!  (RFC 2616 gives examples like `compress, gzip'.)
-(defvar url-mime-encoding-string nil
-  "*String to send in the Accept-encoding: field in HTTP requests.")
+(defvar url-mime-encoding-string (and (fboundp 'zlib-available-p)
+                                     (zlib-available-p)
+                                     "gzip")
+  "String to send in the Accept-encoding: field in HTTP requests.")
+
+(defvar mm-mime-mule-charset-alist)
+(declare-function mm-coding-system-p "mm-util" (cs))
 
 ;; Perhaps the first few should actually be given decreasing `q's and
 ;; the list should be trimmed significantly.
@@ -232,6 +225,7 @@ Should be an assoc list of headers/contents.")
 (defun url-mime-charset-string ()
   "Generate a list of preferred MIME charsets for HTTP requests.
 Generated according to current coding system priorities."
+  (require 'mm-util)
   (if (fboundp 'sort-coding-systems)
       (let ((ordered (sort-coding-systems
                      (let (accum)
@@ -243,8 +237,8 @@ Generated according to current coding system priorities."
                (mapconcat 'symbol-name ordered ";q=0.5, ")
                ";q=0.5"))))
 
-(defvar url-mime-charset-string (url-mime-charset-string)
-  "*String to send in the Accept-charset: field in HTTP requests.
+(defvar url-mime-charset-string nil
+  "String to send in the Accept-charset: field in HTTP requests.
 The MIME charset corresponding to the most preferred coding system is
 given priority 1 and the rest are given priority 0.5.")
 
@@ -255,7 +249,7 @@ given priority 1 and the rest are given priority 0.5.")
 
 ;; Fixme: set from the locale.
 (defcustom url-mime-language-string nil
-  "*String to send in the Accept-language: field in HTTP requests.
+  "String to send in the Accept-language: field in HTTP requests.
 
 Specifies the preferred language when servers can serve documents in
 several languages.  Use RFC 1766 abbreviations, e.g.: `en' for
@@ -284,20 +278,20 @@ get the first available language (as opposed to the default)."
   "What OS we are on.")
 
 (defcustom url-max-password-attempts 5
-  "*Maximum number of times a password will be prompted for.
+  "Maximum number of times a password will be prompted for.
 Applies when a protected document is denied by the server."
   :type 'integer
   :group 'url)
 
 (defcustom url-temporary-directory (or (getenv "TMPDIR") "/tmp")
-  "*Where temporary files go."
+  "Where temporary files go."
   :type 'directory
   :group 'url-file)
 (make-obsolete-variable 'url-temporary-directory
                        'temporary-file-directory "23.1")
 
 (defcustom url-show-status t
-  "*Whether to show a running total of bytes transferred.
+  "Whether to show a running total of bytes transferred.
 Can cause a large hit if using a remote X display over a slow link, or
 a terminal with a slow modem."
   :type 'boolean
@@ -308,25 +302,29 @@ a terminal with a slow modem."
 http://www.example.com/")
 
 (defcustom url-news-server nil
-  "*The default news server from which to get newsgroups/articles.
+  "The default news server from which to get newsgroups/articles.
 Applies if no server is specified in the URL.  Defaults to the
 environment variable NNTPSERVER or \"news\" if NNTPSERVER is
 undefined."
   :type '(choice (const :tag "None" :value nil) string)
   :group 'url)
 
+;; From RFC3986: Scheme names consist of a sequence of characters
+;; beginning with a letter and followed by any combination of letters,
+;; digits, plus ("+"), period ("."), or hyphen ("-").
+
 (defvar url-nonrelative-link
-  "\\`\\([-a-zA-Z0-9+.]+:\\)"
+  "\\`\\([a-zA-Z][-a-zA-Z0-9+.]*:\\)"
   "A regular expression that will match an absolute URL.")
 
 (defcustom url-max-redirections 30
-  "*The maximum number of redirection requests to honor in a HTTP connection.
+  "The maximum number of redirection requests to honor in a HTTP connection.
 A negative number means to honor an unlimited number of redirection requests."
   :type 'integer
   :group 'url)
 
 (defcustom url-confirmation-func 'y-or-n-p
-  "*What function to use for asking yes or no functions.
+  "What function to use for asking yes or no functions.
 Possible values are `yes-or-no-p' or `y-or-n-p', or any function that
 takes a single argument (the prompt), and returns t only if a positive
 answer is given."
@@ -336,7 +334,7 @@ answer is given."
   :group 'url-hairy)
 
 (defcustom url-gateway-method 'native
-  "*The type of gateway support to use.
+  "The type of gateway support to use.
 Should be a symbol specifying how to get a connection from the local machine.
 
 Currently supported methods:
@@ -345,7 +343,7 @@ Currently supported methods:
 `socks': Connect through a socks server;
 `tls': Connect with TLS;
 `ssl': Connect with SSL (deprecated, use `tls' instead);
-`native': Connect directy."
+`native': Connect directly."
   :type '(radio (const :tag "Telnet to gateway host" :value telnet)
                (const :tag "Rlogin to gateway host" :value rlogin)
                (const :tag "Use SOCKS proxy" :value socks)
@@ -375,7 +373,7 @@ Currently supported methods:
 
 (defvar url-parse-syntax-table
   (copy-syntax-table emacs-lisp-mode-syntax-table)
-  "*A syntax table for parsing URLs.")
+  "A syntax table for parsing URLs.")
 
 (modify-syntax-entry ?' "\"" url-parse-syntax-table)
 (modify-syntax-entry ?` "\"" url-parse-syntax-table)
@@ -383,8 +381,10 @@ Currently supported methods:
 (modify-syntax-entry ?> ")<" url-parse-syntax-table)
 (modify-syntax-entry ?/ " " url-parse-syntax-table)
 
-(defvar url-load-hook nil
-  "*Hooks to be run after initializing the URL library.")
+(defcustom url-load-hook nil
+  "Hook run after initializing the URL library."
+  :group 'url
+  :type 'hook)
 
 ;;; Make OS/2 happy - yeeks
 ;; (defvar     tcp-binary-process-input-services nil
@@ -399,5 +399,4 @@ This should be set, e.g. by mail user agents rendering HTML to avoid
 
 (provide 'url-vars)
 
-;; arch-tag: 29205e5f-c5ce-433c-8d5d-38cbaed64b49
 ;;; url-vars.el ends here