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

Fix bug triggered by OpenSSL 3.2.0 #105

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .release-notes/openssl3.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Fix bug triggered by OpenSSL 3.2

Making HTTPClient calls over SSL when using OpenSSL 3.2.0 would encounter a nasty bug. When executed in a program compiled in release mode, the program would hang. When executed in a program compiled in debug mode, the program would segfault due to infinite recursion.
2 changes: 1 addition & 1 deletion corral.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"deps": [
{
"locator": "github.com/ponylang/net_ssl.git",
"version": "1.3.1"
"version": "1.3.2"
}
],
"packages": [
Expand Down
1 change: 1 addition & 0 deletions http/_test.pony
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ actor \nodoc\ Main is TestList
fun tag tests(test: PonyTest) =>
_ClientErrorHandlingTests.make().tests(test)
_ClientTests.make().tests(test)
_NetSSL105RegressionTests.make().tests(test)

test(_Encode)
test(_EncodeBad)
Expand Down
48 changes: 48 additions & 0 deletions http/test_netssl_105_regression.pony
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use "pony_test"
use "net"

// Tests to verify that the ponylang/net_ssl #105 regression is fixed.
// https://github.com/ponylang/net_ssl/issues/105
// The expectation is that this test will pass if everything is good.
// Otherwise, the test will segfault when compiled in debug mode or it will
// hang if compled in release mode.
actor \nodoc\ _NetSSL105RegressionTests is TestList
new make() =>
None

fun tag tests(test: PonyTest) =>
test(_NetSSL105RegressionTest)

class \nodoc\ val _NetSSL105RegressionHandlerFactory is HandlerFactory
let _h: TestHelper

new create(h: TestHelper) =>
_h = h

fun box apply(session: HTTPSession tag): HTTPHandler ref^ =>
_NetSSL105RegressionHandler(_h)

class \nodoc\ val _NetSSL105RegressionHandler is HTTPHandler
let _h: TestHelper

new create(h: TestHelper) =>
_h = h

fun ref apply(payload: Payload val): None tag =>
_h.complete(true)

class \nodoc\ iso _NetSSL105RegressionTest is UnitTest
fun name(): String => "regression/net_ssl-105"

fun apply(h: TestHelper) =>
h.long_test(2_000_000_000)

try
let url = URL.build("https://echo.sacovo.ch")?
let auth = TCPConnectAuth(h.env.root)
let client = HTTPClient(auth)
let payload = Payload.request("GET", url)
client.apply(consume payload, _NetSSL105RegressionHandlerFactory(h))?
else
h.fail("Unable to setup test")
end
Loading