[Dancer-users] Conditional HTTP proposal
Oleg A. Mamontov
oleg at mamontov.net
Fri Feb 11 14:23:49 CET 2011
On Feb 11, 2011, at 3:38 PM, 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"?
No, for a developer environment (in which this method of serving static content is used)
simple comparison of the strings equivalence is quite enough.
Otherwise we'll have to parse request header, this operation is more difficult and
will create extra dependencies.
>
> --
> Richard Huxton
> Archonet Ltd
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
--
Cheers,
Oleg A. Mamontov
mailto: oleg at mamontov.net
jabber: lonerr at charla.mamontov.net
icq uin: 79-521-617
cell: +7-903-798-1352
More information about the Dancer-users
mailing list