]> git.ipfire.org Git - thirdparty/curl.git/commit
tests/servers.pm: pick unused port number with a server socket
authorDaniel Stenberg <daniel@haxx.se>
Mon, 29 May 2023 18:25:09 +0000 (20:25 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 31 May 2023 12:00:47 +0000 (14:00 +0200)
commit4efa0b5749bb7c366e1c3bda90650ef864d3978e
treefdf6bd3b2309774b5cbcccb0f01c29f4c85194e7
parent10413994d6713eefbeb022667d9f33f1e308c117
tests/servers.pm: pick unused port number with a server socket

This change replaces the previous method of picking a port number at
random to try to start servers on, then retrying up to ten times with
new random numbers each time, with a function that creates a server
socket on port zero, thereby getting a suitable random port set by the
kernel. That server socket is then closed and that port number is used
to setup the actual test server on.

There is a risk that *another* server can be started on the machine in
the time gap, but the server verification feature will detect that.

Closes #11220
tests/servers.pm