summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2009-09-26 02:46:41 +0000
committerPaul Joseph Davis <davisp@apache.org>2009-09-26 02:46:41 +0000
commiteefb0b2d6ed65a9f8e17931e69eef56d1c92430e (patch)
treedfe7312ff0c001ae4ef2a01098a3aebdabaf4850 /src
parent0fe42b207eb98a965cddff9f55942cc916e7cc5e (diff)
Fix the UUID's test failures when clocks are out of sync.
Changes the tests for cache busting by using ETag's. Left the date tests commented out just in case someone thinks I'm crazy and sees a better solution. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@819091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_httpd_misc_handlers.erl17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl
index 37ed709f..24eaa82e 100644
--- a/src/couchdb/couch_httpd_misc_handlers.erl
+++ b/src/couchdb/couch_httpd_misc_handlers.erl
@@ -106,13 +106,18 @@ handle_restart_req(Req) ->
handle_uuids_req(#httpd{method='GET'}=Req) ->
Count = list_to_integer(couch_httpd:qs_value(Req, "count", "1")),
- CacheBustingHeaders = [{"Date", httpd_util:rfc1123_date()},
- {"Cache-Control", "no-cache"},
- % Past date, ON PURPOSE!
- {"Expires", "Fri, 01 Jan 1990 00:00:00 GMT"},
- {"Pragma", "no-cache"}],
UUIDs = [couch_uuids:new() || _ <- lists:seq(1, Count)],
- send_json(Req, 200, CacheBustingHeaders, {[{<<"uuids">>, UUIDs}]});
+ couch_httpd:etag_respond(Req, erlang:md5(UUIDs), fun() ->
+ CacheBustingHeaders = [
+ {"Date", httpd_util:rfc1123_date()},
+ {"Cache-Control", "no-cache"},
+ % Past date, ON PURPOSE!
+ {"Expires", "Fri, 01 Jan 1990 00:00:00 GMT"},
+ {"Pragma", "no-cache"},
+ {"ETag", erlang:md5(UUIDs)}
+ ],
+ send_json(Req, 200, CacheBustingHeaders, {[{<<"uuids">>, UUIDs}]})
+ end);
handle_uuids_req(Req) ->
send_method_not_allowed(Req, "GET").