[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with url-retrieve when HTTP status is 304
From: |
Mark Plaksin |
Subject: |
Problem with url-retrieve when HTTP status is 304 |
Date: |
Sat, 14 Jan 2006 19:08:25 -0500 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.51 (gnu/linux) |
With CVS Emacs, url-retrieve triggers an error when it gets an HTTP status
of 304 *and* the requested page is not in the cache. To reproduce, try
this:
(setq url-request-extra-headers
'(("If-Modified-Since" . "Sun, 18 Sep 2005 17:34:28 GMT")
("If-None-Match" . "\"91ad777b5809a56e2b2b9d7c4833fceb\"")))
(url-retrieve-synchronously "http://tumbleblindly.org/feed/")
You should get an error that the cache file doesn't exist. (If the feed
changes after I send this note, you'll have to replace the date with the
value of the the feed's Last-Modified header and the long string with the
value of the ETag header.)
It's not clear which should change--the section of url-http-parse-headers
which handles 304 or url-cache-extract. One of them should check to see
whether the cache file exists before trying to insert its contents.
Here's the relevant section of url-http-parse-headers:
(304
;; The 304 response MUST NOT contain a message-body.
(url-http-debug "Extracting document from cache... (%s)"
(url-cache-create-filename (url-view-url t)))
(url-cache-extract (url-cache-create-filename (url-view-url t)))
(setq redirect-uri nil
success t))
And here's url-cache-extract:
(defun url-cache-extract (fnam)
"Extract FNAM from the local disk cache"
(erase-buffer)
(insert-file-contents-literally fnam))
- Problem with url-retrieve when HTTP status is 304,
Mark Plaksin <=