mirror of
https://github.com/curl/curl.git
synced 2025-09-11 14:42:40 +03:00
tests: make precheck for HTTP on 127.0.0.1 into a feature
It can now be required easily in <features> instead of having perl code in a <precheck>. Closes #15039
This commit is contained in:
parent
56183c1d6f
commit
7aa2b4e01f
|
@ -456,6 +456,7 @@ Features testable here are:
|
|||
- `libssh`
|
||||
- `oldlibssh` (versions before 0.9.4)
|
||||
- `libz`
|
||||
- `local-http`. The HTTP server runs on 127.0.0.1
|
||||
- `manual`
|
||||
- `mbedtls`
|
||||
- `Mime`
|
||||
|
|
|
@ -37,11 +37,9 @@ HTTP with cookie parser and header recording
|
|||
<command>
|
||||
"http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER?parm1=this*that/other/thing&parm2=foobar/%TESTNUMBER" -c %LOGDIR/cookie%TESTNUMBER.txt -d "userid=myname&password=mypassword"
|
||||
</command>
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
<features>
|
||||
cookies
|
||||
local-http
|
||||
</features>
|
||||
</client>
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ MooMoo
|
|||
SSL
|
||||
SSLpinning
|
||||
Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -41,10 +42,6 @@ CURL_SSL_BACKEND=schannel
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.pub.der --ssl-revoke-best-effort https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -27,6 +27,7 @@ MooMoo
|
|||
SSL
|
||||
SSLpinning
|
||||
!Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -37,10 +38,6 @@ simple HTTPS GET with DER public key pinning
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.pub.der https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -18,6 +18,7 @@ PEM certificate
|
|||
<features>
|
||||
SSL
|
||||
SSLpinning
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -28,10 +29,6 @@ HTTPS wrong DER pinnedpubkey but right CN
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.der https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -27,6 +27,7 @@ MooMoo
|
|||
SSL
|
||||
SSLpinning
|
||||
!Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -37,10 +38,6 @@ simple HTTPS GET with PEM public key pinning
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.pub.pem https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -18,6 +18,7 @@ PEM certificate
|
|||
<features>
|
||||
SSL
|
||||
SSLpinning
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -28,10 +29,6 @@ HTTPS wrong PEM pinnedpubkey but right CN
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.pem https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -27,6 +27,7 @@ MooMoo
|
|||
SSL
|
||||
SSLpinning
|
||||
!Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -37,10 +38,6 @@ simple HTTPS GET with base64-sha256 public key pinning
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey sha256//%sha256b64file[%SRCDIR/certs/Server-localhost-sv.pub.der]sha256b64file% https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -18,6 +18,7 @@ PEM certificate
|
|||
<features>
|
||||
SSL
|
||||
SSLpinning
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -28,10 +29,6 @@ HTTPS wrong base64-sha256 pinnedpubkey but right CN
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey sha256//bSIggTf+ikMG0CtmDlpMVBd7yi7H1md4URogRPqerso= https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -26,6 +26,7 @@ MooMoo
|
|||
<features>
|
||||
SSL
|
||||
Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -40,10 +41,6 @@ CURL_SSL_BACKEND=schannel
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --ssl-revoke-best-effort https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -27,6 +27,7 @@ MooMoo
|
|||
SSL
|
||||
SSLpinning
|
||||
Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -41,10 +42,6 @@ CURL_SSL_BACKEND=schannel
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.pub.pem --ssl-revoke-best-effort https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -27,6 +27,7 @@ MooMoo
|
|||
SSL
|
||||
SSLpinning
|
||||
Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -41,10 +42,6 @@ CURL_SSL_BACKEND=schannel
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey sha256//%sha256b64file[%SRCDIR/certs/Server-localhost-sv.pub.der]sha256b64file% --ssl-revoke-best-effort https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -26,6 +26,7 @@ MooMoo
|
|||
<features>
|
||||
SSL
|
||||
!Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-firstSAN-sv.pem
|
||||
|
@ -36,10 +37,6 @@ HTTPS GET to localhost, first subject alt name matches, CN does not match
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -26,6 +26,7 @@ MooMoo
|
|||
<features>
|
||||
SSL
|
||||
!Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-lastSAN-sv.pem
|
||||
|
@ -36,10 +37,6 @@ HTTPS GET to localhost, last subject alt name matches, CN does not match
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -26,6 +26,7 @@ MooMoo
|
|||
<features>
|
||||
SSL
|
||||
Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-firstSAN-sv.pem
|
||||
|
@ -40,10 +41,6 @@ CURL_SSL_BACKEND=schannel
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --ssl-revoke-best-effort https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -26,6 +26,7 @@ MooMoo
|
|||
<features>
|
||||
SSL
|
||||
Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-lastSAN-sv.pem
|
||||
|
@ -40,10 +41,6 @@ CURL_SSL_BACKEND=schannel
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --ssl-revoke-best-effort https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -144,11 +144,9 @@ TZ=GMT
|
|||
<command>
|
||||
http://test31.curl:%HTTPPORT/we/want/%TESTNUMBER -b none -c %LOGDIR/jar%TESTNUMBER.txt --resolve test31.curl:%HTTPPORT:127.0.0.1
|
||||
</command>
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
<features>
|
||||
cookies
|
||||
local-http
|
||||
</features>
|
||||
</client>
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ MooMoo
|
|||
<features>
|
||||
SSL
|
||||
!Schannel
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -36,10 +37,6 @@ simple HTTPS GET
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -17,6 +17,7 @@ PEM certificate
|
|||
<client>
|
||||
<features>
|
||||
SSL
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost0h-sv.pem
|
||||
|
@ -27,10 +28,6 @@ HTTPS wrong subjectAltName but right CN
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -17,6 +17,7 @@ PEM certificate
|
|||
<client>
|
||||
<features>
|
||||
SSL
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost.nn-sv.pem
|
||||
|
@ -27,10 +28,6 @@ HTTPS GET to localhost and null-prefixed CN cert
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -13,6 +13,7 @@ CRL
|
|||
<client>
|
||||
<features>
|
||||
SSL
|
||||
local-http
|
||||
</features>
|
||||
<server>
|
||||
https Server-localhost-sv.pem
|
||||
|
@ -23,10 +24,6 @@ CRL test
|
|||
<command>
|
||||
--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --crlfile %SRCDIR/certs/Server-localhost-sv.crl https://localhost:%HTTPSPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost because we're checking the host name
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -31,6 +31,9 @@ Funny-head: yesyes
|
|||
<server>
|
||||
http
|
||||
</server>
|
||||
<features>
|
||||
local-http
|
||||
</features>
|
||||
<name>
|
||||
*.localhost is a local host
|
||||
</name>
|
||||
|
@ -38,9 +41,6 @@ http
|
|||
http://curlmachine.localhost:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
# Ensure that we're running on localhost
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
|
|
|
@ -37,11 +37,9 @@ TZ=GMT
|
|||
<command>
|
||||
http://localhost:%HTTPPORT/%TESTNUMBER -b none http://localhost:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
<precheck>
|
||||
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
||||
</precheck>
|
||||
<features>
|
||||
cookies
|
||||
local-http
|
||||
</features>
|
||||
</client>
|
||||
|
||||
|
|
|
@ -824,6 +824,7 @@ sub checksystemfeatures {
|
|||
$feature{"xattr"} = 1;
|
||||
$feature{"large-time"} = 1;
|
||||
$feature{"sha512-256"} = 1;
|
||||
$feature{"local-http"} = servers::localhttp();
|
||||
|
||||
# make each protocol an enabled "feature"
|
||||
for my $p (@protocols) {
|
||||
|
|
|
@ -59,6 +59,7 @@ BEGIN {
|
|||
stopserver
|
||||
stopservers
|
||||
subvariables
|
||||
localhttp
|
||||
),
|
||||
|
||||
# for debugging only
|
||||
|
@ -3040,5 +3041,8 @@ sub subvariables {
|
|||
$$thing =~ s/${prefix}H2CVER/$h2cver/g;
|
||||
}
|
||||
|
||||
sub localhttp {
|
||||
return $HOSTIP eq "127.0.0.1";
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user