1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-23 16:48:49 -05:00

tests: add %NOLISTENPORT and use it

The purpose with this variable is to provide a port number that is
reasonably likely to not have a listener on the local host so that tests
can try connect failures against it. It uses port 47 - "reserved"
according to IANA.

Updated six tests to use it instead of the previous different ports.

Assisted-by: Emil Engler
Closes #5270
This commit is contained in:
Daniel Stenberg 2020-04-20 10:21:57 +02:00
parent 093a9e0014
commit 018dd775c8
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
8 changed files with 9 additions and 6 deletions

View File

@ -365,6 +365,7 @@ Available substitute variables include:
- `%IMAPPORT` - Port number of the IMAP server - `%IMAPPORT` - Port number of the IMAP server
- `%MQTTPORT` - Port number of the MQTT server - `%MQTTPORT` - Port number of the MQTT server
- `%NEGTELNETPORT` - Port number of the telnet server - `%NEGTELNETPORT` - Port number of the telnet server
- `%NOLISTENPORT` - Port number where no service is listening
- `%POP36PORT` - IPv6 port number of the POP3 server - `%POP36PORT` - IPv6 port number of the POP3 server
- `%POP3PORT` - Port number of the POP3 server - `%POP3PORT` - Port number of the POP3 server
- `%POSIX_PWD` - Current directory somewhat mingw friendly - `%POSIX_PWD` - Current directory somewhat mingw friendly

View File

@ -24,7 +24,7 @@ http
attempt connect to non-listening socket attempt connect to non-listening socket
</name> </name>
<command> <command>
%HOSTIP:2 %HOSTIP:%NOLISTENPORT
</command> </command>
</client> </client>

View File

@ -32,7 +32,7 @@ lib504
simple multi through local proxy without listener simple multi through local proxy without listener
</name> </name>
<command> <command>
http://%HOSTIP:%HTTPSPORT/504 %HOSTIP:55555 http://%HOSTIP:%HTTPSPORT/504 %HOSTIP:%NOLISTENPORT
</command> </command>
</client> </client>

View File

@ -31,7 +31,7 @@ proxy
Attempt connect to non-listening HTTP server via SOCKS4 proxy Attempt connect to non-listening HTTP server via SOCKS4 proxy
</name> </name>
<command> <command>
--socks4 %HOSTIP:%SOCKSPORT http://%HOSTIP:60000 --socks4 %HOSTIP:%SOCKSPORT http://%HOSTIP:%NOLISTENPORT
</command> </command>
</client> </client>

View File

@ -31,7 +31,7 @@ proxy
Attempt connect to non-listening HTTP server via SOCKS5 proxy Attempt connect to non-listening HTTP server via SOCKS5 proxy
</name> </name>
<command> <command>
--socks5 %HOSTIP:%SOCKSPORT http://%HOSTIP:60000 --socks5 %HOSTIP:%SOCKSPORT http://%HOSTIP:%NOLISTENPORT
</command> </command>
</client> </client>

View File

@ -23,7 +23,7 @@ http
Attempt connect to non-listening SOCKS4 proxy Attempt connect to non-listening SOCKS4 proxy
</name> </name>
<command> <command>
--socks4 %HOSTIP:2 http://%HOSTIP:%HTTPPORT/704 --socks4 %HOSTIP:%NOLISTENPORT http://%HOSTIP:%HTTPPORT/704
</command> </command>
<features> <features>
proxy proxy

View File

@ -23,7 +23,7 @@ http
Attempt connect to non-listening SOCKS5 proxy Attempt connect to non-listening SOCKS5 proxy
</name> </name>
<command> <command>
--socks5 %HOSTIP:2 http://%HOSTIP:%HTTPPORT/705 --socks5 %HOSTIP:%NOLISTENPORT http://%HOSTIP:%HTTPPORT/705
</command> </command>
<features> <features>
proxy proxy

View File

@ -126,6 +126,7 @@ my $maxport; # maximum used port number
my $noport="[not running]"; my $noport="[not running]";
my $NOLISTENPORT=47; # port number we use for a local non-listening service
my $MQTTPORT=$noport; # MQTT server port my $MQTTPORT=$noport; # MQTT server port
my $HTTPPORT=$noport; # HTTP server port my $HTTPPORT=$noport; # HTTP server port
my $HTTP6PORT=$noport; # HTTP IPv6 server port my $HTTP6PORT=$noport; # HTTP IPv6 server port
@ -3229,6 +3230,7 @@ sub subVariables {
$$thing =~ s/${prefix}SMBPORT/$SMBPORT/g; $$thing =~ s/${prefix}SMBPORT/$SMBPORT/g;
$$thing =~ s/${prefix}SMBSPORT/$SMBSPORT/g; $$thing =~ s/${prefix}SMBSPORT/$SMBSPORT/g;
$$thing =~ s/${prefix}NEGTELNETPORT/$NEGTELNETPORT/g; $$thing =~ s/${prefix}NEGTELNETPORT/$NEGTELNETPORT/g;
$$thing =~ s/${prefix}NOLISTENPORT/$NOLISTENPORT/g;
# server Unix domain socket paths # server Unix domain socket paths
$$thing =~ s/${prefix}HTTPUNIXPATH/$HTTPUNIXPATH/g; $$thing =~ s/${prefix}HTTPUNIXPATH/$HTTPUNIXPATH/g;