Merge from FreeBSD-cvsweb 2.0.0.
* cvsweb.conf-freebsd: Allow downloading a tarball of a project directory as well as a port directory. * cvsweb.cgi, cvsweb.conf: Introduce optional output filter. [Requested by: Shigeyuki Fukushima <shige@FreeBSD.org>] * cvsweb.cgi: Fix a bug where it produces wrong download links when cvsweb.cgi is placed right under the document root. [Reported by: Arnaud on EFnet]
This commit is contained in:
parent
b7d3ff93e3
commit
2dd49a11c2
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=11164
5 changed files with 50 additions and 25 deletions
|
@ -13,7 +13,7 @@
|
|||
#
|
||||
# Based on:
|
||||
# * Bill Fenners cvsweb.cgi revision 1.28 available from:
|
||||
# http://cvsweb.FreeBSD.org/www/en/cgi/cvsweb.cgi
|
||||
# http://www.FreeBSD.org/cgi/cvsweb.cgi/www/en/cgi/cvsweb.cgi
|
||||
#
|
||||
# Copyright (c) 1996-1998 Bill Fenner
|
||||
# (c) 1998-1999 Henner Zeller
|
||||
|
@ -42,9 +42,10 @@
|
|||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $Id: cvsweb.cgi,v 1.77 2001-11-07 16:32:11 sobomax Exp $
|
||||
# $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.82 2001/08/01 09:54:52 knu Exp $
|
||||
# $FreeBSD$
|
||||
# FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.87 2001/11/07 21:08:33 knu Exp
|
||||
# $Id: cvsweb.cgi,v 1.78 2001-11-07 21:25:15 knu Exp $
|
||||
# $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.84 2001/10/07 20:50:10 knu Exp $
|
||||
# $FreeBSD: www/en/cgi/cvsweb.cgi,v 1.77 2001/11/07 16:32:11 sobomax Exp $
|
||||
#
|
||||
###
|
||||
|
||||
|
@ -68,7 +69,7 @@ use vars qw (
|
|||
$is_links $is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased
|
||||
%input $query $barequery $sortby $bydate $byrev $byauthor
|
||||
$bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot
|
||||
$mimetype $charset $defaultTextPlain $defaultViewable
|
||||
$mimetype $charset $output_filter $defaultTextPlain $defaultViewable
|
||||
$command_path %CMD $allow_compress
|
||||
$backicon $diricon $fileicon
|
||||
$fullname $newname $cvstreedefault
|
||||
|
@ -107,6 +108,7 @@ sub search_path($);
|
|||
sub getMimeTypeFromSuffix($);
|
||||
sub head($;$);
|
||||
sub scan_directives(@);
|
||||
sub openOutputFilter();
|
||||
sub doAnnotate($$);
|
||||
sub doCheckout($$);
|
||||
sub cvswebMarkup($$$);
|
||||
|
@ -142,11 +144,7 @@ sub forbidden_module($);
|
|||
##### Start of Configuration Area ########
|
||||
delete $ENV{PATH};
|
||||
|
||||
$cvsweb_revision =
|
||||
'1.112' . '.' . (
|
||||
split (/ /,
|
||||
q$Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.82 2001/08/01 09:54:52 knu Exp $
|
||||
))[2];
|
||||
$cvsweb_revision = '2.0.0';
|
||||
|
||||
use File::Basename;
|
||||
|
||||
|
@ -231,10 +229,8 @@ $LOG_REVSEPARATOR = q/^-{28}$/;
|
|||
},
|
||||
);
|
||||
|
||||
##### End of configuration variables #####
|
||||
|
||||
$cgi_style::hsty_base = 'http://www.FreeBSD.org';
|
||||
$_ = q$FreeBSD$;
|
||||
$_ = q$FreeBSD: www/en/cgi/cvsweb.cgi,v 1.77 2001/11/07 16:32:11 sobomax Exp $;
|
||||
@_ = split;
|
||||
$cgi_style::hsty_date = "@_[3,4]";
|
||||
|
||||
|
@ -1533,6 +1529,18 @@ sub scan_directives(@) {
|
|||
('tabstop' => $ts);
|
||||
}
|
||||
|
||||
sub openOutputFilter() {
|
||||
return if !defined($output_filter) || $output_filter eq '';
|
||||
|
||||
open(STDOUT, "|-") && return;
|
||||
|
||||
# child of child
|
||||
open(STDERR, '>/dev/null');
|
||||
exec($output_filter);
|
||||
|
||||
exit -1;
|
||||
}
|
||||
|
||||
###############################
|
||||
# show Annotation
|
||||
###############################
|
||||
|
@ -1978,6 +1986,7 @@ sub doDiff($$$$$$) {
|
|||
|
||||
if (!open($fh, "-|")) { # child
|
||||
open(STDERR, ">&STDOUT"); # Redirect stderr to stdout
|
||||
openOutputFilter();
|
||||
exec($CMD{rcsdiff}, @difftype, "-r$rev1", "-r$rev2", $fullname);
|
||||
}
|
||||
if ($human_readable) {
|
||||
|
@ -2064,14 +2073,16 @@ sub getDirLogs($$@) {
|
|||
if (defined($tag)) {
|
||||
|
||||
#can't use -r<tag> as - is allowed in tagnames, but misinterpreated by rlog..
|
||||
if (!open($fh, "-|")) {
|
||||
if (!open($fh, "-|")) { # child
|
||||
open(STDERR, '>/dev/null'); # rlog may complain; ignore.
|
||||
openOutputFilter();
|
||||
exec($CMD{rlog}, @files);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!open($fh, "-|")) {
|
||||
if (!open($fh, "-|")) { # child
|
||||
open(STDERR, '>/dev/null'); # rlog may complain; ignore.
|
||||
openOutputFilter();
|
||||
exec($CMD{rlog}, '-r', @files);
|
||||
}
|
||||
}
|
||||
|
@ -2268,8 +2279,10 @@ sub readLog($;$) {
|
|||
print("Going to rlog '$fullname'\n") if ($verbose);
|
||||
if (!open($fh, "-|")) { # child
|
||||
if ($revision ne '') {
|
||||
openOutputFilter();
|
||||
exec($CMD{rlog}, $revision, $fullname);
|
||||
} else {
|
||||
openOutputFilter();
|
||||
exec($CMD{rlog}, $fullname);
|
||||
}
|
||||
}
|
||||
|
@ -3069,7 +3082,7 @@ sub navigateHeader($$$$$) {
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<META name="robots" content="nofollow">
|
||||
<!-- knu-cvsweb $cvsweb_revision -->
|
||||
<!-- FreeBSD-cvsweb $cvsweb_revision -->
|
||||
<TITLE>$path$filename - $title - $rev</TITLE></HEAD>
|
||||
$body_tag_for_src
|
||||
<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="$navigationHeaderColor">
|
||||
|
@ -3295,7 +3308,7 @@ sub download_url($$;$) {
|
|||
&& (!defined($mimetype) || $mimetype ne "text/x-cvsweb-markup"))
|
||||
{
|
||||
my $path = $where;
|
||||
$path =~ s|/[^/]*$|/|;
|
||||
$path =~ s|[^/]+$||;
|
||||
$url = "$scriptname/$checkoutMagic/${path}$url";
|
||||
}
|
||||
$url .= "?rev=$revision";
|
||||
|
@ -3508,7 +3521,7 @@ sub html_header($) {
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
$header
|
||||
<!-- knu-cvsweb $cvsweb_revision -->
|
||||
<!-- FreeBSD-cvsweb $cvsweb_revision -->
|
||||
EOH
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
# 1999 H. Nordstrom <hno@hem.passagen.se>
|
||||
# 2000-2001 A. MUSHA <knu@FreeBSD.org>
|
||||
# based on work by Bill Fenner <fenner@FreeBSD.org>
|
||||
# $Id: cvsweb.conf,v 1.23 2001-11-07 16:32:11 sobomax Exp $
|
||||
#
|
||||
# FreeBSD: projects/cvsweb/cvsweb.conf,v 1.29 2001/10/11 15:20:03 knu Exp
|
||||
# $Id: cvsweb.conf,v 1.24 2001-11-07 21:25:16 knu Exp $
|
||||
# $Idaemons: /home/cvs/cvsweb/cvsweb.conf,v 1.27 2001/08/01 09:48:39 knu Exp $
|
||||
# $FreeBSD$
|
||||
# $FreeBSD: www/en/cgi/cvsweb.conf,v 1.23 2001/11/07 16:32:11 sobomax Exp $
|
||||
#
|
||||
###
|
||||
|
||||
|
@ -387,6 +389,13 @@ $charset = '';
|
|||
# : $where =~ m,/ko[/_-], ? 'x-euc-kr'
|
||||
# : 'iso-8859-1';
|
||||
|
||||
# Output filter
|
||||
$output_filter = '';
|
||||
|
||||
# e.g.
|
||||
## unify/convert Japanese code into EUC-JP
|
||||
#$output_filter= '/usr/local/bin/nkf -e';
|
||||
|
||||
##############
|
||||
# Misc
|
||||
##############
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#
|
||||
# Set up for FreeBSD repo options.
|
||||
#
|
||||
# FreeBSD: projects/cvsweb/cvsweb.conf-freebsd,v 1.7 2001/11/07 20:37:56 knu Exp
|
||||
# $Idaemons: /home/cvs/cvsweb/cvsweb.conf-freebsd,v 1.5 2001/08/01 09:32:22 knu Exp $
|
||||
# $FreeBSD: www/en/cgi/cvsweb.conf-freebsd,v 1.7 2001/01/14 08:59:59 knu Exp $
|
||||
# $FreeBSD: www/en/cgi/cvsweb.conf-freebsd,v 1.8 2001/08/01 10:41:47 knu Exp $
|
||||
|
||||
if ($uname eq 'FreeBSD') {
|
||||
$ENV{'RCSLOCALID'} = 'FreeBSD=CVSHeader';
|
||||
|
@ -34,7 +35,7 @@ $prkeyword = "PR";
|
|||
$mancgi =
|
||||
"http://www.FreeBSD.org/cgi/man.cgi?apropos=0&sektion=%s&query=%s&manpath=FreeBSD+5.0-current&format=html";
|
||||
|
||||
# Allow downloading a tarball of a port
|
||||
$allow_tar = ($where =~ m,^ports/[^/]+/[^/]+/,);
|
||||
# Allow downloading a tarball of a port or a project directory
|
||||
$allow_tar = ($where =~ m,^(ports/[^/]+/[^/]+/|projects/[^/]+/),);
|
||||
|
||||
1;
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#
|
||||
# Set up for NetBSD repo options.
|
||||
#
|
||||
# FreeBSD: projects/cvsweb/cvsweb.conf-netbsd,v 1.6 2001/10/11 15:15:12 knu Exp
|
||||
# $Idaemons: /home/cvs/cvsweb/cvsweb.conf-netbsd,v 1.5 2001/08/01 09:32:22 knu Exp $
|
||||
# $FreeBSD: www/en/cgi/cvsweb.conf-netbsd,v 1.8 2001/01/14 08:59:59 knu Exp $
|
||||
# $FreeBSD: www/en/cgi/cvsweb.conf-netbsd,v 1.9 2001/08/01 10:41:47 knu Exp $
|
||||
|
||||
if ($uname eq 'FreeBSD') {
|
||||
$ENV{'RCSLOCALID'} = 'NetBSD=CVSHeader';
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#
|
||||
# Set up for OpenBSD repo options.
|
||||
#
|
||||
# FreeBSD: projects/cvsweb/cvsweb.conf-openbsd,v 1.6 2001/10/11 15:15:12 knu Exp
|
||||
# $Idaemons: /home/cvs/cvsweb/cvsweb.conf-openbsd,v 1.5 2001/08/01 09:32:22 knu Exp $
|
||||
# $FreeBSD: www/en/cgi/cvsweb.conf-openbsd,v 1.6 2001/01/14 08:59:59 knu Exp $
|
||||
# $FreeBSD: www/en/cgi/cvsweb.conf-openbsd,v 1.7 2001/08/01 10:41:47 knu Exp $
|
||||
|
||||
if ($uname eq 'FreeBSD') {
|
||||
$ENV{'RCSLOCALID'} = 'OpenBSD=CVSHeader';
|
||||
|
|
Loading…
Reference in a new issue