Skip to content

Update uWebSockets submodule: replace maxRemainingBodyLength() with onDataV2#1252

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/update-uwebsockets-submodule-again
Draft

Update uWebSockets submodule: replace maxRemainingBodyLength() with onDataV2#1252
Copilot wants to merge 3 commits intomasterfrom
copilot/update-uwebsockets-submodule-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

Upstream uWebSockets removed maxRemainingBodyLength() from HttpResponse and replaced it with onDataV2, which passes maxRemainingBodyLength directly as a uint64_t callback parameter (0 = last chunk, UINT64_MAX = chunked transfer encoding in-progress).

Changes

  • Submodule: bump uWebSockets to e42d69f ("Remove maxRemainingBodyLength(), add onDataV2")
  • res_onStream: switch from onData(fn(data, bool last)) + res->maxRemainingBodyLength() call inside handler to onDataV2(fn(data, uint64_t maxRemainingBodyLength)); drops res capture from lambda
  • res_onFullData: switch to onDataV2; replace last bool with maxRemainingBodyLength == 0; update preallocation hint from res->maxRemainingBodyLength() to data.size() + maxRemainingBodyLength (guards correctly against UINT64_MAX for chunked encoding)
  • Remove: res_maxRemainingBodyLength wrapper function and its prototype registration
  • Types: remove maxRemainingBodyLength(): bigint from HttpResponse in docs/index.d.ts
// Before
res->onData([res, sharedP, isolate](std::string_view data, bool last) {
    Local<Value> argv[] = {dataArrayBuffer, BigInt::NewFromUnsigned(isolate, res->maxRemainingBodyLength())};
});

// After
res->onDataV2([sharedP, isolate](std::string_view data, uint64_t maxRemainingBodyLength) {
    Local<Value> argv[] = {dataArrayBuffer, BigInt::NewFromUnsigned(isolate, maxRemainingBodyLength)};
});

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…gBodyLength()

Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>
Agent-Logs-Url: https://github.com/uNetworking/uWebSockets.js/sessions/7381342f-ed36-4f1c-ad98-304260ebef6e
Copilot AI changed the title [WIP] Update uWebSockets submodule and modify onDataV2 Update uWebSockets submodule: replace maxRemainingBodyLength() with onDataV2 Mar 20, 2026
Copilot AI requested a review from uNetworkingAB March 20, 2026 18:38
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.

2 participants