aboutsummaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2006-08-26 19:14:25 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-26 13:56:09 -0700
commitf2e73302994b6072e556df1af998c0afd643e833 (patch)
treed7d8e06c7be9c08d1ed63a4794f13cd5c90190b9 /gitweb
parent17848fc67cf466b805f35608230f4df898943ec1 (diff)
downloadgit-f2e73302994b6072e556df1af998c0afd643e833.tar.gz
git-f2e73302994b6072e556df1af998c0afd643e833.tar.xz
gitweb: blobs defined by non-textual hash ids can be cached
Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl20
1 files changed, 17 insertions, 3 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 2db99c360..0df59af82 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2363,6 +2363,12 @@ sub git_heads {
}
sub git_blob_plain {
+ # blobs defined by non-textual hash id's can be cached
+ my $expires;
+ if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
+ $expires = "+1d";
+ }
+
if (!defined $hash) {
if (defined $file_name) {
my $base = $hash_base || git_get_head_hash($project);
@@ -2386,8 +2392,10 @@ sub git_blob_plain {
$save_as .= '.txt';
}
- print $cgi->header(-type => "$type",
- -content_disposition => "inline; filename=\"$save_as\"");
+ print $cgi->header(
+ -type => "$type",
+ -expires=>$expires,
+ -content_disposition => "inline; filename=\"$save_as\"");
undef $/;
binmode STDOUT, ':raw';
print <$fd>;
@@ -2397,6 +2405,12 @@ sub git_blob_plain {
}
sub git_blob {
+ # blobs defined by non-textual hash id's can be cached
+ my $expires;
+ if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
+ $expires = "+1d";
+ }
+
if (!defined $hash) {
if (defined $file_name) {
my $base = $hash_base || git_get_head_hash($project);
@@ -2414,7 +2428,7 @@ sub git_blob {
close $fd;
return git_blob_plain($mimetype);
}
- git_header_html();
+ git_header_html(undef, $expires);
my $formats_nav = '';
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
if (defined $file_name) {