curl-curl/tests/data/test46
Viktor Szakats 63e9721b63
tests: avoid hard-coded CRLFs in more sections
- `reply/data*`, `verify/stdout`, `verify/stderr`, `verify/file*`,
  `verify/proxy`:
  - make `crlf="yes"` force CRLF to all lines, instead of just applying
    to HTTP protocol headers.
  - add support for `crlf="headers"` that only converts HTTP protocol
    header lines to CRLF. (previously done via `crlf="yes"`.)
  - use `crlf="headers"` where possible.

- `reply/connect*`:
  - add support for `crlf="yes"` and `crlf="headers"`.
  - use them where possible.

- `client/file*`, `client/stdin`:
  - add support for `crlf="yes"`.
  - use it where possible.

- `reply/data*`, `verify/protocol`:
  - replace existing uses of `crlf="yes"` with `crlf="headers`" where it
    does not change the result.

Reducing the number of `tests/data/test*`:
- CRLF newlines from 10295 to 1985. (119985 lines total)
- files with mixed newlines from 656 to 113. (1890 files total)

After this patch there remain 141 sections with mixed newlines, where
the mixing is not split between headers/non-headers. There is no obvious
pattern here. Some of the CRLF uses might be accidental, or
non-significant. They will be tackled in a future patch.

Follow-up to 6cf3d7b1b1 #19318
Follow-up to 4d2a05d3fe #19284

Closes #19313
2025-11-03 21:15:12 +01:00

111 lines
3.2 KiB
Plaintext

<testcase>
<info>
<keywords>
HTTP
HTTP GET
cookies
cookiejar
--resolve
</keywords>
</info>
# Server-side
<reply>
<data crlf="headers">
HTTP/1.1 200 OK
Server: Microsoft-IIS/4.0
Date: Tue, 25 Sep 2001 19:37:44 GMT
Content-Type: text/html
%if large-time
Set-Cookie: ckyPersistent=permanent; expires=Fri, 13-Feb-2525 11:56:27 GMT; path=/
%else
Set-Cookie: ckyPersistent=permanent; expires=Fri, 13-Feb-2037 11:56:27 GMT; path=/
%endif
Set-Cookie: ckySession=temporary; path=/
Set-Cookie: ASPSESSIONIDQGGQQSJJ=GKNBDIFAAOFDPDAIEAKDIBKE; path=/
Set-Cookie: justaname=; path=/;
Set-Cookie: simplyhuge=%repeat[3998 x z]%
Cache-control: private
Content-Length: 41
This server reply is for testing cookies
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
HTTP with bad domain name, get cookies and store in cookie jar
</name>
# Explicitly set the time zone to a known good one, in case the user is
# using one of the 'right' zones that take into account leap seconds
# which causes the cookie expiry times to be different from what we expect.
<setenv>
TZ=GMT
</setenv>
<command>
domain..tld:%HTTPPORT/want/%TESTNUMBER --resolve domain..tld:%HTTPPORT:%HOSTIP -c %LOGDIR/jar%TESTNUMBER -b %LOGDIR/injar%TESTNUMBER
</command>
<file name="%LOGDIR/injar%TESTNUMBER">
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This is generated by libcurl! Do not edit.
%if large-time
www.fake.come FALSE / FALSE 22147483647 cookiecliente si
www.loser.com FALSE / FALSE 22139150993 UID 99
domain..tld FALSE / FALSE 22139150993 mooo indeed
#HttpOnly_domain..tld FALSE /want FALSE 22139150993 mooo2 indeed2
%else
www.fake.come FALSE / FALSE 2147483647 cookiecliente si
www.loser.com FALSE / FALSE 2139150993 UID 99
domain..tld FALSE / FALSE 2139150993 mooo indeed
#HttpOnly_domain..tld FALSE /want FALSE 2139150993 mooo2 indeed2
%endif
domain..tld FALSE /want FALSE 0 empty%tab%
</file>
<features>
cookies
</features>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol crlf="headers">
GET /want/%TESTNUMBER HTTP/1.1
Host: domain..tld:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Cookie: empty=; mooo2=indeed2; mooo=indeed
</protocol>
<file name="%LOGDIR/jar%TESTNUMBER" mode="text">
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
domain..tld FALSE /want/ FALSE 0 simplyhuge %repeat[3998 x z]%
domain..tld FALSE / FALSE 0 justaname%tab%
domain..tld FALSE / FALSE 0 ASPSESSIONIDQGGQQSJJ GKNBDIFAAOFDPDAIEAKDIBKE
domain..tld FALSE / FALSE 0 ckySession temporary
domain..tld FALSE / FALSE %days[400] ckyPersistent permanent
%if large-time
domain..tld FALSE /want FALSE 0 empty%tab%
#HttpOnly_domain..tld FALSE /want FALSE 22139150993 mooo2 indeed2
domain..tld FALSE / FALSE 22139150993 mooo indeed
www.loser.com FALSE / FALSE 22139150993 UID 99
www.fake.come FALSE / FALSE 22147483647 cookiecliente si
%else
domain..tld FALSE /want FALSE 0 empty%tab%
#HttpOnly_domain..tld FALSE /want FALSE 2139150993 mooo2 indeed2
domain..tld FALSE / FALSE 2139150993 mooo indeed
www.loser.com FALSE / FALSE 2139150993 UID 99
www.fake.come FALSE / FALSE 2147483647 cookiecliente si
%endif
</file>
</verify>
</testcase>