I am using CURLOPT_POST to send an https message. During running, my application stuck at:
Expect: 100-continue
Done waiting for 100-continue
I am using CURLOPT_POST to send an https message. During running, my application stuck at:
Expect: 100-continue
Done waiting for 100-continue
From George's Log -- When curl sends 100-continue, you can set the Expect
header to the empty string:
curl -X POST -H "Expect:" http://mywebsite.com/an/endpoint -F data=@myfile
In particular you can set an empty "Expect:" header in your put / post request. i found some sample code in the post-callback tutorial for curl that contains the following snippet with a DISABLE_EXPECT "sneeze" guard:
#ifdef DISABLE_EXPECT
/*
Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue"
header. You can disable this header with CURLOPT_HTTPHEADER as usual.
NOTE: if you want chunked transfer too, you need to combine these two
since you can only set one list of headers with CURLOPT_HTTPHEADER. */
/* A less good option would be to enforce HTTP 1.0, but that might also
have other implications. */
{
struct curl_slist *chunk = NULL;
chunk = curl_slist_append(chunk, "Expect:");
res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
/* use curl_slist_free_all() after the *perform() call to free this
list again */
}
#endif
i keep an slist of headers to use for put / post requests. adding the equivalent of the above to that list works as advertised:
// Disable Expect: 100-continue
vc->slist = curl_slist_append(vc->slist, "Expect:");
...
curl_easy_setopt(vc->curl, CURLOPT_HTTPHEADER, vc->slist);