From 654dd079e8f78443f2c4eafac9431b77d019fb71 Mon Sep 17 00:00:00 2001 From: cjwatson <> Date: Sun, 21 Sep 2003 20:30:40 -0800 Subject: [PATCH] [project @ 2003-09-21 21:30:40 by cjwatson] Reduce noise when running from the command line without all the CGI environment variables set. --- cgi/common.pl | 2 ++ cgi/pkgreport.cgi | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cgi/common.pl b/cgi/common.pl index 4ab1cc42..63f0db0f 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -46,6 +46,7 @@ sub contains_field_match { sub detect_user_agent { my $userAgent = $ENV{HTTP_USER_AGENT}; + return { 'name' => 'unknown' } unless defined $userAgent; return { 'name' => 'links' } if ( $userAgent =~ m,^ELinks,); return { 'name' => 'lynx' } if ( $userAgent =~ m,^Lynx,); return { 'name' => 'wget' } if ( $userAgent =~ m,^Wget,); @@ -53,6 +54,7 @@ sub detect_user_agent { return { 'name' => 'ie' } if ( $userAgent =~ m,^.*MSIE.*,); return { 'name' => 'unknown' }; } + my %field_match = ( 'subject' => \&contains_field_match, 'tags' => sub { diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index 0d1fc7f7..6eaa7004 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -13,7 +13,7 @@ require '/etc/debbugs/text'; use vars qw($gPackagePages $gWebDomain); -if ($ENV{REQUEST_METHOD} eq 'HEAD') { +if (defined $ENV{REQUEST_METHOD} and $ENV{REQUEST_METHOD} eq 'HEAD') { print "Content-Type: text/html\n\n"; exit 0; } -- 2.39.5