Skip to content

Fix hangs with large request payloads - #30

Open
clanky1024 wants to merge 1 commit into
hashicorp:mainfrom
clanky1024:fix/unread-request-body-hang
Open

Fix hangs with large request payloads#30
clanky1024 wants to merge 1 commit into
hashicorp:mainfrom
clanky1024:fix/unread-request-body-hang

Conversation

@clanky1024

Copy link
Copy Markdown

Summary

  • drain request bodies before writing the configured response
  • add regression coverage for small and 20 MiB payloads

Problem

The request handler did not read the request body. For large HTTP/1 requests, this could cause the server to close the connection with unread data or wait while net/http attempted to drain a chunked body, resulting in stalled or hanging clients.

Solution

Stream the request body to io.Discard before writing the response. This consumes large payloads without buffering them in memory and allows the request to complete normally.

Testing

  • go test ./...
  • confirmed the regression test fails against the original implementation
  • verified complete known-length and chunked 20 MiB uploads

@hashicorp-cla-app

hashicorp-cla-app Bot commented Aug 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@clanky1024
clanky1024 marked this pull request as ready for review August 12, 2026 20:30
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