kopia lustrzana https://github.com/ukhas/habitat-cpp-connector
Disable use of Expect: 100-continue. Closes #30
rodzic
86ba7e2dcc
commit
4955195cbd
|
@ -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; };
|
||||
};
|
||||
|
|
12
src/EZ.cxx
12
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;
|
||||
|
|
|
@ -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:
|
||||
|
|
Ładowanie…
Reference in New Issue