How do I handle Expect: 100-continue when using BodyDataStream?
#3625
Replies: 2 comments 1 reply
-
|
Can you try |
Beta Was this translation helpful? Give feedback.
-
|
(Using port 9148 because my main instance is on 9149 but it's the same thing) h2 is at 0.4.13, not that it's relevant here. Edit: I probably should clarify that I'm using a slightly updated version of the linked code that fixes a few bugs, but this particular issue behaves identically between the two versions. Just saying that now in case a proposed fix works on the linked code but not on my local copy. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Code with the problem
The code contains a POST endpoint that reads the request body and sends a response body in parallel, allowing clients without access to a decent WebSocket client to process arbitrarily large jobs without having to manually break them up into smaller jobs.
The issue is that when using curl with a large payload, curl sends an
Expect: 100-continueheader and waits 1 second for a 100 response that isn't coming. All issues and discussions I could find seem to say that body extractors with finite limits correctly handle this by sending a 100 response then letting the handler return the real status, but there doesn't seem to be any way to mimic this while accepting arbitrarily large request bodies.The timeline when using
cargo run -p url-cleaner-siteandyes https://example.com | head -n 1000000 | curl http://127.0.0.1:9149/clean --data-binary @-isExpectheader sent to100-continue.What I need to do is somehow inject a "URL Cleaner Site notices the
Expectheader and sends a 100 status" between 1 and 2, thus skipping 3 and 4.While I can pass
-H Expect:to curl to disable the header and waiting, asking every user of a client that does this to find their client's equivalent seems unreasonable for a problem Rocket handles out of the box. Additionally, having the handler notice the header and return a 100 response makes what should be the real response instead be a 502 error.axum version
0.8.8
Beta Was this translation helpful? Give feedback.
All reactions