By the way, the patch will still respect the paranoid option, where no user agent string is sent. On Sun, Jan 19, 2014 at 3:15 PM, Vibhav Pant wrote: > Here's the fixed patch. I created a defcustom for the user-agent in > url-http.el. > > diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el > index ac2e140..6a0ec13 100644 > --- a/lisp/url/url-http.el > +++ b/lisp/url/url-http.el > @@ -132,6 +132,15 @@ 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 '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 +223,7 @@ 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))) > + 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." > > > > On Sun, Jan 19, 2014 at 2:42 PM, Bozhidar Batsov wrote: > >> The default of the defcustom can also be the result of a function call >> (like `format', etc). Basically everything that returns a string will do. >> >> >> On 19 January 2014 10:36, Vibhav Pant wrote: >> >>> >>> Bozhidar Batsov writes: >>> >>> > Seems to me that there should be just a defcustom `url-user-agent' and >>> it >>> > should be used always. By default it should have whatever value it >>> > currently has and users will be able to customise it. >>> The function url-http-user-agent-string generates a user agent by >>> concatinating url-package-name and url-package-version. So the defcustom >>> would have to be a function or a sexp, making things a little confusing >>> for new users. >>> >>> -- >>> Vibhav Pant >>> vibhavp@gmail.com >>> >> >> > > > -- > Vibhav Pant > vibhavp@gmail.com > -- Vibhav Pant vibhavp@ubuntu.com "0x2B | ~ 0x2B (Hamlet, Shakespeare)"