aboutsummaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-14 14:24:18 -0700
committerJunio C Hamano <gitster@pobox.com>2014-03-14 14:24:18 -0700
commitb7de45b58e0ff8ee552a965fa081c4453adfb239 (patch)
tree6a16606b9f77abff40ba655f75ecf3403767185e /http.c
parentbaf9e83c2105527a75c2838d63e290ec87712ca6 (diff)
parentbeed336c3e35acfd7aad9033eb9294e42b9530af (diff)
downloadgit-b7de45b58e0ff8ee552a965fa081c4453adfb239.tar.xz
Merge branch 'jk/http-no-curl-easy'
Uses of curl's "multi" interface and "easy" interface do not mix well when we attempt to reuse outgoing connections. Teach the RPC over http code, used in the smart HTTP transport, not to use the "easy" interface. * jk/http-no-curl-easy: http: never use curl_easy_perform
Diffstat (limited to 'http.c')
-rw-r--r--http.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/http.c b/http.c
index 70eaa26e88..1212c587af 100644
--- a/http.c
+++ b/http.c
@@ -880,6 +880,20 @@ int handle_curl_result(struct slot_results *results)
}
}
+int run_one_slot(struct active_request_slot *slot,
+ struct slot_results *results)
+{
+ slot->results = results;
+ if (!start_active_slot(slot)) {
+ snprintf(curl_errorstr, sizeof(curl_errorstr),
+ "failed to start HTTP request");
+ return HTTP_START_FAILED;
+ }
+
+ run_active_slot(slot);
+ return handle_curl_result(results);
+}
+
static CURLcode curlinfo_strbuf(CURL *curl, CURLINFO info, struct strbuf *buf)
{
char *ptr;
@@ -907,7 +921,6 @@ static int http_request(const char *url,
int ret;
slot = get_active_slot();
- slot->results = &results;
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
if (result == NULL) {
@@ -942,14 +955,7 @@ static int http_request(const char *url,
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "gzip");
- if (start_active_slot(slot)) {
- run_active_slot(slot);
- ret = handle_curl_result(&results);
- } else {
- snprintf(curl_errorstr, sizeof(curl_errorstr),
- "failed to start HTTP request");
- ret = HTTP_START_FAILED;
- }
+ ret = run_one_slot(slot, &results);
if (options && options->content_type)
curlinfo_strbuf(slot->curl, CURLINFO_CONTENT_TYPE,