https://github.com/curl/curl/commit/f1d09231adfc695d15995b9ef2c8c6e568c28091 Author: Stefan Eissing Date: Tue Feb 14 14:29:13 2023 +0100 tests: make the telnet server shut down a socket gracefully - test 1452 failed occasionally with ECONNRESET errnos in curl when the server closed the connection in an unclean state. Closes #10509 --- a/tests/negtelnetserver.py +++ b/tests/negtelnetserver.py @@ -29,7 +29,9 @@ from __future__ import (absolute_import, division, print_function, import argparse import logging import os +import socket import sys +import time from util import ClosingFileHandler @@ -90,7 +92,7 @@ class NegotiatingTelnetHandler(socketserver.BaseRequestHandler): neg.send_wont("NAWS") # Get the data passed through the negotiator - data = neg.recv(1024) + data = neg.recv(4*1024) log.debug("Incoming data: %r", data) if VERIFIED_REQ.encode('utf-8') in data: @@ -109,6 +111,12 @@ class NegotiatingTelnetHandler(socketserver.BaseRequestHandler): log.debug("Sending %r", response_data) self.request.sendall(response_data) + # put some effort into making a clean socket shutdown + # that does not give the client ECONNRESET + self.request.settimeout(0.1) + self.request.recv(4*1024) + self.request.shutdown(socket.SHUT_RDWR) + except IOError: log.exception("IOError hit during request") https://github.com/curl/curl/commit/2fdc1d816ebf3c77f43068103bec1b3a3767881a Author: Daniel Stenberg Date: Wed Feb 15 15:04:07 2023 +0100 tests: make sure gnuserv-tls has SRP support before using it Reported-by: fundawang on github Fixes #10522 Closes #10524 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -5382,7 +5382,7 @@ sub startservers { elsif($what eq "httptls") { if(!$httptlssrv) { # for now, we can't run http TLS-EXT tests without gnutls-serv - return "no gnutls-serv"; + return "no gnutls-serv (with SRP support)"; } if($torture && $run{'httptls'} && !responsive_httptls_server($verbose, "IPv4")) { --- a/tests/sshhelp.pm +++ b/tests/sshhelp.pm @@ -408,7 +408,16 @@ sub find_sshkeygen { # Find httptlssrv (gnutls-serv) and return canonical filename # sub find_httptlssrv { - return find_exe_file_hpath($httptlssrvexe); + my $p = find_exe_file_hpath($httptlssrvexe); + my @o = `$p -l`; + my $found; + for(@o) { + if(/Key exchange: SRP/) { + $found = 1; + last; + } + } + return $p if($found); } https://github.com/curl/curl/commit/79d0b3c0c0bb00829f10ec139dbf3823c249ae72 Author: Daniel Stenberg Date: Wed Feb 15 13:03:21 2023 +0100 runtests: fix "uninitialized value $port" by using a more appropriate variable Reported-by: fundawang on github Fixes #10518 Closes #10520 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -1740,7 +1740,7 @@ sub runhttpserver { } # where is it? - my $port; + my $port = 0; if(!$port_or_path) { $port = $port_or_path = pidfromfile($portfile); } @@ -1758,7 +1758,7 @@ sub runhttpserver { $pid2 = $pid3; if($verbose) { - logmsg "RUN: $srvrname server is on PID $httppid port $port\n"; + logmsg "RUN: $srvrname server is on PID $httppid port $port_or_path\n"; } return ($httppid, $pid2, $port);