You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Gary Benson <gb...@redhat.com> on 2001/08/08 14:45:31 UTC
Improvement to httpd version detection
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;
}