diff --git a/habitat/EZ.h b/habitat/EZ.h index d689b6a..2fc1a21 100644 --- a/habitat/EZ.h +++ b/habitat/EZ.h @@ -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; }; }; diff --git a/src/EZ.cxx b/src/EZ.cxx index 269234c..d1ea5c2 100644 --- a/src/EZ.cxx +++ b/src/EZ.cxx @@ -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; diff --git a/tests/test_uploader.py b/tests/test_uploader.py index 1a23d0b..f5dc4e1 100644 --- a/tests/test_uploader.py +++ b/tests/test_uploader.py @@ -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: