hsts: when a dupe host adds subdomains, use that

Otherwise a weaker earlier entry is allowed to override a later more
restrictive one.

Add test 1638 to verify.

Closes #21108
This commit is contained in:
Daniel Stenberg 2026-03-26 17:28:34 +01:00
parent 5172ba5475
commit e1fdbdd16f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 105 additions and 3 deletions

View file

@ -35,6 +35,15 @@ void curlx_str_assign(struct Curl_str *out, const char *str, size_t len)
out->len = len;
}
/* remove bytes from the end of the string, never remove more bytes than what
the string holds! */
void curlx_str_trim(struct Curl_str *out, size_t len)
{
DEBUGASSERT(out);
DEBUGASSERT(out->len >= len);
out->len -= len;
}
/* Get a word until the first DELIM or end of string. At least one byte long.
return non-zero on error */
int curlx_str_until(const char **linep, struct Curl_str *out,