]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: add %NOLISTENPORT and use it
authorDaniel Stenberg <daniel@haxx.se>
Mon, 20 Apr 2020 08:21:57 +0000 (10:21 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 20 Apr 2020 20:38:05 +0000 (22:38 +0200)
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

tests/FILEFORMAT.md
tests/data/test19
tests/data/test504
tests/data/test702
tests/data/test703
tests/data/test704
tests/data/test705
tests/runtests.pl

index 586b84b743616010a1bec8bd7781330cac7a4664..034b1a73c10cfdceac526a2de487fcf3e4830088 100644 (file)
@@ -365,6 +365,7 @@ Available substitute variables include:
 - `%IMAPPORT` - Port number of the IMAP server
 - `%MQTTPORT` - Port number of the MQTT server
 - `%NEGTELNETPORT` - Port number of the telnet server
+- `%NOLISTENPORT` - Port number where no service is listening
 - `%POP36PORT` - IPv6 port number of the POP3 server
 - `%POP3PORT` - Port number of the POP3 server
 - `%POSIX_PWD` - Current directory somewhat mingw friendly
index 8e1bf5eb42f6f49d6187fceb519f30ea896ab591..f053baf08b1d305b83fb815d11b5a0050a152e94 100644 (file)
@@ -24,7 +24,7 @@ http
 attempt connect to non-listening socket
  </name>
  <command>
-%HOSTIP:2
+%HOSTIP:%NOLISTENPORT
 </command>
 </client>
 
index 7c92209cd87da54a14d6087bea3888a44c3819a3..be8f95e2bbd571e9d609c7d15d87417bbca23126 100644 (file)
@@ -32,7 +32,7 @@ lib504
 simple multi through local proxy without listener
  </name>
  <command>
-http://%HOSTIP:%HTTPSPORT/504 %HOSTIP:55555
+http://%HOSTIP:%HTTPSPORT/504 %HOSTIP:%NOLISTENPORT
 </command>
 </client>
 
index c03723676d513b525157f3a2b90d68f4ccb6294f..1c18d097697505193741697be76a8491e5dcf074 100644 (file)
@@ -31,7 +31,7 @@ proxy
 Attempt connect to non-listening HTTP server via SOCKS4 proxy
  </name>
  <command>
---socks4 %HOSTIP:%SOCKSPORT http://%HOSTIP:60000
+--socks4 %HOSTIP:%SOCKSPORT http://%HOSTIP:%NOLISTENPORT
 </command>
 </client>
 
index 53d6a022239468d4dd1013c432a562a011c2e30f..d7be71393ced7354e29f6e7186f3d63cba0582d9 100644 (file)
@@ -31,7 +31,7 @@ proxy
 Attempt connect to non-listening HTTP server via SOCKS5 proxy
  </name>
  <command>
---socks5 %HOSTIP:%SOCKSPORT http://%HOSTIP:60000
+--socks5 %HOSTIP:%SOCKSPORT http://%HOSTIP:%NOLISTENPORT
 </command>
 </client>
 
index 7f891fa9503b1e6a49c3faedbaffc7bf2632ecfc..9e821c6084b924ee9f2c00907555bd6925d5017a 100644 (file)
@@ -23,7 +23,7 @@ http
 Attempt connect to non-listening SOCKS4 proxy
  </name>
  <command>
---socks4 %HOSTIP:2 http://%HOSTIP:%HTTPPORT/704
+--socks4 %HOSTIP:%NOLISTENPORT http://%HOSTIP:%HTTPPORT/704
 </command>
 <features>
 proxy
index cfbf3419fba2194fd6e5f4eb3a9e9817fa316711..e7ba01220493a332fd643bcca06f263658e386d1 100644 (file)
@@ -23,7 +23,7 @@ http
 Attempt connect to non-listening SOCKS5 proxy
  </name>
  <command>
---socks5 %HOSTIP:2 http://%HOSTIP:%HTTPPORT/705
+--socks5 %HOSTIP:%NOLISTENPORT http://%HOSTIP:%HTTPPORT/705
 </command>
 <features>
 proxy
index cd22cd3f7af50cb01a49811621cdd4ba4a9247d5..cfc2c86948cd77752c999b2c16009b885fafa0b7 100755 (executable)
@@ -126,6 +126,7 @@ my $maxport;     # maximum used port number
 
 my $noport="[not running]";
 
+my $NOLISTENPORT=47;     # port number we use for a local non-listening service
 my $MQTTPORT=$noport;    # MQTT server port
 my $HTTPPORT=$noport;    # HTTP server port
 my $HTTP6PORT=$noport;   # HTTP IPv6 server port
@@ -3229,6 +3230,7 @@ sub subVariables {
     $$thing =~ s/${prefix}SMBPORT/$SMBPORT/g;
     $$thing =~ s/${prefix}SMBSPORT/$SMBSPORT/g;
     $$thing =~ s/${prefix}NEGTELNETPORT/$NEGTELNETPORT/g;
+    $$thing =~ s/${prefix}NOLISTENPORT/$NOLISTENPORT/g;
 
     # server Unix domain socket paths
     $$thing =~ s/${prefix}HTTPUNIXPATH/$HTTPUNIXPATH/g;