Skip to content

fix(server): support chunked request bodies - #70

Open
782042369 wants to merge 1 commit into
Sophomoresty:mainfrom
782042369:fix/chunked-request-body
Open

fix(server): support chunked request bodies#70
782042369 wants to merge 1 commit into
Sophomoresty:mainfrom
782042369:fix/chunked-request-body

Conversation

@782042369

Copy link
Copy Markdown

Summary

  • decode HTTP/1.1 chunked request bodies before JSON parsing
  • keep the existing Content-Length path unchanged
  • consume optional chunk extensions and trailers

Problem

Reverse proxies may forward POST bodies with Transfer-Encoding: chunked and no Content-Length. The server currently reads an empty body in that case, so valid JSON requests fail locally with 400 invalid JSON before reaching Gemini.

Validation

  • python3 -m compileall -q gemini_web2api.py gemini_web2api
  • reproduced the failure with a forced chunked generateContent request (400 before the fix)
  • verified the same request returns 200 after the fix
  • verified a reverse-proxied Google-compatible generateContent request returns 200 after deployment

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.

1 participant