I\'m writing a simplistic HTTP server that will accept PUT requests mostly from cURL as client and I\'m having a bit of an issue with handling the Expect: 100-continue
If you are using libcURL to write your client-side program, make sure you set the CURLOPT_FAILONERROR option to 1. For example, in C, you would do something like:
curl_easy_setopt (curl_handle, CURLOPT_FAILONERROR, 1L);
According to the libcURL documentation, this option "tells the library to fail silently if the HTTP code returned is equal to or larger than 400."
Furthermore, the documentation makes it clear that "the default action would be to return the page normally, ignoring that code."
If you are using the curl command line tool, simply adding -f or --fail into your curl command will cause similar behaviour as described above. This is also described in the curl man page.
Note that both these methods are not fail-safe, as is clearly stated in the docs:
"This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407)."