libcpr / cpr

C++ Requests: Curl for People, a spiritual port of Python Requests.
https://docs.libcpr.org/
Other
6.29k stars 903 forks source link

Optimization cookie time #1033

Closed 0x703cd8 closed 3 months ago

0x703cd8 commented 3 months ago

In some environments (such as Win11 Visual Studio 2022), the long type is 32 bit, while the time_t type is 64 bit.

So in util.cpp>parseCookies()>const std::time_t expires = static_cast<time_t>(std::stoul(tokens.at(static_cast<size_t>(CurlHTTPCookieField::Expires))));, there may be an "stoul argument out of range" issue. Because Cookie.ExpiresString may be 64 bit, while the parameter for std::stoul() may be 32 bit.(From the source code of curl, it can be seen that the type of Cookie.ExpiresString is time_t)

So I added function sTimestampToT() to parse Cookie.ExpiresString based on different types of time_t.

What do everyone think? Welcome to correct.

Wishing everyone a happy life.

COM8 commented 3 months ago

Perfect. Thanks. Now just a round of clang-tidy fixes and we are ready to go: https://github.com/libcpr/cpr/actions/runs/8466060069/job/23195757541?pr=1033

Are you able to access the build output behind this link?

0x703cd8 commented 3 months ago

Perfect. Thanks. Now just a round of clang-tidy fixes and we are ready to go: https://github.com/libcpr/cpr/actions/runs/8466060069/job/23195757541?pr=1033

Are you able to access the build output behind this link?

I can see it, I'll go take a look

0x703cd8 commented 3 months ago

Perfect. Thanks. Now just a round of clang-tidy fixes and we are ready to go: https://github.com/libcpr/cpr/actions/runs/8466060069/job/23195757541?pr=1033

Are you able to access the build output behind this link?

A troublesome problem has arisen: error: consider replacing 'long' with 'int64' [google-runtime-int,-warnings-as-errors]. I need some time to figure out a solution.

COM8 commented 3 months ago

I quickly fixed all the open clang-tidy issues. Let me know if those changes are OK for you and then we are ready to merge your PR :)

0x703cd8 commented 3 months ago

I quickly fixed all the open clang-tidy issues. Let me know if those changes are OK for you and then we are ready to merge your PR :)

No problem, then you can merge it.