File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -2363,6 +2363,12 @@ sub git_heads {
23632363}
23642364
23652365sub git_blob_plain {
2366+ # blobs defined by non-textual hash id's can be cached
2367+ my $expires ;
2368+ if ($hash =~ m / ^[0-9a-fA-F] {40}$ / ) {
2369+ $expires = " +1d" ;
2370+ }
2371+
23662372 if (!defined $hash ) {
23672373 if (defined $file_name ) {
23682374 my $base = $hash_base || git_get_head_hash($project );
@@ -2386,8 +2392,10 @@ sub git_blob_plain {
23862392 $save_as .= ' .txt' ;
23872393 }
23882394
2389- print $cgi -> header(-type => " $type " ,
2390- -content_disposition => " inline; filename=\" $save_as \" " );
2395+ print $cgi -> header(
2396+ -type => " $type " ,
2397+ -expires => $expires ,
2398+ -content_disposition => " inline; filename=\" $save_as \" " );
23912399 undef $/ ;
23922400 binmode STDOUT , ' :raw' ;
23932401 print <$fd >;
@@ -2397,6 +2405,12 @@ sub git_blob_plain {
23972405}
23982406
23992407sub git_blob {
2408+ # blobs defined by non-textual hash id's can be cached
2409+ my $expires ;
2410+ if ($hash =~ m / ^[0-9a-fA-F] {40}$ / ) {
2411+ $expires = " +1d" ;
2412+ }
2413+
24002414 if (!defined $hash ) {
24012415 if (defined $file_name ) {
24022416 my $base = $hash_base || git_get_head_hash($project );
@@ -2414,7 +2428,7 @@ sub git_blob {
24142428 close $fd ;
24152429 return git_blob_plain($mimetype );
24162430 }
2417- git_header_html();
2431+ git_header_html(undef , $expires );
24182432 my $formats_nav = ' ' ;
24192433 if (defined $hash_base && (my %co = parse_commit($hash_base ))) {
24202434 if (defined $file_name ) {
You can’t perform that action at this time.
0 commit comments