From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: url-cache - (require 'url) Date: Sun, 15 Jan 2006 01:09:47 -0500 Message-ID: <87oe2erpo4.fsf-monnier+emacs@gnu.org> References: <87y81zusp7.fsf-monnier+emacs@gnu.org> <87hd8mvc6k.fsf-monnier+emacs@gnu.org> <87ek3qt77f.fsf-monnier+emacs@gnu.org> <21C6AB91-2B23-417B-A0BE-AFD7EA2DA05D@gmail.com> <87irsynxvz.fsf-monnier+emacs@gnu.org> <871wzlp6o1.fsf@stone.tss.usg.edu> <878xtqmbb6.fsf-monnier+emacs@gnu.org> <871wzaoe23.fsf@stone.tss.usg.edu> <87u0c6rtgo.fsf-monnier+emacs@gnu.org> <87bqyexf0q.fsf@stone.tss.usg.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137305404 25121 80.91.229.2 (15 Jan 2006 06:10:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 Jan 2006 06:10:04 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 15 07:10:01 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ey15U-0002tj-Qt for ged-emacs-devel@m.gmane.org; Sun, 15 Jan 2006 07:10:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ey17i-00034w-Fa for ged-emacs-devel@m.gmane.org; Sun, 15 Jan 2006 01:12:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ey17Y-00034q-D9 for emacs-devel@gnu.org; Sun, 15 Jan 2006 01:12:08 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ey17W-00034e-Qr for emacs-devel@gnu.org; Sun, 15 Jan 2006 01:12:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ey17W-00034b-Mf for emacs-devel@gnu.org; Sun, 15 Jan 2006 01:12:06 -0500 Original-Received: from [209.226.175.188] (helo=tomts25-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ey1Ao-0005q9-84 for emacs-devel@gnu.org; Sun, 15 Jan 2006 01:15:30 -0500 Original-Received: from alfajor ([67.71.26.73]) by tomts25-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20060115060947.DIDS25777.tomts25-srv.bellnexxia.net@alfajor>; Sun, 15 Jan 2006 01:09:47 -0500 Original-Received: by alfajor (Postfix, from userid 1000) id 7AD9BD736A; Sun, 15 Jan 2006 01:09:47 -0500 (EST) Original-To: Mark Plaksin In-Reply-To: <87bqyexf0q.fsf@stone.tss.usg.edu> (Mark Plaksin's message of "Sat, 14 Jan 2006 23:59:33 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49120 Archived-At: >>>>> 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