diff options
author | Clément Pit--Claudel <clement.pit@gmail.com> | 2016-04-24 14:51:33 +0200 |
---|---|---|
committer | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2016-04-24 14:51:33 +0200 |
commit | 234ef3b432b7dff6629a12be5dd03a163b8e8619 (patch) | |
tree | e2aed8414502156d3801ccaaa12d06f9556be4a2 /lisp/url/url-vars.el | |
parent | 97ecff0783128edeb6fe5f6e441993c9bbf2a25a (diff) | |
download | emacs-234ef3b432b7dff6629a12be5dd03a163b8e8619.tar.gz |
Compute User-Agent dynamically in url-http
* url-http.el (url-http-user-agent-string): Compute User-Agent
string dynamically.
(url-http--user-agent-default-string): New function.
* url-vars.el (url-privacy-level): Allow `emacs' in list of
information not to send.
(url-user-agent): Add nil and `default' options; do not
pre-compute value.
Diffstat (limited to 'lisp/url/url-vars.el')
-rw-r--r-- | lisp/url/url-vars.el | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 960a04ad30f..f6aae21a838 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el @@ -116,6 +116,7 @@ If a list, this should be a list of symbols of what NOT to send. Valid symbols are: email -- the email address os -- the operating system info +emacs -- the version of Emacs lastloc -- the last location agent -- do not send the User-Agent string cookies -- never accept HTTP cookies @@ -143,6 +144,7 @@ variable." (checklist :tag "Custom" (const :tag "Email address" :value email) (const :tag "Operating system" :value os) + (const :tag "Emacs version" :value emacs) (const :tag "Last location" :value lastloc) (const :tag "Browser identification" :value agent) (const :tag "No cookies" :value cookie))) @@ -357,16 +359,21 @@ 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" +(defcustom url-user-agent 'default + "User Agent used by the URL package for HTTP/HTTPS requests. +Should be one of: +* A string (not including the \"User-Agent:\" prefix) +* A function of no arguments, returning a string +* `default' (to compute a value according to `url-privacy-level') +* nil (to omit the User-Agent header entirely)" + :type + '(choice + (string :tag "A static User-Agent string") + (function :tag "Call a function to get the User-Agent string") + (const :tag "No User-Agent at all" :value nil) + (const :tag "An string auto-generated according to `url-privacy-level'" + :value default)) + :version "25.2" :group 'url) (defvar url-setup-done nil "Has setup configuration been done?") |