From: Eli Zaretskii Date: Sat, 26 Dec 2015 13:31:32 +0000 (+0200) Subject: Document 'url-user-agent'. X-Git-Tag: emacs-25.0.90~375 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bda3c4600b6866245308dd6008ffc3621e68e541;p=emacs.git 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'. --- 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. @end table @end defopt +@defopt url-user-agent +The User Agent string used for sending HTTP/HTTPS requests. The value +should be a string or a function of no arguments that returns a +string. The default value is @w{@samp{User-Agent: @var{package-name} +URL/Emacs}}, where @var{package-name} is the value of +@code{url-package-name} and its version, if they are non-@code{nil}. +@end defopt + @node GNU Free Documentation License @appendix GNU Free Documentation License @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. When `url-handler-mode' is enabled, file operations for these protocols as well as for "telnet" and "ftp" are passed to Tramp. ++++ *** The URL package allows customizing the `url-user-agent' string. The new `url-user-agent' variable can be customized to be a string or a 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.") (507 insufficient-storage "Insufficient storage")) "The HTTP return codes and their text.") -(defcustom url-user-agent (format "User-Agent: %sURL/%s\r\n" - (if url-package-name - (concat url-package-name "/" - url-package-version " ") - "") url-version) - "User Agent used by the URL package." - :type '(choice (string :tag "A static User-Agent string") - (function :tag "Call a function to get the User-Agent string")) - :version "25.1" - :group 'url) - ;(eval-when-compile ;; These are all macros so that they are hidden from external sight ;; 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: (const :tag "Direct connection" :value native)) :group 'url-hairy) +(defcustom url-user-agent (format "User-Agent: %sURL/%s\r\n" + (if url-package-name + (concat url-package-name "/" + url-package-version " ") + "") url-version) + "User Agent used by the URL package for HTTP/HTTPS requests +Should be a string or a function of no arguments returning a string." + :type '(choice (string :tag "A static User-Agent string") + (function :tag "Call a function to get the User-Agent string")) + :version "25.1" + :group 'url) + (defvar url-setup-done nil "Has setup configuration been done?") (defconst url-weekday-alist