Skip to content

Cookie expiration tests failing with curl 8.12Β #1183

@ZLima12

Description

@ZLima12

Description

When building cpr with curl 8.12, the following tests fail:

  • cpr_get_tests
  • cpr_session_tests
  • cpr_head_tests

Looking closer, all of the failures in LastTest.log follow this format:

/usr/src/debug/cpr/cpr-1.11.1/test/get_tests.cpp:139: Failure
Expected equality of these values:
  expectedCookie->GetExpires()
    Which is: 8-byte object <00-10 00-F1 1C-C5 31-36>
  cookie->GetExpires()
    Which is: 8-byte object <00-18 08-39 AE-03 A0-18>

I modified the relevant line in the test, so that it would output the epoch time instead of relatively unintelligible bytes:

/usr/src/debug/cpr/cpr-1.11.1/test/get_tests.cpp:140: Failure
Expected equality of these values:
  std::chrono::duration_cast<std::chrono::seconds>(expectedCookie->GetExpires().time_since_epoch()).count()
    Which is: 3905119080
  std::chrono::duration_cast<std::chrono::seconds>(cookie->GetExpires().time_since_epoch()).count()
    Which is: 1774422600

Converting these values to a human readable timestamp, we get:

Expected Actual
Wed Sep 30 03:18:00 AM UTC 2093 Wed Mar 25 07:10:00 AM UTC 2026

The expected value here exactly matches what is in httpServer.cpp, so that is working fine. However, the actual value is exactly 400 days in the future from the moment the test was run. It seems that this is the new curl behavior, as introduced in curl/curl#15937 .

Example/How to Reproduce

Build and run tests while using curl 8.12

Possible Fix

  • Stop testing this value altogether
  • Change the expected value to now + 400 days, leaving the value in httpServer.cpp unchanged
  • Change the value in httpServer.cpp (and the expected value in the tests) to something within the next 400 days, and keep updating this value periodically to keep it within the [now, now + 400 days] range.
  • Allow the expires value to be in the past
  • Somehow tell curl not to cap the value
  • A combination of some of the previous options

Where did you get it from?

GitHub (branch e.g. master)

Additional Context/Your Environment

  • OS: Arch Linux
  • Version: curl 8.12.0-3, cpr 1.11.1-3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions