[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22855: 24.5; `url-mime-accept-string' not set in asynchronous call
From: |
Lars Ingebrigtsen |
Subject: |
bug#22855: 24.5; `url-mime-accept-string' not set in asynchronous call |
Date: |
Tue, 01 Mar 2016 14:44:21 +1100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Bjarte Johansen <bjarte.johansen@gmail.com> writes:
> (let ((url-debug t)
> (url-request-method "POST")
> (url-request-extra-headers
> `(("Content-Type" . "application/x-www-form-urlencoded")))
> (url-request-data
>
> "query=SELECT%20%3FC%20WHERE%20%7B%5B%5D%20a%20%3FC%7D%20LIMIT%201%0A")
> (url-mime-accept-string "text/csv"))
> (url-retrieve "http://live.dbpedia.org/sparql/"
> #'(lambda (_)
> (message (buffer-string)))))
>
> This will sometimes return a csv file and sometimes an xml file (usually
> the first time). In *URL-DEBUG* you can see that the Accept header is
> not properly set.
The reason it sometimes work is that URL caches connections. If you
(setq url-http-open-connections (make-hash-table :test 'equal :size 17))
before calling, then it'll fail every time.
And the `url-mime-accept-string' variable is just not meant to be used
as an "interface" variable -- it's supposed to be a constant value.
But that really makes no sense, so I'll get fixin'.
I really dislike the `url-retrieve' "interface", where you bind a
gazillion special variables instead of passing in values explicitly.
One of these ... years...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no