ruby / net-http

Net::HTTP provides a rich library which can be used to build HTTP user-agents.
Other
101 stars 66 forks source link

net/http.rb - fixup session timeout logic for OpenSSL 3 #165

Closed MSP-Greg closed 4 months ago

MSP-Greg commented 1 year ago

In OpenSSL 3, session.timeout may not allow negative values, although context.timeout can be negative. For more info see https://github.com/ruby/openssl/issues/703.

Since the code here is using session.timeout in a non-standard way, use context.timeout. If it's nil, use session.timeout. This allows the code to work with OpenSSL 3.2.0.

MSP-Greg commented 1 year ago

I tested this locally without the two commits affecting the test.

In addition to this PR, commits 042faf74e77d786ff60dff81555f6ec4f21e77a9 & 58fc559bfcb30e55ecb4a0e36800f81fbcf10715 should be reverted, and PR #163 should be merged, which adds WIndows CI.

At present, the only simple way to test against OpenSSL 3.2.0 is to use a Windows Ruby master build, either head or ucrt.

MSP-Greg commented 7 months ago

I just rebased and additionally: a) added Windows CI b) removed the 'omit' in test_session_reuse_but_expire.

The branch is at https://github.com/MSP-Greg/net-http/commits/00-timeout-windows/, and CI passed.

Windows Ruby head builds all use OpenSSL 3.2.1, Ruby 3.2 and 3.3 are using OpenSSL 3.2.0.

MSP-Greg commented 4 months ago

Closing, see https://github.com/ruby/net-http/pull/178