all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vibhav Pant <vibhavp@ubuntu.com>
To: Bozhidar Batsov <bozhidar@batsov.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] Add support for custom user agent strings in url.el
Date: Sun, 19 Jan 2014 15:28:45 +0530	[thread overview]
Message-ID: <CA+T2Sh1Rvg5=1QnuQvg_+FUOxwA4k_uDXGbKKYwnFvJbUtjLUw@mail.gmail.com> (raw)
In-Reply-To: <CA+T2Sh1W8vSx5G=wJUPB_nWhX=PWN+jOJoMrmupBc5sJ_kE3Qw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2592 bytes --]

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 <vibhavp@ubuntu.com> 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 <bozhidar@batsov.com>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 <vibhavp@gmail.com> 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)"

[-- Attachment #2: Type: text/html, Size: 4242 bytes --]

  reply	other threads:[~2014-01-19  9:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-19  8:10 [PATCH] Add support for custom user agent strings in url.el Vibhav Pant
2014-01-19  8:15 ` Bozhidar Batsov
2014-01-19  8:36   ` Vibhav Pant
2014-01-19  9:12     ` Bozhidar Batsov
2014-01-19  9:45       ` Vibhav Pant
2014-01-19  9:58         ` Vibhav Pant [this message]
2014-01-19 14:13           ` Vibhav Pant
2014-01-20  9:13           ` Richard Stallman
2014-01-20 12:11             ` Rüdiger Sonderfeld
2014-01-20 12:13           ` Rüdiger Sonderfeld
2014-01-20 14:03             ` Vibhav Pant
2014-01-19 14:42         ` Stefan Monnier
2014-01-19 15:28           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+T2Sh1Rvg5=1QnuQvg_+FUOxwA4k_uDXGbKKYwnFvJbUtjLUw@mail.gmail.com' \
    --to=vibhavp@ubuntu.com \
    --cc=bozhidar@batsov.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.