-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
curl should repeat a request without a 100-continue expectation when receiving an HTTP 417 (Expectation Failed) status code #4949
Comments
Digging deeper I notice that curl sends over the post body no matter what the server does. The request is sent in two parts (headers + body), unless the server has already closed the connection after having received the headers. |
This is indeed a bug. 417 is just a very unusual response code so we've never had reason to implement this properly before. Two additional comments:
If it does, it is a (separate) bug. |
Regarding “curl sends over the post body no matter what the server does”, I found this in the spec so it's allowed:
By default curl waits 1 second. The timeout is configurable through the |
That's not "no matter what the server does" though. That's when the server doesn't provide 100 within the timeout. And if the server returns an error instead, curl shouldn't send the body either. |
When doind a request with a body + Expect: 100-continue and the server responds with a 417, the same request will be retried immediately without the Expect: header. Added test 357 to verify. Also added a control instruction to tell the sws test server to not read the request body if Expect: is present, which the new test 357 uses. Fixes #4949
When doing a request with a body + Expect: 100-continue and the server responds with a 417, the same request will be retried immediately without the Expect: header. Added test 357 to verify. Also added a control instruction to tell the sws test server to not read the request body if Expect: is present, which the new test 357 uses. Reported-by: bramus on github Fixes #4949
I did this
(Nice of you curl, to warn the server about a "huge" incoming payload 😊)
I expected the following
I expected curl to repeat the entire request without the
Expect: 100-continue
header, as per HTTP specification:Instead curl just sent the data over the connection, as if it had received an
HTTP/1.1 100 Continue
.curl/libcurl version
operating system
macOS 10.15.2 (19C57)
The text was updated successfully, but these errors were encountered: