[
https://issues.apache.org/jira/browse/COUCHDB-257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748972#action_12748972
]
Curt Arnold commented on COUCHDB-257:
-------------------------------------
Spent a few hours testing this today.
max_age still has a problem with rapid requests The test case below fails
when CouchDB returns max-age=0, but works with a Expires date in the past.
Specifying Expires in the past does appear to be effective. That approach is
currently used in couch_httpd_misc_handlers.erl.
Default headers are generated in two locations in couch_httpd.erl and once in
couch_httpd_misc_handlers.erl. Should try to combine those so the default
headers are only specified in one location.
Making CacheControl and Expires configurable would probably be the best
solution with a default like:
[httpd]
CacheControl = must-revalidate
Expires = 0
The following test will fail on IE 6 when Tools/Options/General/Temporary
Internet Files/Check for newer is set to automatic.
couchTests.basics = function(debug) {
var result = JSON.parse(CouchDB.request("GET", "/").responseText);
T(result.couchdb == "Welcome");
var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
db.deleteDb();
db.createDb();
// create a document and save it to the database
var doc = {_id:"0",a:1,b:1};
var result = db.save(doc);
T(result.ok==true); // return object has an ok member with a value true
var id = result.id;
// reopen document we saved earlier
var existingDoc = db.open(id);
T(existingDoc.a==1);
//modify and save
existingDoc.a=4;
db.save(existingDoc);
var modifiedDoc = db.open(id);
T(modifiedDoc.a == 4);
};
I'll work up a patch tonight.
> HTTP caching headers don't provide expected behaviour
> -----------------------------------------------------
>
> Key: COUCHDB-257
> URL: https://issues.apache.org/jira/browse/COUCHDB-257
> Project: CouchDB
> Issue Type: Bug
> Components: HTTP Interface
> Affects Versions: 0.8.1, 0.9
> Environment: Server: Ubuntu Hardy on x86. Client: Windows XP (32-bit).
> Reporter: Vinay Sajip
> Priority: Minor
> Attachments: caching-header-patch.diff
>
>
> The HTTP caching headers currently put out cause IE (for example) to not
> display information correctly in Futon. It's easy to reproduce: I open
> windows in Firefox and IE simultaneously, do an update using Firefox (e.g.
> add a new document) and refresh the IE window. The updated document count is
> not shown. If I clear the browser cache and try again, the updated
> information is displayed. The HTTP header put out is
> Cache-Control: must-revalidate
> which seems to me insufficient - for IE, at least. Is there way of
> configuring these headers, to for example
> Cache-Control: no-cache
> Pragma: no-cache
> Expires: some date in the past, or the same value as the Date: header
> Christopher Lenz has said about this that "This is due to extra-aggressive
> (and against the HTTP spec) caching that IE does on XMLHTTPRequests. A
> patch would need to do user agent sniffing to conditionally add the "cache:
> false" parameter to the jQuery ajax() invocations in jquery.couch.js (and
> maybe elsewhere). I wouldn't want to add this for all user agents, as it
> basically circumvents any caching for AJAX requests (even for
> not-craptastically-broken implementations), and thus would add quite a bit
> of unnecessary overhead."
> To this, I would comment that I don't believe a patch to the client-side code
> in Futon would be sufficient. There are other clients out there, some of
> which will be on Windows and so by default use the (acknowledgely broken)
> Microsoft stack. In my view it is more important to err on the side of
> correctness than performance - so I believe the headers generated server-side
> need to change, as well as perhaps Futon client-side changes.
> I note that handle_uuids_req in couch_httpd_misc_handlers.erl uses the
> no-cache/Expires scheme I mention.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.