Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/1: Support streaming requests of unknown length #506

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Mar 11, 2025

Issue:

aws-sdk-cpp needs to send streaming requests of unknown content length. This isn't currently supported in our HTTP/1 client.

Background:

The HTTP/1 client already supported these use cases:

  • Send streaming request body, but declare Content-Length up front
  • Send chunked request body, but user must declare length of each chunk via write_chunk() API.

But it wasn't possible to send a stream of unknown length without doing extra copies (read to intermediate buffer, then send that buffer via write_chunk() API).

Description of changes:

Support input streams of unknown length via chunked encoding.

When reading from the stream, leave a bit of space at the start and end of the aws_io_message buffer for the chunk prefix and suffix. Then go back and write in the prefix and suffix afterwards. No unnecessary copies are involved.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 79.32%. Comparing base (60c43f8) to head (d1b0d70).

Files with missing lines Patch % Lines
source/h1_encoder.c 87.50% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #506      +/-   ##
==========================================
- Coverage   79.41%   79.32%   -0.10%     
==========================================
  Files          27       27              
  Lines       11621    11666      +45     
==========================================
+ Hits         9229     9254      +25     
- Misses       2392     2412      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@graebm graebm changed the title HTTP/1: Support input streams of unknown length via chunked encoding HTTP/1: Support streaming requests of unknown length Mar 11, 2025
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