URL:
https://github.com/SSSD/sssd/pull/152
Title: #152: Add a tevent wrapper around libcurl's asynchronous interface
jhrozek commented:
"""
OK, I /hope/ I finally fixed the bug. Here is the diff:
```
diff --git a/src/util/tev_curl.c b/src/util/tev_curl.c
index d6e4d41..b966a78 100644
--- a/src/util/tev_curl.c
+++ b/src/util/tev_curl.c
@@ -672,6 +672,16 @@ static errno_t tcurl_add_headers(struct tcurl_http_state *state,
}
}
+ /* Add a dummy header to suppress libcurl adding Expect 100-continue which
+ * was causing libcurl to always wait for the internal timeout when sending
+ * a PUT/PATCH request
+ */
+ state->curl_headers = curl_slist_append(state->curl_headers,
"Expect:");
+ if (state->curl_headers == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "Cannot add the dummy expect header\n");
+ return ENOMEM;
+ }
+
return EOK;
}
@@ -818,6 +828,11 @@ static errno_t tcurl_set_options(struct tcurl_http_state *state,
return EIO;
}
+ /* Causes libcurl to add a sane Content-Length header */
+ crv = curl_easy_setopt(state->http_handle,
+ CURLOPT_INFILESIZE_LARGE,
+ sss_iobuf_get_size(state->inbuf));
+
ret = tcurl_set_read_options(state);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
```
"""
See the full comment at
https://github.com/SSSD/sssd/pull/152#issuecomment-286228328