url: connection reuse fixes for starttls

Add test_31_13 to check connection reuse on mixed --ssl-reqd setting.
For that add debug env var CURL_DBG_NO_USE_SSL_ON_FIRST to disable
--ssl-reqd for the first url. Check that the connection without SSL
from the first url is not reused on the second URL that requires it.

Tweak special ftp: protocol check to fail a DEBUGASSERT on mismatched
`use_ssl` settings as that should have been caught before in the
connection reuse matching (imap/smtp etc. do not have this extra check
and rely on the general part doing its job).

Closes #21665
This commit is contained in:
Stefan Eissing 2026-05-19 10:57:53 +02:00 committed by Daniel Stenberg
parent f1a6f190a6
commit 4ff212f8ed
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 55 additions and 14 deletions

View file

@ -199,3 +199,8 @@ Make `curl` use the quick exit option, even when built in debug mode.
When happy eyeballing for https: wait for the HTTPS-RR resolve
answer to arrive before starting any connect attempt.
## `CURL_DBG_NO_USE_SSL_ON_FIRST`
When passing `--ssl-reqd`, clear it for the first URL in a curl command.
This allows testing of connection reuse in mixed `STARTTLS` needs.