Disable use of Expect: 100-continue. Closes #30

pull/1/merge
Daniel Richman 2012-11-02 16:43:33 +00:00
rodzic 86ba7e2dcc
commit 4955195cbd
3 zmienionych plików z 15 dodań i 1 usunięć

Wyświetl plik

@ -140,7 +140,7 @@ class cURLslist
public:
cURLslist() { slist = NULL; };
void append(const char *s) { curl_slist_append(slist, s); };
void append(const char *s) { slist = curl_slist_append(slist, s); };
~cURLslist() { curl_slist_free_all(slist); };
const struct curl_slist *get() { return slist; };
};

Wyświetl plik

@ -277,8 +277,14 @@ string cURL::post(const string &url, const string &data)
MutexLock lock(mutex);
reset();
/* Disable "Expect: 100-continue" - see issue #30 */
cURLslist headers;
headers.append("Expect:");
setopt(CURLOPT_POSTFIELDS, data.c_str());
setopt(CURLOPT_POSTFIELDSIZE, data.length());
setopt(CURLOPT_HTTPHEADER, headers.get());
return cURL::perform(url);
}
@ -315,7 +321,13 @@ string cURL::put(const string &url, const string &data)
MutexLock lock(mutex);
reset();
/* issue #30 */
cURLslist headers;
headers.append("Expect:");
setopt(CURLOPT_UPLOAD, 1);
setopt(CURLOPT_HTTPHEADER, headers.get());
struct read_func_userdata userdata;
userdata.data = &data;

Wyświetl plik

@ -282,6 +282,8 @@ class MockHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if support_100 and expect_100:
self.wfile.write(self.protocol_version + " 100 Continue\r\n\r\n")
# See issue #30
raise AssertionError("Client used 100-continue!")
length = self.headers.getheader('content-length')
if length: