summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-01-03 13:33:46 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-01-03 22:32:05 +0100
commitd2f712ddd0f76490f85b79f0cbd2b5669a9ecb00 (patch)
tree18a572cd6f7eee88423907ffe8d3c73d046c5199
parent61cbb4b626af761a58f15d81899bfee7ed5e8944 (diff)
downloadcurl-d2f712ddd0f76490f85b79f0cbd2b5669a9ecb00.tar.gz
runtests: add verify/socks check
If used, this data is compared with the data in log/socksd-request.log which the socksd server logs. Added to FILEFORMAT.md
-rw-r--r--tests/FILEFORMAT.md3
-rwxr-xr-xtests/runtests.pl12
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/FILEFORMAT.md b/tests/FILEFORMAT.md
index 1c45d1563..bfd5d221e 100644
--- a/tests/FILEFORMAT.md
+++ b/tests/FILEFORMAT.md
@@ -243,6 +243,9 @@ The connect section is used instead of the 'data' for all CONNECT
requests. The remainder of the rules for the data section then apply but with
a connect prefix.
+### `<socks>`
+Address type and address details as logged by the SOCKS proxy.
+
### `<datacheck [mode="text"] [nonewline="yes"]>`
if the data is sent but this is what should be checked afterwards. If
`nonewline=yes` is set, runtests will cut off the trailing newline from the
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 7f3b20c14..7ac22035b 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -185,6 +185,7 @@ my $UNITDIR="./unit";
my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server
my $SERVER2IN="$LOGDIR/server2.input"; # what curl sent the second server
my $PROXYIN="$LOGDIR/proxy.input"; # what curl sent the proxy
+my $SOCKSIN="$LOGDIR/socksd-request.log"; # what curl sent to the SOCKS proxy
my $CURLLOG="commands.log"; # all command lines run
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy server instructions here
my $SERVERLOGS_LOCK="$LOGDIR/serverlogs.lock"; # server logs advisor read lock
@@ -4586,6 +4587,17 @@ sub singletest {
}
$ok .= ($outputok) ? "o" : "-"; # output checked or not
+ # verify SOCKS proxy details
+ my @socksprot = getpart("verify", "socks");
+ if(@socksprot) {
+ # Verify the sent SOCKS proxy details
+ my @out = loadarray($SOCKSIN);
+ $res = compare($testnum, $testname, "socks", \@out, \@socksprot);
+ if($res) {
+ return $errorreturncode;
+ }
+ }
+
# accept multiple comma-separated error codes
my @splerr = split(/ *, */, $errorcode);
my $errok;