X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FDoIndex.pm;h=5aba6b3b0dc69588320b50a6e0210db114cede79;hb=03fd65fd5acb38809b66bf2e5af864395e2f6588;hp=a0cae2baf2f435cff7fa59f1f698d1d2ee19894c;hpb=cc6c820a1e503808b7ac1e2bff132de23f87606b;p=deb%2Fpackages.git diff --git a/lib/Packages/DoIndex.pm b/lib/Packages/DoIndex.pm index a0cae2b..5aba6b3 100644 --- a/lib/Packages/DoIndex.pm +++ b/lib/Packages/DoIndex.pm @@ -4,6 +4,7 @@ use strict; use warnings; use CGI qw( :cgi ); +use POSIX qw( strftime ); use Exporter; use Deb::Versions; @@ -39,6 +40,9 @@ sub send_file { "@{$opts->{suite}}" ) ); } + if ($opts->{format} eq 'txt.gz') { + $opts->{po_lang} = 'en'; + } my $wwwdir = "$TOPDIR/www"; my $path = ""; $path .= "source/" if $opts->{source}; @@ -46,12 +50,7 @@ sub send_file { $path .= "$opts->{archive}[0]/" if @{$opts->{archive}} == 1; $path .= "$opts->{subsection}[0]/" if @{$opts->{subsection}}; $path .= "$opts->{priority}[0]/" if @{$opts->{priority}}; - - #FIXME: ugly hack - if ($opts->{lang} ne 'en' and !-f "$wwwdir/$path$file.$opts->{lang}.$opts->{format}") { - $opts->{lang} = 'en'; - } - $path .= "$file.$opts->{lang}.$opts->{format}"; + $path .= "$file.$opts->{po_lang}.$opts->{format}"; unless (@Packages::CGI::fatal_errors) { my $buffer; @@ -62,7 +61,9 @@ sub send_file { $headers{'-content-encoding'} = $encoding{$opts->{format}} if exists $encoding{$opts->{format}}; my ($size,$mtime) = (stat("$wwwdir/$path"))[7,9]; $headers{'-content-length'} = $size; - $headers{'-last-modified'} = gmtime($mtime); + $headers{'-vary'} = 'negotiate,accept-language'; + $headers{'-last-modified'} = strftime("%a, %d %b %Y %T %z", localtime($mtime)); + $headers{'-expires'} = strftime("%a, %d %b %Y %T %z", localtime($mtime+(12*3600))); print header( %headers ); binmode INDEX;