-
Notifications
You must be signed in to change notification settings - Fork 921
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
Disable the 100-continue feature #293
Comments
any solution? |
Hey, I followed your link and looked up how to disable it, and it sounds like the way is simply to specify it as empty: https://gms.tf/when-curl-sends-100-continue.html#disabling-expect-logic . Have you tried this? |
@xloem Would you like to create a PR for this? |
I'm so sorry, I don't recall at all what I was working with that I visited this issue. I don't understand the issue at this time. |
Here I test this phenomenon with the following codes: Url url{"http://www.example.com"};
std::string filename{"test_file"};
// prepare a file larger than 1 MB
std::string content{std::string(1024 * 1024, 'a')};
std::ofstream test_file;
test_file.open(filename);
test_file << content;
test_file.close();
Session session{};
curl_easy_setopt(session.GetCurlHolder()->handle, CURLOPT_VERBOSE, 1L);
session.SetUrl(url);
session.SetMultipart({{"file", File{"test_file"}}});
Response response = session.Post(); Then I got the following output: * Trying 93.184.216.34:80...
* Connected to www.example.com (93.184.216.34) port 80 (#0)
> POST / HTTP/1.1
Host: www.example.com
User-Agent: curl/7.80.0
Accept: */*
Accept-Encoding: deflate, gzip
Content-Length: 1048777
Content-Type: multipart/form-data; boundary=------------------------be95cef9532534a7
Expect: 100-continue
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Encoding: gzip
< Accept-Ranges: bytes
< Cache-Control: max-age=604800
< Content-Type: text/html; charset=UTF-8
< Date: Tue, 26 Jul 2022 14:13:13 GMT
< Etag: "3147526947+gzip"
< Expires: Tue, 02 Aug 2022 14:13:13 GMT
< Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
< Server: EOS (vny/0453)
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
<
* Connection #0 to host www.example.com left intact Therefore, I used the codes above to create a unit test and PR #798. |
Disable the header "Expect: 100-continue" by default (#293)
Recently I meet the
Session Object
100-continue problem. Once a request failed, the next time the cpr client will sendExpect: 100-continue
in next request with same url. Any idea about how to disable this feature.Related:
https://curl.haxx.se/mail/lib-2017-07/0013.html
The text was updated successfully, but these errors were encountered: