[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r118293: url-http.el: introduce url-user-agent
From: |
Teodor Zlatanov |
Subject: |
[Emacs-diffs] trunk r118293: url-http.el: introduce url-user-agent |
Date: |
Wed, 05 Nov 2014 16:06:35 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 118293
revision-id: address@hidden
parent: address@hidden
committer: Ted Zlatanov <address@hidden>
branch nick: quickfixes
timestamp: Wed 2014-11-05 11:06:40 -0500
message:
url-http.el: introduce url-user-agent
* url-http.el (url-user-agent): New variable, can be function or
string. Suggested by Vibhav Pant <address@hidden>.
(url-http-user-agent-string): Use it.
* url-http.el (url-user-agent): New variable, can be function or
string. Suggested by Vibhav Pant <address@hidden>.
modified:
lisp/url/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-3116
lisp/url/url-http.el urlhttp.el-20091113204419-o5vbwnq5f7feedwu-2989
=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog 2014-10-30 05:15:28 +0000
+++ b/lisp/url/ChangeLog 2014-11-05 16:06:40 +0000
@@ -1,3 +1,11 @@
+2014-11-05 Teodor Zlatanov <address@hidden>
+
+ * url-http.el (url-user-agent): New variable, can be function or
+ string. Suggested by Vibhav Pant <address@hidden>.
+ (Bug#16498)
+
+ (url-http-user-agent-string): Use it.
+
2014-10-29 Paul Eggert <address@hidden>
Simplify use of current-time and friends.
=== modified file 'lisp/url/url-http.el'
--- a/lisp/url/url-http.el 2014-10-30 05:15:28 +0000
+++ b/lisp/url/url-http.el 2014-11-05 16:06:40 +0000
@@ -132,6 +132,16 @@
(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 @@
(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."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r118293: url-http.el: introduce url-user-agent,
Teodor Zlatanov <=