Skip Menu |

This queue is for tickets about the CGI-Application-PhotoGallery CPAN distribution.

Report information
The Basics
Id: 33972
Status: resolved
Priority: 0/
Queue: CGI-Application-PhotoGallery

People
Owner: Nobody in particular
Requestors: tlhackque [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Awful performance loading index page
I was amazed by how slow it is to load my index pages, so I investigated. After looking for server/httpd issues, I discovered that the thumbnail & brower caches were ineffective because...each thumbnail was returning the wrong last_modified timestamp. (1-jan-1970, to be specific). Thus, not only was the browser cache not used, we'd rebuild each thumbnail from the main image as well. I also noticed than a favicon.ico in the gallery directory causes some confusion. Here is a diff that fixes these problems, as well as optimizes the header parsing for Modified-Since. --- PhotoGallery.pm.12 2008-03-10 17:58:53.000000000 -0400 +++ PhotoGallery.pm 2008-03-10 18:31:01.000000000 -0400 @@ -226,6 +226,7 @@ my @photos = sort File::Find::Rule->maxdepth( 1 )->file->exec( sub { my $name = pop; + return 0 if basename( $name ) eq 'favicon.ico'; my $mime = $types->mimeTypeOf( $name ); return 1 if $mime && $mime->mediaType eq 'image'; } @@ -387,7 +388,7 @@ if ( my $header = $query->http( 'If-Modified-Since' ) ) { $reqmod = HTTP::Date::str2time( - ( split( /;/, $query->http( 'If-Modified-Since' ), 2 ) )[ 0 ] + ( split( /;/, $header, 2 ) )[ 0 ] ); } @@ -408,7 +409,7 @@ $self->header_props( { -type => $self->mime_types->mimeTypeOf( $path ), - -last_modified => $lastmod + -last_modified => HTTP::Date::time2str( $lastmod ) } ); @@ -436,7 +437,7 @@ my $reqmod; if ( my $header = $query->http( 'If-Modified-Since' ) ) { $reqmod = HTTP::Date::str2time( - ( split( /;/, $query->http( 'If-Modified-Since' ), 2 ) )[ 0 ] ); + ( split( /;/, $header, 2 ) )[ 0 ] ); } if ( $reqmod && $reqmod == $lastmod ) { @@ -600,4 +601,3 @@ =cut 1; -
Patch applied. 0.13 Sent to CPAN (in the meanwhile: http://pause.perl.org/incoming/CGI-Application-PhotoGallery-0.13.tar.gz)