Repository navigation
fix(client): declare Content-Length: 0 on empty POST, PUT and PATCH bodies - #14072
Merged
Merged
Conversation
…odies The adapters force HTTP/1.1 and sent no length for an empty body, so Google's OAuth token endpoint answered 411 Length Required and every Google sign-in failed with user_oauth2_provider_failure. The previous curl call negotiated HTTP/2, where no length is needed.
🟢 Tier S · Ready to merge
Both HTTP adapters now declare a zero-length body for empty POST, PUT, and PATCH requests, avoiding HTTP/1.1 responses such as Google's 411 Length Required. The shared adapter contract tests verify those methods send Content-Length: 0 while a bodyless GET remains unchanged.
📂 Walkthrough · 4
Reviewed |
eldadfux
approved these changes
Oct 3, 2026
2 tasks done
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
abnegate
added a commit
that referenced
this pull request
Oct 5, 2026
cloud#5410 re-pins server-ce to this branch and needs main at or past ee75768: the health tests that stop asserting wall-clock ping budgets (#14069), Content-Length: 0 on empty client bodies for OAuth token requests (#14072) and the SDK task no longer calling setters removed in sdk-generator 5.3.4 (#14073). Also brings the GitHub OAuth missing-user fix (#14093) and appwrite/geo 0.3.2 (#14100). The merge is clean and the lock is untouched; both sides still resolve appwrite/sdk-generator 5.0.1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 5, 2026
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.
What does this PR do?
Google OAuth sign-in on Cloud has failed with
user_oauth2_provider_failure(424) since the OAuth providers moved ontoUtopia\Client. Google's token endpoint answers 411 Length Required.Google's token exchange sends its parameters in the query string, so the POST has an empty body. The old
OAuth2::request()sent noContent-Lengtheither, but plain curl negotiated HTTP/2 with Google, and HTTP/2 doesn't need one. The Curl adapter forces HTTP/1.1 and sent no length for an empty body, which Google refuses.Both adapters now send
Content-Length: 0for a POST, PUT or PATCH with an empty body (RFC 9110 §8.6). Curl gets an emptyCURLOPT_POSTFIELDS, with the default form Content-Type suppressed as it already is for non-empty bodies. Swoole gets the header directly. GET and other bodyless methods are unchanged.Test Plan
testItDeclaresAZeroLengthForAnEmptyBodyOnMethodsThatCarryOneruns against both adapters. Without the fix it failed in all 6 cases (Curl and Swoole × POST/PUT/PATCH, each reporting no length); with the fix it passes, and GET still sends no length.curl --http1.1 -X POST 'https://oauth2.googleapis.com/token?...'returns 411, and--http2returns 400. The patched adapter gets 400 for the same request (dummy credentials) instead of 411.bin/monorepo check clientpasses.testItChecksEveryRedirectHopAgainstTheDestination(both adapters) andtestAnEnvironmentProxyCannotCarryARequestPastTheDestination(Curl) fail because macOS doesn't bind127.0.0.2. They should pass on Linux CI.Related PRs and Issues
Utopia\Client.Checklist
Related: #14122