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

Migrate to use AsyncHTTPClient #15

Merged
merged 7 commits into from
Nov 16, 2023
Merged

Conversation

0xTim
Copy link
Contributor

@0xTim 0xTim commented Nov 9, 2023

URLSession is broken, incomplete and generally just a mess on Linux. For server-side applications to recommendation is to use AsyncHTTPClient. This PR migrates from URLSession to use AsyncHTTPClient instead.

Resolves #4

@alexanderjordanbaker
Copy link
Collaborator

@0xTim This seems to have a merge conflict with your other PR I merged a few days ago

alexanderjordanbaker added a commit to alexanderjordanbaker/app-store-server-library-swift that referenced this pull request Nov 16, 2023
@0xTim
Copy link
Contributor Author

0xTim commented Nov 16, 2023

@alexanderjordanbaker resolved!

alexanderjordanbaker added a commit to alexanderjordanbaker/app-store-server-library-swift that referenced this pull request Nov 16, 2023
@alexanderjordanbaker
Copy link
Collaborator

Hey @0xTim as you saw I'm messing around with the errors found in your build, do you have any ideas on those? I didn't get them building locally

@0xTim
Copy link
Contributor Author

0xTim commented Nov 16, 2023

@alexanderjordanbaker SwiftPM issue, think the latest build should fix it

let response = try await httpClient.execute(urlRequest, timeout: .seconds(30))
var body = try await response.body.collect(upTo: 1024 * 1024)
guard let data = body.readData(length: body.readableBytes) else {
return .nonTerminalError(OCSPFetchError())
Copy link
Collaborator

@alexanderjordanbaker alexanderjordanbaker Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not a terminalError? If we are unable to read data from the OCSP response, wouldn't that be an unrecoverable error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err I seem to remember it being caught elsewhere but yeah you're right. I'll update

Copy link
Collaborator

@alexanderjordanbaker alexanderjordanbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for this work

@alexanderjordanbaker alexanderjordanbaker merged commit dd971f9 into apple:main Nov 16, 2023
1 check passed
@0xTim 0xTim deleted the ahc branch November 16, 2023 02:59
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

Successfully merging this pull request may close these issues.

Support AsyncHTTPClient
2 participants