1

There are plenty of articles on the web detailing why you might not want to use Apache's default inode-mtime-size format for ETags (see e.g. here or here). All such articles recommend the same thing: remove inodes from your ETags.

But I have yet to read anything on what might have motivated the inclusion of inode for Apache in the first place. On the face of it, it only seems useful if one needs to be able to differentiate between octet-for-octet facsimiles of the same resource, but this is surely counter to the very purpose of ETags.

Apache's authors are not known for their sloppy handing of internet standards, so I feel I must be missing something. Can anyone elaborate?

hatfinch
  • 113
  • 5

1 Answers1

2

I expect it is to differentiate resources that are the same size and the have the same mtime, but aren't actually the same file. This would be easy to do -- say you've got two files with different contents but the same size (not that hard) and the same mtime (trickier, but if you copied a directory tree from somewhere else, still not hard), a and b, and you're serving a through Apache. Now mv b a and while the inode changes for a, the size and mtime don't -- and you're up the creek without an inode.

womble
  • 95,029
  • 29
  • 173
  • 228
  • 1
    ETags can only meaningfully be compared between revisions of a single resource, but moving a file from A to B essentially changes the resource you're referring to, so I still don't see how this is a benefit. Could you please elaborate? – hatfinch Sep 29 '09 at 12:54
  • Sorry, had my `mv` backwards -- it should have been `mv b a` to indicate that the contents of `b` are now at the path of `a`. Answer updated. – womble Sep 29 '09 at 13:11
  • I can see how this would help catch this particular case, but it doesn't catch the `echo "changed contents" > a` case. It still seems to me to be a half-measure whose unlooked-for side effects outweigh its benefits. But thank you for outlining at least one benefit! – hatfinch Sep 29 '09 at 14:10
  • 1
    It *does* catch the `echo foo > a` case because that will change the MTime which is part of the ETag. The default apache ETag uses inode, MTime and size. – freiheit Sep 29 '09 at 18:14