emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: url-cache - (require 'url)


From: Stefan Monnier
Subject: Re: url-cache - (require 'url)
Date: Sun, 15 Jan 2006 01:09:47 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>>>> It would also be nice if there was an easy way to get at the HTTP headers
>>>>> associated with a response.  Maybe there is a way but I can't find it.
>>>> 
>>>> Maybe for that, url-http is more appropriate.
>>>> After all, there won't be any HTTL headers if the URL is not using HTTP.
>> 
>>> Right.  How about this patch to url-http.el?
>> 
>>> Test like this:
>>> (setq url-http-save-headers t)
>>> (url-retrieve-synchronously "http://rss.slashdot.org/Slashdot/slashdot";)
>>> (setq url-http-save-headers nil)
>> 
>> I'm not sure I understand what you mean by "agreed".  At first it seems you
>> agree that url-http is preferable, but then the example code that uses your
>> patch uses url-retrieve.

> I agree that the code which stores HTTP headers in a variable belongs in
> url-http.el.  It's easier to test by calling url-retrieve but you can also
> test by calling url-http:

> (url-http (url-generic-parse-url "http://www.usg.edu/";) (lambda ()) nil)
> (setq url-http-save-headers t)
> (url-retrieve-synchronously "http://rss.slashdot.org/Slashdot/slashdot";)
> (setq url-http-save-headers nil)

> At this point url-http-headers should contain the HTTP headers returned by
> www.usg.edu.

BTW, the docstring of url-retrieve says:

   CALLBACK is called when the object has been completely retrieved, with
   the current buffer containing the object, and any MIME headers associated
   with it.

so the headers should be readily available already.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]