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

Buffer writes before chunks are written to connection #72

Merged
merged 16 commits into from
May 21, 2024

Conversation

rmja
Copy link
Member

@rmja rmja commented May 17, 2024

This commit:

  • Moves the responsibility for writing the request body from Request to HttpConnection.
  • Uses the buffer provided when calling into_buffered() to buffer writes before they are passed on to the ChunkedBufferWriter

This fixes #71

@rmja
Copy link
Member Author

rmja commented May 17, 2024

cc @lulf @bugadani

@rmja rmja marked this pull request as draft May 17, 2024 15:44
@rmja
Copy link
Member Author

rmja commented May 17, 2024

I could use some help making this better.
The problem is now that there are multiple connection flushes during the writing of a request which is quite annoying.

I feel like it somehow should be possible to buffer internally in in the chunked writer in a way such that the chunks gets as large as possible up to the max buffer size.

Any help is greatly appreciated.

@rmja
Copy link
Member Author

rmja commented May 17, 2024

I have now added a BufferedChunkedBodyWriter which now has the responsibility of both buffer and chunk. It will probably need some tests.

@rmja rmja marked this pull request as ready for review May 21, 2024 07:05
@rmja
Copy link
Member Author

rmja commented May 21, 2024

This is now ready for review. Let me know what you think.

Copy link
Contributor

@bugadani bugadani left a comment

Choose a reason for hiding this comment

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

Looks mostly OK to me, although I wasn't particularly thorough.

src/body_writer.rs Outdated Show resolved Hide resolved
src/body_writer.rs Outdated Show resolved Hide resolved
src/body_writer.rs Show resolved Hide resolved
Copy link
Contributor

@bugadani bugadani left a comment

Choose a reason for hiding this comment

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

Thank you, I especially appreciate the myriad of added tests!

@bugadani bugadani merged commit c9762fe into drogue-iot:main May 21, 2024
1 check 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.

Undesired small chunks when writing buffered chunked body
2 participants