aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-12-26 15:31:32 +0200
committerEli Zaretskii2015-12-26 15:31:32 +0200
commitbda3c4600b6866245308dd6008ffc3621e68e541 (patch)
treeffbfd063bafe609ebf21fbf068ed70a820c73c53
parent3a9664d092fa4f1cdd82307c05f51f9f2a4e9d7d (diff)
downloademacs-bda3c4600b6866245308dd6008ffc3621e68e541.tar.gz
emacs-bda3c4600b6866245308dd6008ffc3621e68e541.zip
Document 'url-user-agent'.
* lisp/url/url-http.el (url-user-agent): Move from here... * lisp/url/url-vars.el (url-user-agent): ...to here. This is to keep all the URL defcustoms in one place, and also have it defined whenever the URL library is loaded. * doc/misc/url.texi (Customization): Document 'url-user-agent'.
-rw-r--r--doc/misc/url.texi8
-rw-r--r--etc/NEWS1
-rw-r--r--lisp/url/url-http.el11
-rw-r--r--lisp/url/url-vars.el12
4 files changed, 21 insertions, 11 deletions
diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index cd2d7a12bec..121c28eb8f8 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -1330,6 +1330,14 @@ Connect directly.
1330@end table 1330@end table
1331@end defopt 1331@end defopt
1332 1332
1333@defopt url-user-agent
1334The User Agent string used for sending HTTP/HTTPS requests. The value
1335should be a string or a function of no arguments that returns a
1336string. The default value is @w{@samp{User-Agent: @var{package-name}
1337URL/Emacs}}, where @var{package-name} is the value of
1338@code{url-package-name} and its version, if they are non-@code{nil}.
1339@end defopt
1340
1333@node GNU Free Documentation License 1341@node GNU Free Documentation License
1334@appendix GNU Free Documentation License 1342@appendix GNU Free Documentation License
1335@include doclicense.texi 1343@include doclicense.texi
diff --git a/etc/NEWS b/etc/NEWS
index 4bc66bd6305..547b3cc8aff 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -763,6 +763,7 @@ See the doc string of `sh-indent-after-continuation' for details.
763When `url-handler-mode' is enabled, file operations for these 763When `url-handler-mode' is enabled, file operations for these
764protocols as well as for "telnet" and "ftp" are passed to Tramp. 764protocols as well as for "telnet" and "ftp" are passed to Tramp.
765 765
766+++
766*** The URL package allows customizing the `url-user-agent' string. 767*** The URL package allows customizing the `url-user-agent' string.
767The new `url-user-agent' variable can be customized to be a string or 768The new `url-user-agent' variable can be customized to be a string or
768a function. 769a function.
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index a47d57d3c77..b65affee7d4 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -135,17 +135,6 @@ request.")
135 (507 insufficient-storage "Insufficient storage")) 135 (507 insufficient-storage "Insufficient storage"))
136 "The HTTP return codes and their text.") 136 "The HTTP return codes and their text.")
137 137
138(defcustom url-user-agent (format "User-Agent: %sURL/%s\r\n"
139 (if url-package-name
140 (concat url-package-name "/"
141 url-package-version " ")
142 "") url-version)
143 "User Agent used by the URL package."
144 :type '(choice (string :tag "A static User-Agent string")
145 (function :tag "Call a function to get the User-Agent string"))
146 :version "25.1"
147 :group 'url)
148
149;(eval-when-compile 138;(eval-when-compile
150;; These are all macros so that they are hidden from external sight 139;; These are all macros so that they are hidden from external sight
151;; when the file is byte-compiled. 140;; when the file is byte-compiled.
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el
index 46c2ec3c69f..fa6f182e831 100644
--- a/lisp/url/url-vars.el
+++ b/lisp/url/url-vars.el
@@ -357,6 +357,18 @@ Currently supported methods:
357 (const :tag "Direct connection" :value native)) 357 (const :tag "Direct connection" :value native))
358 :group 'url-hairy) 358 :group 'url-hairy)
359 359
360(defcustom url-user-agent (format "User-Agent: %sURL/%s\r\n"
361 (if url-package-name
362 (concat url-package-name "/"
363 url-package-version " ")
364 "") url-version)
365 "User Agent used by the URL package for HTTP/HTTPS requests
366Should be a string or a function of no arguments returning a string."
367 :type '(choice (string :tag "A static User-Agent string")
368 (function :tag "Call a function to get the User-Agent string"))
369 :version "25.1"
370 :group 'url)
371
360(defvar url-setup-done nil "Has setup configuration been done?") 372(defvar url-setup-done nil "Has setup configuration been done?")
361 373
362(defconst url-weekday-alist 374(defconst url-weekday-alist