curl/tests/data/test483
Daniel Stenberg 386f570df6
cookie: cap expire times to 400 days
The pending cookie RFC update (currently known as 6265bis draft-19) says

  Let cookie-age-limit be the maximum age of the cookie (which name of
  Max-Age and an attribute-value of expiry-time. SHOULD be 400 days or
  less.

This change makes received cookies over the wire get capped to 400 days.

It does not cap the expiry date of cookies loaded from file.

It does this by rounding the expire time to a even minute. This, to
allow the test suite to do the same and have a chance to get the same
number for stable testing without requiring a debug build.

The test script generates TWO numbers in the output file for each
%days[] used in the input test file, and the function that subsequently
compares and verifies output is fine with *either* of the two numbers.

This is done so that if the test case is generated the second
immediately before curl runs, that updated expiry number is also deemed
okay. It still checks for an exact match of either number.

Closes #15937
2025-01-10 08:20:03 +01:00

67 lines
1.3 KiB
Plaintext

<testcase>
<info>
<keywords>
HTTP
HTTP GET
cookies
</keywords>
</info>
#
# Server-side
<reply>
<data crlf="yes">
HTTP/1.1 200 OK
Set-Cookie: name=value; expires=Fri Feb 13 11:56:27 GMT 2132
Set-Cookie: name2=value; expires=Fri Feb 13 11:56:27 ; 2132
Set-Cookie: name3=value; expires=Fri Feb 13 11:56:27 ...................................................GMT 2132
Set-Cookie: name4=value; expires=Fri Feb 13 11:56:27 ....................................................GMT 2132
Accept-Ranges: bytes
Content-Length: 6
Connection: close
-foo-
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<features>
cookies
large-time
</features>
<name>
HTTP cookies with long expire dates
</name>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -c %LOGDIR/c%TESTNUMBER
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol crlf="yes">
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
<file name="%LOGDIR/c%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.
127.0.0.1 FALSE / FALSE 0 name4 value
127.0.0.1 FALSE / FALSE %days[400] name3 value
127.0.0.1 FALSE / FALSE 0 name2 value
127.0.0.1 FALSE / FALSE %days[400] name value
</file>
</verify>
</testcase>