-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support apps responding to Expect: 100-continue
#3188
Comments
Corresponding issue on Falcon: socketry/falcon#204 |
Example use-case, respond with a redirect where an upload should go: https://stackoverflow.com/questions/68172230/nginx-behavior-of-expect-100-continue-with-http-redirect |
#3200 |
I've gone through some other server implementations and some docs on how the The Expect: 100-continue header has a special status in HTTP. It allows the client to send an Expect: 100-continue header with the request headers and then pause request sending (i.e. hold back sending the request entity). The server reads the request headers, determines whether it wants to accept the request, and responds with
For us, this means: on puma:
Now, this header is handled in different ways by different clients. For eg: in Curl, If the server doesn't send a '100 Continue' response within a certain time (1 second by default), curl will go ahead and send the body anyway. Current Behaviour on Puma:
Expected Behaviour:
Now my main issue is understanding the last part
How can we implement this in puma. I've gone through the codebase but I'm not 100% sure if this is doable. @dentarg @nateberkopec can you guys help me guide me a bit here? |
I don't know either if it is doable. Maybe the best we can do is offer a hook via the Puma config, similar to the "low level error handler", where the user can define a response to be used instead of having the actual rack app handle the request. If the user returns false from this handler, everything continues like today (Puma sends the 100-continue header, app handles the request). |
Makes sense, will go through the implementation of "low level error handler". Got caught up in some work stuff. |
Idea: You can configure a Proc callback, say, called This
Whaddyathink? |
Yeah that's exactly what I had in mind (but I choose "false" instead of "true" to indicate the NOOP path – maybe good because "true" and array are both considered truthy?) |
Fair enough 👍 |
Sounds good. I'm on a small trip atm. Will pick it up once I'm back this weekend! |
From #519 (comment)
There's a TODO in the code about this:
puma/lib/puma/client.rb
Lines 344 to 349 in b266b49
The text was updated successfully, but these errors were encountered: