Skip to content
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

Closed
WLBF opened this issue Oct 15, 2018 · 5 comments · Fixed by #798
Closed

Disable the 100-continue feature #293

WLBF opened this issue Oct 15, 2018 · 5 comments · Fixed by #798

Comments

@WLBF
Copy link

WLBF commented Oct 15, 2018

Recently I meet the Session Object 100-continue problem. Once a request failed, the next time the cpr client will send Expect: 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

@fuzzbuster
Copy link

any solution?

@xloem
Copy link
Contributor

xloem commented Sep 23, 2020

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?

@COM8
Copy link
Member

COM8 commented May 17, 2021

@xloem Would you like to create a PR for this?

@xloem
Copy link
Contributor

xloem commented May 17, 2021

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.

@leviliangtw
Copy link
Contributor

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.

@COM8 COM8 linked a pull request Jul 28, 2022 that will close this issue
2 tasks
@COM8 COM8 closed this as completed in #798 Aug 1, 2022
COM8 added a commit that referenced this issue Aug 1, 2022
Disable the header "Expect: 100-continue" by default (#293)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants