On Fri, 2011-02-11 at 12:38 +0000, Richard Huxton wrote:
On 10/02/11 17:36, Oleg A. Mamontov wrote:
+ my $lmod = strftime '%a, %d %b %Y %H:%M:%S GMT', gmtime(stat($fh)->mtime); + my $imod = Dancer::SharedData->request->header('If-Modified-Since') || ''; + + Dancer::Response->status( $lmod eq $imod ? 304 : $status ); ... + Dancer::Response::set_current_content($fh) unless $lmod eq $imod;
Should this not be "ge" rather than "eq"?
I don't think so; if it was last modified after the "If-Modified-Since" datetime, you want to send the response, rather than a 304 Not Modified response. You could use "le" instead, but there shouldn't be any situation where the file was last modified before the If-Modified-Since header, unless the client modified the header perhaps. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ "Programming is like sex. One mistake and you have to support it for the rest of your life". (Michael Sinz)