[BACK]Return to cvsweb.cgi CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / cvsweb

Diff for /cvsweb/cvsweb.cgi between version 4.7 and 4.13

version 4.7, 2019/11/09 09:32:22 version 4.13, 2019/11/11 12:40:12
Line 86  use vars qw (
Line 86  use vars qw (
   $allow_enscript @enscript_options %enscript_types    $allow_enscript @enscript_options %enscript_types
 );  );
   
   require Compress::Zlib;
 use Cwd                   qw(abs_path);  use Cwd                   qw(abs_path);
 use File::Path            qw(rmtree);  use File::Path            qw(rmtree);
 use File::Spec::Functions qw(canonpath catdir catfile curdir devnull rootdir  use File::Spec::Functions qw(canonpath catdir catfile curdir devnull rootdir
Line 102  use constant CVSWEBMARKUP => qr{^text/(x-cvsweb|vnd\.v
Line 103  use constant CVSWEBMARKUP => qr{^text/(x-cvsweb|vnd\.v
 use constant LOG_FILESEPR => qr/^={77}$/o;  use constant LOG_FILESEPR => qr/^={77}$/o;
 use constant LOG_REVSEPR  => qr/^-{28}$/o;  use constant LOG_REVSEPR  => qr/^-{28}$/o;
   
 use constant HAS_ZLIB     => eval { require Compress::Zlib; };  
 use constant HAS_EDIFF    => eval { require String::Ediff;  };  use constant HAS_EDIFF    => eval { require String::Ediff;  };
   
 # -----------------------------------------------------------------------------  # -----------------------------------------------------------------------------
Line 113  use constant HAS_EDIFF    => eval { require String::Ed
Line 113  use constant HAS_EDIFF    => eval { require String::Ed
   
 BEGIN  BEGIN
 {  {
   $VERSION = '3.0.6';    $VERSION = '3.1';
   
   $HTML_DOCTYPE =    $HTML_DOCTYPE =
     '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' .      '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' .
Line 317  $maycompress = (
Line 317  $maycompress = (
     && $ENV{HTTP_ACCEPT_ENCODING} =~ /gzip/)      && $ENV{HTTP_ACCEPT_ENCODING} =~ /gzip/)
    || $is_mozilla3)     || $is_mozilla3)
   && !$is_msie    && !$is_msie
   && !(defined($ENV{MOD_PERL}) && !HAS_ZLIB)    && !(defined($ENV{MOD_PERL}))
 );  );
   
 # Parameters that will be sticky in all constructed links/query strings.  # Parameters that will be sticky in all constructed links/query strings.
Line 358  if (defined($ENV{QUERY_STRING})) {
Line 358  if (defined($ENV{QUERY_STRING})) {
     $p =~ y/+/ /;      $p =~ y/+/ /;
     my ($key, $val) = split(/=/, $p, 2);      my ($key, $val) = split(/=/, $p, 2);
     next unless defined($key);      next unless defined($key);
     $val = 1 unless defined($val);      $key = uri_unescape($key);
     ($key = uri_unescape($key)) =~ /[[:graph:]]/ or next;      $key =~ /([^a-z_12-])/ and fatal('404 Not Found',
     ($val = uri_unescape($val)) =~ /[[:graph:]]/ or next;        'Invalid character "%s" in query parameter "%s"', $1, $key);
       if (defined $val) {
         $val = uri_unescape($val);
         $val =~ /([^a-zA-Z_01-9.\/-])/ and fatal('404 Not Found',
           'Invalid character "%s" in the value "%s" of the query parameter "%s"',
           $1, $value, $key);
       } else {
         $val = 1;
       }
     $query{$key} = $val;      $query{$key} = $val;
   }    }
 }  }
Line 757  if ($input{tarball}) {
Line 765  if ($input{tarball}) {
   }    }
   
   # Clean up.    # Clean up.
     chdir("..");
   rmtree($tmpexportdir);    rmtree($tmpexportdir);
   
   &fatal(@fatal) if @fatal;    &fatal(@fatal) if @fatal;
Line 4234  sub http_header(;$$)
Line 4243  sub http_header(;$$)
   push(@headers, 'Last-Modified: ' . scalar gmtime($moddate) . ' GMT')    push(@headers, 'Last-Modified: ' . scalar gmtime($moddate) . ' GMT')
     if $moddate;      if $moddate;
   push(@headers, 'Content-Type: ' . $content_type);    push(@headers, 'Content-Type: ' . $content_type);
     push(@headers, "Content-Security-Policy: default-src 'none'; " .
       "img-src 'self'; style-src 'unsafe-inline'");
   
   if ($allow_compress && $maycompress) {    if ($allow_compress && $maycompress) {
     if (HAS_ZLIB  
         || (defined($CMD{gzip}) && open(GZIP, "| $CMD{gzip} -1 -c")))  
     {  
   
       push(@headers, 'Content-Encoding: gzip');        push(@headers, 'Content-Encoding: gzip');
       push(@headers, 'Vary: Accept-Encoding');     # RFC 2616, 14.44        push(@headers, 'Vary: Accept-Encoding');     # RFC 2616, 14.44
       print join("\r\n", @headers) . "\r\n\r\n";        print join("\r\n", @headers) . "\r\n\r\n";
Line 4247  sub http_header(;$$)
Line 4254  sub http_header(;$$)
       $| = 1;        $| = 1;
       $| = 0;                                      # Flush header output.        $| = 0;                                      # Flush header output.
   
       tie(*GZIP, __PACKAGE__, \*STDOUT) if HAS_ZLIB;        tie(*GZIP, __PACKAGE__, \*STDOUT);
       select(GZIP);        select(GZIP);
       $gzip_open = 1;        $gzip_open = 1;
   
     } else {  
   
       print join("\r\n", @headers) . "\r\n\r\n";  
       printf  
         '<span style="font-size: smaller">Unable to find gzip binary in the <b>$command_path</b> (<code>%s</code>) to compress output</span><br />',  
           htmlquote(join(':', @command_path));  
     }  
   
   } else {    } else {
     print join("\r\n", @headers) . "\r\n\r\n";      print join("\r\n", @headers) . "\r\n\r\n";
   }    }
Line 4426  sub TIEHANDLE
Line 4424  sub TIEHANDLE
               crc    => 0,                crc    => 0,
               len    => 0,                len    => 0,
             };              };
   my ($header) = pack("c10",    my ($header) = pack("C10",
                       MAGIC1, MAGIC2, Compress::Zlib::Z_DEFLATED(),                        MAGIC1, MAGIC2, Compress::Zlib::Z_DEFLATED(),
                       0, 0, 0, 0, 0, 0, OSCODE);                        0, 0, 0, 0, 0, 0, OSCODE);
   print {$o->{handle}} $header;    print {$o->{handle}} $header;

Legend:
Removed from v.4.7  
changed lines
  Added in v.4.13

CVSweb