mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-28 12:10:18 +00:00
Add ETags for immutable directories
Like immutable files, the ETag is based on the storage index. However, since a directory is a special interpretation of a file, it is distinguished from the file by prepending "DIR:" onto the start of the ETag, and adding -representation on the end (where -representation is the ?t= argument, json, info, etc). It also checks the return of setETag and avoids generating a representation if the client already has it.
This commit is contained in:
parent
488b6f8ccd
commit
518ef25bdb
@ -153,6 +153,12 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin):
|
|||||||
req = IRequest(ctx)
|
req = IRequest(ctx)
|
||||||
# This is where all of the directory-related ?t=* code goes.
|
# This is where all of the directory-related ?t=* code goes.
|
||||||
t = get_arg(req, "t", "").strip()
|
t = get_arg(req, "t", "").strip()
|
||||||
|
|
||||||
|
if not self.node.is_mutable():
|
||||||
|
si = self.node.get_storage_index()
|
||||||
|
if si and req.setETag('DIR:%s-%s' % (base32.b2a(si), t or "")):
|
||||||
|
return ""
|
||||||
|
|
||||||
if not t:
|
if not t:
|
||||||
# render the directory as HTML, using the docFactory and Nevow's
|
# render the directory as HTML, using the docFactory and Nevow's
|
||||||
# whole templating thing.
|
# whole templating thing.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user