Subject: | inode number is not be used for creating Etag. |
Hi,
According to perldoc, stat() function returns a list:
0 dev device number of filesystem
1 ino inode number
2 mode file mode (type and permissions)
3 nlink number of (hard) links to the file
...
Please note that inode number is the 1-th item, NOT 2-th!
In Plack/Middleware/ETag.pm, the 2-th item is used for inode number.
https://metacpan.org/source/FRANCKC/Plack-Middleware-ETag-0.03/lib/Plack/Middleware/ETag.pm#L44
The following patch fixes this.
--- ETag.pm
+++ ETag.pm
@@ -41,7 +41,7 @@ sub call {
$etag = "W/";
}
if ( grep {/inode/} @$file_attr ) {
- $etag .= ( sprintf "%x", $stats[2] );
+ $etag .= ( sprintf "%x", $stats[1] );
}
if ( grep {/mtime/} @$file_attr ) {
$etag .= "-" if ( $etag && $etag !~ /-$/ );