unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Why does url-retrieve ignore url-mime-accept-string and most other url variables?
@ 2016-03-29  9:52 Clément Pit--Claudel
  0 siblings, 0 replies; only message in thread
From: Clément Pit--Claudel @ 2016-03-29  9:52 UTC (permalink / raw)
  To: Emacs developers


[-- Attachment #1.1: Type: text/plain, Size: 1276 bytes --]

The doc string of url-retrieve says:

> The variables ‘url-request-data’, ‘url-request-method’ and
> ‘url-request-extra-headers’ can be dynamically bound around the
> request; dynamic binding of other variables doesn’t necessarily
> take effect.

What's the proper way, then, to set ‘url-mime-encoding-string’, ‘url-mime-charset-string’, and ‘url-mime-accept-string’ for a single query? In particular, how come things work with ‘url-retrieve-synchronously’, but not with ‘url-retrieve’?

More precisely: this sends a query with ‘Accept: */*’, and prints nil:

    (let ((url-mime-accept-string "abc/def"))
      (url-retrieve "http://www.gnu.org/software/emacs/"
                    (lambda (&rest _)
                      (message "url-retrieve: %S"
                               url-mime-accept-string))))

but this sends a query with ‘Accept: abc/def’, and prints “abc/def”:

    (let ((url-mime-accept-string "abc/def"))
      (with-current-buffer
          (url-retrieve-synchronously
           "http://www.gnu.org/software/emacs/")
        (message "url-retrieve: %S"
                 url-mime-accept-string)))

Is that a bug? If not, could we document the proper way to set an Accept header?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-29  9:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-29  9:52 Why does url-retrieve ignore url-mime-accept-string and most other url variables? Clément Pit--Claudel

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).