Add asynchronous HTTP handling with HttpAsync module#490
Draft
cocorico8 wants to merge 11 commits intoBeamMP:minorfrom
Draft
Add asynchronous HTTP handling with HttpAsync module#490cocorico8 wants to merge 11 commits intoBeamMP:minorfrom
cocorico8 wants to merge 11 commits intoBeamMP:minorfrom
Conversation
…er to AsyncHttpProxy::Download and AsyncHttpProxy::PostFile Co-authored-by: Copilot <copilot@github.com>
Author
|
currently there's a bug in the version of cpp-httplib, I would need to update the baseline to get rid of it to avoid using hacky solution, should i make another pr to update the vcpkg baseline (tried in a debian 12 vm that it still compiles and it does) |
…that had a bug in it that was resolved in more recent version
… handling Co-authored-by: Copilot <copilot@github.com>
…s that wasn't returning the handles. Co-authored-by: Copilot <copilot@github.com>
…and file access issues
…and improved cancellation handling
…fety Co-authored-by: Copilot <copilot@github.com>
… warnings for HTTP and WebSocket connections. Also fixes a race condition in the websockets part
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a comprehensive, non-blocking asynchronous networking suite to the server-side Lua API, consisting of the
AsyncHttpandAsyncWebSocketmodules. It provides modders with high-performance tools for external integrations while strictly protecting the server's main thread and system resources.Key Features:
GET,POST,PUT,PATCH,DELETE,HEAD, and full-duplex WebSockets (ws://andwss://).:Cancel(), which immediately severs the underlying TCP socket to reclaim resources.application/jsonwhere appropriate.Set-Cookiefields) and automatic lowercase header normalization for easy Lua access.Downloadto disk andPostFilefor multipart form-data uploads.Stability & Safety Implementation:
httplib::ThreadPooland WebSocket quotas based on the host's hardware (CPU thread count).Updatecycle to ensure Lua callbacks only execute on the main thread.CleanupStateandAbandonlogic ensures all Lua Registry references are freed and background threads are terminated immediately when a script reloads or stops.By creating this pull request, I understand that code that is AI generated or otherwise automatically generated may be rejected without further discussion.
I declare that I fully understand all code I pushed into this PR, and wrote all this code myself and own the rights to this code.