about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franckcuny@gmail.com>2015-07-07 11:46:28 -0700
committerFranck Cuny <franckcuny@gmail.com>2015-07-07 11:46:28 -0700
commit212e42649303b51f1697c6b9e5897f03d70ef14c (patch)
tree70caa13699301c72ea366d8a3545bf3a147b3c7b
parentupdate dist.ini (diff)
parentFix off-by-one error. (diff)
downloadplack-middleware-etag-212e42649303b51f1697c6b9e5897f03d70ef14c.tar.gz
Merge branch 'off-by-one'
-rw-r--r--lib/Plack/Middleware/ETag.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Plack/Middleware/ETag.pm b/lib/Plack/Middleware/ETag.pm
index 22dcc01..86912f4 100644
--- a/lib/Plack/Middleware/ETag.pm
+++ b/lib/Plack/Middleware/ETag.pm
@@ -35,13 +35,12 @@ sub call {
                 my $file_attr = $self->file_etag || [qw/inode mtime size/];
                 my @stats = stat $res->[2];
                 if ( $stats[9] == time - 1 ) {
-
-            # if the file was modified less than one second before the request
-            # it may be modified in a near future, so we return a weak etag
+                    # if the file was modified less than one second before the request
+                    # it may be modified in a near future, so we return a weak etag
                     $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 !~ /-$/ );