Print better warnings to users if the port does not
exists. Print the HTTP_REFERER if available.
This commit is contained in:
parent
23961638f3
commit
4934536b76
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=11406
1 changed files with 18 additions and 4 deletions
|
@ -26,7 +26,7 @@
|
|||
#
|
||||
# url.cgi - make plain text URLs clickable
|
||||
#
|
||||
# $FreeBSD: www/en/cgi/url.cgi,v 1.28 2000/12/29 10:49:45 wosch Exp $
|
||||
# $FreeBSD: www/en/cgi/url.cgi,v 1.29 2001/03/11 20:45:45 wosch Exp $
|
||||
|
||||
use strict;
|
||||
|
||||
|
@ -78,10 +78,24 @@ if ($file =~ m%^ports/[\w-]+/\w[\w-+.]*/pkg-descr% && -f "$cvsroot/$file,v") {
|
|||
}
|
||||
|
||||
else {
|
||||
print "<p>The port specified does not exist, or has an invalid name: ",
|
||||
"$file\n";
|
||||
print "<p>The port specified does not exist, or has an invalid name: <p>",
|
||||
"<blockquote>$file</blockquote>\n";
|
||||
|
||||
# Server environment variables
|
||||
my $http_referer = $ENV{'HTTP_REFERER'};
|
||||
|
||||
# rfc1738 says that ";"|"/"|"?"|":"|"@"|"&"|"=" may be reserved.
|
||||
$http_referer =~ s/([^a-zA-Z0-9;\/?:&=])/sprintf("%%%02x",ord($1))/eg;
|
||||
|
||||
if ($http_referer) {
|
||||
print qq{<p>You are coming from
|
||||
<blockquote>
|
||||
<a href="$http_referer">$http_referer</a>.
|
||||
</blockquote>
|
||||
<p>\n};
|
||||
}
|
||||
print "<p>Please contact www\@freebsd.org\n";
|
||||
warn "$0: invalid port name: `$file'\n";
|
||||
warn "$0: invalid port name: `$file', $http_referer\n";
|
||||
}
|
||||
print "\n<HR>\n<pre>\n";
|
||||
|
||||
|
|
Loading…
Reference in a new issue