Re: [PATCH] http: fix v1 protocol tests with apache httpd < 2.4
- From
Jeff King <peff@peff.net>
- Date
- Jan 3, 2018, 06:17 UTC
- Message-ID
- <20180103061703.GB25752@sigill.intra.peff.net>
- In-Reply-To
- <20180103003946.GC12108@zaya.teonanacatl.net>
On Tue, Jan 02, 2018 at 07:39:46PM -0500, Todd Zullinger wrote:
Show 15 quoted lines
> Brandon Williams wrote: > > Seems good to me. I think I was just being overly cautious when i was > > implementing those patches. Thanks! > > Cool, thanks for taking a look. > > In this case, the test isn't dependent on apache > 2.4, but > before I checked that I wondered if we had any way to run a > test only if the apache version was greater or lesser than > some release. Luckily, I didn't have to work out such a > method. :) > > I don't know if there's a clean way to do that > automatically, short of parsing the output of 'httpd -v' > should we ever need to add such a prereq.
In the general case, we could probably define an endpoint within an <If> block, and then try to access the endpoint from the test script.
E.g., something like:
<IfVersion >= 2.4>
Alias /have-2.4.txt www/yes.txt
</IfVersion>in the apache config, and then:
test_lazy_prereq APACHE24 '
echo yes >"$HTTPD_DOCUMENT_ROOT_PATH/yes.txt" &&
curl -f "$HTTPD_URL/have-2.4.txt"
'in the test script (of course we may not want to depend on having command-line curl, but we could replace that with "git ls-remote" or similar).
One nice thing about that approach is that it can be extended to other "If" blocks, like if we have a particular module available, or if ssl is configured.
-Peff