Commit d9f7c524 authored by Ted Zlatanov's avatar Ted Zlatanov
Browse files

url-http.el: introduce url-user-agent

* url-http.el (url-user-agent): New variable, can be function or
string.  Suggested by Vibhav Pant <vibhavp@ubuntu.com>.

(url-http-user-agent-string): Use it.

* url-http.el (url-user-agent): New variable, can be function or
string.  Suggested by Vibhav Pant <vibhavp@ubuntu.com>.
parent eecd19cf
2014-11-05 Teodor Zlatanov <tzz@lifelogs.com>
* url-http.el (url-user-agent): New variable, can be function or
string. Suggested by Vibhav Pant <vibhavp@ubuntu.com>.
(Bug#16498)
(url-http-user-agent-string): Use it.
2014-10-29 Paul Eggert <eggert@cs.ucla.edu>
Simplify use of current-time and friends.
......
......@@ -132,6 +132,16 @@ 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"))
:group 'url)
;(eval-when-compile
;; These are all macros so that they are hidden from external sight
;; when the file is byte-compiled.
......@@ -214,11 +224,9 @@ request.")
(and (listp url-privacy-level)
(memq 'agent url-privacy-level)))
""
(format "User-Agent: %sURL/%s\r\n"
(if url-package-name
(concat url-package-name "/" url-package-version " ")
"")
url-version)))
(if (functionp url-user-agent)
(funcall url-user-agent)
url-user-agent)))
(defun url-http-create-request (&optional ref-url)
"Create an HTTP request for `url-http-target-url', referred to by REF-URL."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment