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
Handling Expect-100 Continue header #3200
base: master
Are you sure you want to change the base?
Conversation
…gins reading the body
lib/puma/client.rb
Outdated
# going forward | ||
@io << HTTP_11_100 | ||
@io.flush | ||
# Determine if a redirect is needed, this could be a function call that encapsulates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to understand if this is what's expected
Will clean up the PR once I understand I am on the right path to solving this issue. |
This doesn't look correct to me. We want to application to define the response (e.g. the 307 redirect). |
The best guidance I can give you is to look at how the Python |
Probably good to drive the implementation using tests. |
Ah, okay. Will look into this. Thanks a lot! |
Where are client specific tests written? cant figure it out, or there arent any? |
|
lib/puma/request.rb
Outdated
@@ -585,8 +585,10 @@ def str_headers(env, status, headers, res_body, io_buffer, force_keep_alive) | |||
# reply with the proper 200 status without having to compute | |||
# the response header. | |||
# | |||
if status == 200 | |||
if status == 200 && !expect_100_continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the best way to handle this
@@ -99,6 +99,14 @@ def test_nonexistent_http_method | |||
socket.close | |||
end | |||
|
|||
def test_expect_100_header |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Hey @dentarg, I have 4 doubts:
|
Also, whats the diff between test_puma_server vs test_web_server tests? |
# TODO allow a hook here to check the headers before | ||
# going forward | ||
@io << HTTP_11_100 | ||
@io.flush | ||
@http_expect_100_continue_header_present = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure we don't want to remove the current behaviour of responding quickly to Expect: 100 Continue
and that allowing the app to define the response should be something the user opt-in to (via the Puma config probably)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Or at least, we should keep that behavior UNLESS the user/app says they want something else).
This seems like a fine place to start for me. Next step would be a config setting that allows the user to define what to do if a Expect: 100 is encountered. |
…gins reading the body
Description
Please describe your pull request. Thank you for contributing! You're the best.
Your checklist for this pull request
[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.