Skip to content

Conversation

@kai-ion
Copy link
Contributor

@kai-ion kai-ion commented Dec 2, 2025

Issue #, if available:
#3297

Description of changes:
Our goal is specifically to refactor this logic out of http clients and into a interceptor. We will introduce a core ChunkingInterceptor that owns all aws-chunked behavior for streaming requests and remove the chunking logics from the individual HTTP clients.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kai-ion kai-ion force-pushed the chunky branch 2 times, most recently from 083ea7a to a6b040e Compare December 2, 2025 19:54
@kai-ion kai-ion marked this pull request as draft December 3, 2025 21:25
@kai-ion kai-ion marked this pull request as ready for review December 3, 2025 21:32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this buffer 8KB? why is this buffer a c array and not a c++ array? why not make this configurable?

AwsChunkedStream has a buffer of 64KB for double encoding, why are creating a second buffer to buffer that buffer into?

If the answer is "because i need to use the AwsChunkedStream logic to do what i need it to do" then we need to move the logic from chunked stream into this class to avoid a extra buffer, or add additionally APIs to the existing class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes you're right, this was originally setup just because we needed a streambuff interface. I think extending AwsChunkedStream API to add a streamBuff interface makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need a default constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


The checksum interceptor also have a default constructor. But I think we actually dont need this default constructor here since we have the explicit clientconfig constructor

@kai-ion kai-ion marked this pull request as draft December 9, 2025 03:57
@kai-ion kai-ion marked this pull request as ready for review December 9, 2025 15:40
@kai-ion kai-ion marked this pull request as draft December 9, 2025 18:12
@kai-ion kai-ion marked this pull request as ready for review December 9, 2025 21:22
Aws::MakeShared<ChecksumInterceptor>("AwsSmithyClientBase", *m_clientConfig),
Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", [this]() {
Aws::Client::ClientConfiguration chunkingConfig = *m_clientConfig;
chunkingConfig.httpClientChunkedMode = m_httpClient->IsDefaultAwsHttpClient() ? m_clientConfig->httpClientChunkedMode : Aws::Client::HttpClientChunkedMode::CLIENT_IMPLEMENTATION;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the behavior we want? If it's our implementation (IsDefaultAwsHttpClient() == true) then don't we want to force Aws::Client::HttpClientChunkedMode::DEFAULT so that the chunking is applied? And if it's not our implementation then we follow whatever the customer has set, ie m_clientConfig->httpClientChunkedMode. Seems to me this condition should be reversed:

chunkingConfig.httpClientChunkedMode = m_httpClient->IsDefaultAwsHttpClient() ?  Aws::Client::HttpClientChunkedMode::DEFAULT : m_clientConfig->httpClientChunkedMode;

I think we should default initialize clientConfig.httpClientChunkedMode = HttpClientChunkedMode::CLIENT_IMPLEMENTATION; so the client can opt-in for their HttpClient implementation if they want to, but for our implementation we should ensure it's going to use chunking

clientConfig.httpLibOverride = Aws::Http::TransferLibType::DEFAULT_CLIENT;

// Users can explicitly set CLIENT_IMPLEMENTATION if their custom client handles chunking
clientConfig.httpClientChunkedMode = HttpClientChunkedMode::DEFAULT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be

clientConfig.httpClientChunkedMode = HttpClientChunkedMode::CLIENT_IMPLEMENTATION;

We don't want to change existing client's HttpClient behavior unless they opt-in to our chunking logic.

Copy link
Contributor

@sbiscigl sbiscigl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright its in a good place now, please fix the constructor and do some memory tests and im good to ship

@kai-ion kai-ion force-pushed the chunky branch 2 times, most recently from 6b7ea6b to d3f7c22 Compare December 15, 2025 18:17
Move aws-chunked encoding logic from individual HTTP clients to a
centralized ChunkingInterceptor for better separation of concerns.

- Add ChunkingInterceptor to handle aws-chunked encoding at request level
- Remove custom chunking logic from CRT, Curl, and Windows HTTP clients
- Simplify HTTP clients to focus on transport-only responsibilities
- Maintain full backwards compatibility with existing APIs

unit test for chunking stream

added logic to detect custom http client and smart default

reversing logic to check for chunked mode

changing chunking interceptor to use array instead of vector
@kai-ion kai-ion merged commit 2051054 into main Dec 15, 2025
4 of 5 checks passed
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.

3 participants