cookie: trim trailing dots when checking PSL

Verified with test 1629

Closes #21636
This commit is contained in:
Daniel Stenberg 2026-05-16 00:19:09 +02:00
parent 614b94eecc
commit 51beed175d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 65 additions and 3 deletions

53
tests/data/test1629 Normal file
View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
HTTP
HTTP GET
</keywords>
</info>
# Server-side
<reply>
<data crlf="headers">
HTTP/1.1 200 OK
Content-Length: 6
Set-Cookie: something=1; Domain=co.uk.; Path=/
-foo-
</data>
</reply>
# Client-side
<client>
<features>
PSL
cookies
</features>
<server>
http
</server>
<name>
cookies with trailing dot after PSL domain
</name>
<command>
http://foo.co.uk.:%HTTPPORT/ http://bar.co.uk.:%HTTPPORT/ -b "" --resolve foo.co.uk.:%HTTPPORT:%HOSTIP --resolve bar.co.uk.:%HTTPPORT:%HOSTIP
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol crlf="headers">
GET / HTTP/1.1
Host: foo.co.uk.:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
GET / HTTP/1.1
Host: bar.co.uk.:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
</verify>
</testcase>