httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Benson <gben...@redhat.com>
Subject Improvement to httpd version detection
Date Wed, 08 Aug 2001 12:45:31 GMT

Hi all,

The code that parses "httpd -v" fails when the first item in the server
version line is not "Apache/x.y.z". This affects Stronghold (which reports
itself as "Stronghold/n.m Apache/x.y.z (Unix)") and possible other things
as well.

Anyway, here is a patch to fix it. It looks for the "Apache/" in the
server version string and returns that. If this isn't found then it
reverts to the previous behaviour and returns the first element of server
version.

Hope it's suitable,
Gary

[ Gary Benson, Red Hat Europe ][ gbenson@redhat.com ][ GnuPG 60E8793A ]


Index: perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm
===================================================================
RCS file:
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm,v
retrieving revision 1.4
diff -u -r1.4 TestConfigParse.pm
--- perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm	2001/05/08
05:17:24	1.4
+++ perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm	2001/08/08
12:38:55
@@ -226,7 +226,13 @@
     while (<$v>) {
         next unless s/^Server\s+version:\s*//i;
         chomp;
-        $version = (split)[0];
+        my @parts = split;
+        foreach (@parts) {
+            next unless /^Apache\//;
+            $version = $_;
+            last;
+        }
+        $version or $version = $parts[0];
         last;
     }


Mime
View raw message