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

don't send 100-continue until the body has been read from #139

Merged
merged 5 commits into from
Sep 6, 2020

Conversation

jbr
Copy link
Member

@jbr jbr commented Aug 30, 2020

closes #135. if a client says it expects 100-continue and we never read the body, we never send 100 continue and the client will have the option not to send a body.

this is implemented using a ReadNotifier which forwards BufRead and Read and sends a message on an async channel on first read. a task is spawned for each request which awaits that message and sends 100-continue.

the approach to testing might have been overkill for this pr, but hopefully sets us up to do other complex testing with async-h1

@jbr jbr requested a review from yoshuawuyts August 30, 2020 21:48
@jbr jbr added the enhancement New feature or request label Aug 31, 2020
Copy link
Member

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

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

A few minor nits, but overall this looks great!

@@ -86,11 +88,24 @@ where
"Unexpected Content-Length header"
);

let (sender, receiver) = sync::channel(1);
Copy link
Member

Choose a reason for hiding this comment

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

With regards to #137, using async-channel may actually be better here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure how much that pr/issue actually matters because async-h1 depends on http-types, which also uses unstable

src/read_notifier.rs Outdated Show resolved Hide resolved
src/read_notifier.rs Outdated Show resolved Hide resolved
src/server/decode.rs Outdated Show resolved Hide resolved
src/server/decode.rs Outdated Show resolved Hide resolved
@yoshuawuyts yoshuawuyts merged commit 1641e22 into http-rs:main Sep 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Expect: 100-continue header handling
2 participants