1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-23 20:46:10 +02:00

remote-curl: unset CURLOPT_FAILONERROR

By not setting CURLOPT_FAILONERROR, curl parses the HTTP response
headers even if the response is an error. This makes GIT_CURL_VERBOSE to
show the HTTP headers, which is useful for debugging.

Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Masaya Suzuki 2019-01-10 11:33:49 -08:00 committed by Junio C Hamano
parent cf2fb92b00
commit b79bdd8c12

View File

@ -547,6 +547,7 @@ static curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp)
struct rpc_in_data {
struct rpc_state *rpc;
struct active_request_slot *slot;
};
/*
@ -558,6 +559,13 @@ static size_t rpc_in(char *ptr, size_t eltsize,
{
size_t size = eltsize * nmemb;
struct rpc_in_data *data = buffer_;
long response_code;
if (curl_easy_getinfo(data->slot->curl, CURLINFO_RESPONSE_CODE,
&response_code) != CURLE_OK)
return size;
if (response_code >= 300)
return size;
if (size)
data->rpc->any_written = 1;
write_or_die(data->rpc->in, ptr, size);
@ -774,7 +782,9 @@ static int post_rpc(struct rpc_state *rpc)
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, rpc_in);
rpc_in_data.rpc = rpc;
rpc_in_data.slot = slot;
curl_easy_setopt(slot->curl, CURLOPT_FILE, &rpc_in_data);
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
rpc->any_written = 0;