Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundled libcurl limits cookie expiry date to the year 2038 #523

Open
apparentorder opened this issue Aug 13, 2023 · 1 comment
Open

bundled libcurl limits cookie expiry date to the year 2038 #523

apparentorder opened this issue Aug 13, 2023 · 1 comment

Comments

@apparentorder
Copy link

apparentorder commented Aug 13, 2023

When curl-rust is using the bundled libcurl, it will silently limit the expiry time (unix timestamp) of received cookies to i32::MAX (2147483647), for example:

< Set-Cookie: LSID=DQAAAKEaem_vYg; Expires=Thu, 13 Jan 2078 22:23:01 GMT; HttpOnly; Path=/accounts
* Added cookie HSID="AYQEVnDKrdst" for domain localhost, path /, expire 2147483647

But "Thu, 13 Jan 2078 22:23:01 GMT" actually is 3409338181.

I have reproduced this on different OS (Amazon Linux, Ubuntu) and different architectures (x86-64, aarch64).

When libcurl header files are present and curl-rust is built without the bundled libcurl, this bug does not occur.
Assorted versions of the curl client also seem to be unaffected.

Test program:

use curl::easy::Easy;

fn main() {
    let mut easy = Easy::new();
    easy.url("http://localhost:8000/cookie-jar").unwrap();

    easy.verbose(true);
    easy.cookie_jar("/dev/stdout");
    easy.perform().unwrap();
}

With bundled libcurl, the output will contain the above line, and also:

#HttpOnly_localhost	FALSE	/accounts	FALSE	2147483647	LSID	DQAAAKEaem_vYg

I'll also mention #321 here because I was completely unaware that I forgot to install libcurl-devel, and I was really surprised that some libcurl gets bundled silently.

@sagebind
Copy link
Collaborator

It is possible there is some build-time configuration define that we aren't setting when building the bundled libcurl version that usually gets set when libcurl is built using its typical distro build chain. I would check here to see if there is a HAVE_ variable that may be necessary that we aren't setting. Being limited to a 32-bit timestamp sounds an awful lot like libcurl wanting to detect optional 64-bit timestamp support, and our build script not informing libcurl of the timestamp width of the target triple.

I'll also mention #321 here because I was completely unaware that I forgot to install libcurl-devel, and I was really surprised that some libcurl gets bundled silently.

I think we're likely to close that issue as "won't fix". Not only would not falling back to the bundled libcurl be a breaking change, it would also be annoying for most users who would rather see compiling curl-rust to "just work" whether or not a system libcurl is available rather than needing to opt-in to a bundled version somehow. That's been @alexcrichton's general stance too if I recall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants