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

Update to ponylang/http 0.6.0 #32

Merged
merged 1 commit into from
Jan 21, 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/http-0.6.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Update to ponylang/http 0.6.0

We've updated our `ponylang/http` dependency to 0.6.0. This includes a fix that will allow correct operation when using OpenSSL 3.2.
2 changes: 1 addition & 1 deletion corral.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"locator": "github.com/ponylang/http.git",
"version": "0.5.4"
"version": "0.6.0"
},
{
"locator": "github.com/ponylang/json.git",
Expand Down
9 changes: 4 additions & 5 deletions github_rest_api/paginated_list.pony
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,19 @@ actor PaginatedResultReceiver[A: Any val]
// TODO: Could this be more generic?
class PaginatedJsonRequester
let _auth: TCPConnectAuth
let _client: HTTPClient
let _sslctx: (SSLContext | None)

new create(auth: TCPConnectAuth) =>
_auth = auth

let sslctx = try
_sslctx = try
recover val
SSLContext.>set_client_verify(true).>set_authority(None)?
end
else
None
end

_client = HTTPClient(_auth, sslctx)

fun ref apply[A: Any val](url: String,
receiver: PaginatedResultReceiver[A]) ?
=>
Expand All @@ -155,7 +153,8 @@ class PaginatedJsonRequester

let handler_factory =
PaginatedJsonRequesterHandlerFactory[A](_auth, receiver)
_client(consume r, handler_factory)?
let client = HTTPClient(_auth, handler_factory, _sslctx)
client(consume r)?

class PaginatedJsonRequesterHandlerFactory[A: Any val] is HandlerFactory
let _auth: TCPConnectAuth
Expand Down
12 changes: 7 additions & 5 deletions github_rest_api/request/http_delete.pony
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ interface tag DeleteResultReceiver
be failure(status: U16, response_body: String, message: String)

class HTTPDelete
let _client: HTTPClient
let _auth: TCPConnectAuth
let _sslctx: (SSLContext | None)

new create(auth: TCPConnectAuth) =>
let sslctx = try
_auth = auth

_sslctx = try
recover val
SSLContext.>set_client_verify(true).>set_authority(None)?
end
else
None
end

_client = HTTPClient(auth, sslctx)

fun ref apply(url: String,
receiver: DeleteResultReceiver,
auth_token: (String | None) = None) ?
Expand All @@ -29,7 +30,8 @@ class HTTPDelete
let r = RequestFactory("DELETE", valid_url, auth_token)

let handler_factory = HTTPDeleteHandlerFactory(receiver)
_client(consume r, handler_factory)?
let client = HTTPClient(_auth, handler_factory, _sslctx)
client(consume r)?

class HTTPDeleteHandlerFactory is HandlerFactory
let _receiver: DeleteResultReceiver
Expand Down
9 changes: 4 additions & 5 deletions github_rest_api/request/http_get.pony
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,28 @@ use "promises"

class JsonRequester
let _auth: TCPConnectAuth
let _client: HTTPClient
let _sslctx: (SSLContext | None)

new create(auth: TCPConnectAuth) =>
_auth = auth

let sslctx = try
_sslctx = try
recover val
SSLContext.>set_client_verify(true).>set_authority(None)?
end
else
None
end

_client = HTTPClient(_auth, sslctx)

fun ref apply(url: String,
receiver: JsonRequesterResultReceiver) ?
=>
let valid_url = URL.valid(url)?
let r = RequestFactory("GET", valid_url)

let handler_factory = JsonRequesterHandlerFactory(_auth, receiver)
_client(consume r, handler_factory)?
let client = HTTPClient(_auth, handler_factory, _sslctx)
client(consume r)?

interface tag JsonRequesterResultReceiver
be success(json: JsonDoc val)
Expand Down
12 changes: 7 additions & 5 deletions github_rest_api/request/http_post.pony
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ interface tag PostResultReceiver
be failure(status: U16, response_body: String, message: String)

class HTTPPost
let _client: HTTPClient
let _auth: TCPConnectAuth
let _sslctx: (SSLContext | None)

new create(auth: TCPConnectAuth) =>
let sslctx = try
_auth = auth

_sslctx = try
recover val
SSLContext.>set_client_verify(true).>set_authority(None)?
end
else
None
end

_client = HTTPClient(auth, sslctx)

fun ref apply(url: String,
body: String,
receiver: PostResultReceiver,
Expand All @@ -31,7 +32,8 @@ class HTTPPost
r.add_chunk(body)

let handler_factory = HTTPPostHandlerFactory(receiver)
_client(consume r, handler_factory)?
let client = HTTPClient(_auth, handler_factory, _sslctx)
client(consume r)?

class HTTPPostHandlerFactory is HandlerFactory
let _receiver: PostResultReceiver
Expand Down
Loading