1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-01 22:05:08 +00:00
freebsd-ports/www/webglimpse/files/patch-ak

143 lines
3.8 KiB
Plaintext
Raw Normal View History

1998-11-02 20:04:30 +00:00
--- cgi-bin/webglimpse.orig Mon Jul 27 22:59:49 1998
1998-11-03 10:34:42 +00:00
+++ cgi-bin/webglimpse Tue Nov 3 13:15:40 1998
1998-11-02 20:04:30 +00:00
@@ -39,6 +39,9 @@
# **** **** **** **** CONFIGURABLE VARIABLES **** **** **** ****
# We need some of these to find our libraries, so wrap them in a BEGIN block
+use POSIX qw(locale_h);
+use locale;
+
BEGIN{
$WEBGLIMPSE_HOME = "/usr/local/webglimpse";
1998-11-03 07:11:28 +00:00
@@ -117,16 +120,21 @@
1998-11-02 20:04:30 +00:00
# Added optional module to support result caching
$QS_cache = '';
+$charset = '';
+$put_header = 0;
+
# **** **** **** **** Done settings **** **** **** ****
-BEGIN {
+sub http_header {
+
+return if ($put_header);
+$put_header = 1;
+
# make the output as we can
$| = 1;
# might as well start the message now
-print "Content-type: text/html\n\n";
1998-11-03 07:11:28 +00:00
-
-print "<!-- TESTING -->\n";
1998-11-02 20:04:30 +00:00
+print "Content-type: text/html$charset\n\n";
1998-11-03 07:11:28 +00:00
}
1998-11-02 20:04:30 +00:00
1998-11-03 07:11:28 +00:00
@@ -216,10 +224,20 @@
1998-11-02 20:04:30 +00:00
$nhhops = 0;
$traverse_type = 0;
$urlpath = '';
+$vhost = '';
+$usemaxmem = '';
+$locale = '';
@urllist = ();
($title, $urlpath, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, @urllist) = ReadConfig($indexdir);
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) = ReadConfig($indexdir);
+
1998-11-03 18:44:04 +00:00
+$ENV{LC_CTYPE}=$locale if ($locale ne '');
1998-11-02 20:04:30 +00:00
+setlocale(LC_CTYPE, "");
+
+$charset = "; charset=$charset" if ($charset ne '');
+
+&http_header;
# Ensure that Glimpse is available on this machine
-x $GLIMPSE_LOC || &err_noglimpse($GLIMPSE_LOC) ;
1998-11-03 10:34:42 +00:00
@@ -510,7 +528,7 @@
$charcount = 0;
if ($fcount>=$maxfiles) {
- print $mOutput->limitMaxFiles($maxfiles);
+ $mOutput->limitMaxFiles($maxfiles);
$file = "";
# Keep the real # of lines retrieved! The "at least" message can be in the output module.
1998-11-03 07:11:28 +00:00
@@ -667,7 +685,7 @@
1998-11-02 20:04:30 +00:00
sub err_noneighborhood {
local($_) = @_;
-
+ &http_header;
# neighborhood does not exist
print <<EOM;
<hr>
1998-11-03 07:11:28 +00:00
@@ -683,6 +701,7 @@
1998-11-02 20:04:30 +00:00
##########################################################################
sub err_noquery {
+ &http_header;
# The script was called without a query.
# Provide an ISINDEX type response for browsers
# without form support.
1998-11-03 07:11:28 +00:00
@@ -732,6 +751,7 @@
1998-11-02 20:04:30 +00:00
##########################################################################
sub err_noglimpse {
local($_) = @_;
+ &http_header;
#
# Glimpse was not found
# Report a useful message
1998-11-03 07:11:28 +00:00
@@ -756,6 +776,7 @@
1998-11-02 20:04:30 +00:00
##########################################################################
sub err_badglimpse {
my(@glines) = @_;
+ &http_header;
#
# Glimpse had an error
# Report a useful message
1998-11-03 07:11:28 +00:00
@@ -786,6 +807,7 @@
1998-11-02 20:04:30 +00:00
##########################################################################
sub err_noindex {
local ($indexdir) = @_;
+ &http_header;
# Glimpse index was not found
# Give recommendations for indexing
print "<TITLE>Glimpse Index not found</TITLE>\n";
1998-11-03 07:11:28 +00:00
@@ -801,6 +823,7 @@
1998-11-02 20:04:30 +00:00
}
##########################################################################
sub err_insecurepath {
+ &http_header;
# Path user requested contains ".." characters
print "<TITLE>Path not accepted</TITLE>\n";
print "</HEAD>\n";
1998-11-03 07:11:28 +00:00
@@ -814,6 +837,7 @@
1998-11-02 20:04:30 +00:00
##########################################################################
sub err_conf {
+ &http_header;
# Glimpse archive Configuration File was not found
print "<TITLE>Glimpse Archive Configuration File not found</TITLE>\n";
print "</HEAD>\n";
1998-11-03 07:11:28 +00:00
@@ -827,6 +851,7 @@
1998-11-02 20:04:30 +00:00
##########################################################################
sub err_badquery {
+ &http_header;
print "<TITLE>Query is too broad</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
1998-11-03 07:11:28 +00:00
@@ -840,6 +865,7 @@
1998-11-02 20:04:30 +00:00
##########################################################################
sub err_locked {
+ &http_header;
print "<TITLE>Indexing in progress</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";