From 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 26 May 2020 00:06:52 +0100 Subject: revert(3p/git): Revert merge of git upstream at v2.26.2 This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3. --- third_party/git/http.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'third_party/git/http.c') diff --git a/third_party/git/http.c b/third_party/git/http.c index 5f712634825e..27aa0a319298 100644 --- a/third_party/git/http.c +++ b/third_party/git/http.c @@ -150,7 +150,7 @@ static unsigned long empty_auth_useless = static struct curl_slist *pragma_header; static struct curl_slist *no_pragma_header; -static struct string_list extra_http_headers = STRING_LIST_INIT_DUP; +static struct curl_slist *extra_http_headers; static struct active_request_slot *active_queue_head; @@ -414,9 +414,11 @@ static int http_options(const char *var, const char *value, void *cb) if (!value) { return config_error_nonbool(var); } else if (!*value) { - string_list_clear(&extra_http_headers, 0); + curl_slist_free_all(extra_http_headers); + extra_http_headers = NULL; } else { - string_list_append(&extra_http_headers, value); + extra_http_headers = + curl_slist_append(extra_http_headers, value); } return 0; } @@ -511,11 +513,9 @@ static void set_proxyauth_name_password(CURL *result) #else struct strbuf s = STRBUF_INIT; - strbuf_addstr_urlencode(&s, proxy_auth.username, - is_rfc3986_unreserved); + strbuf_addstr_urlencode(&s, proxy_auth.username, 1); strbuf_addch(&s, ':'); - strbuf_addstr_urlencode(&s, proxy_auth.password, - is_rfc3986_unreserved); + strbuf_addstr_urlencode(&s, proxy_auth.password, 1); curl_proxyuserpwd = strbuf_detach(&s, NULL); curl_easy_setopt(result, CURLOPT_PROXYUSERPWD, curl_proxyuserpwd); #endif @@ -558,7 +558,6 @@ static int has_cert_password(void) return 0; if (!cert_auth.password) { cert_auth.protocol = xstrdup("cert"); - cert_auth.host = xstrdup(""); cert_auth.username = xstrdup(""); cert_auth.path = xstrdup(ssl_cert); credential_fill(&cert_auth); @@ -681,8 +680,8 @@ static void curl_dump_header(const char *text, unsigned char *ptr, size_t size, for (header = headers; *header; header++) { if (hide_sensitive_header) redact_sensitive_header(*header); - strbuf_insertstr((*header), 0, text); - strbuf_insertstr((*header), strlen(text), ": "); + strbuf_insert((*header), 0, text, strlen(text)); + strbuf_insert((*header), strlen(text), ": ", 2); strbuf_rtrim((*header)); strbuf_addch((*header), '\n'); trace_strbuf(&trace_curl, (*header)); @@ -1074,7 +1073,6 @@ void http_init(struct remote *remote, const char *url, int proactive_auth) git_config(urlmatch_config_entry, &config); free(normalized_url); - string_list_clear(&config.vars, 1); #if LIBCURL_VERSION_NUM >= 0x073800 if (http_ssl_backend) { @@ -1201,7 +1199,8 @@ void http_cleanup(void) #endif curl_global_cleanup(); - string_list_clear(&extra_http_headers, 0); + curl_slist_free_all(extra_http_headers); + extra_http_headers = NULL; curl_slist_free_all(pragma_header); pragma_header = NULL; @@ -1625,11 +1624,10 @@ int run_one_slot(struct active_request_slot *slot, struct curl_slist *http_copy_default_headers(void) { - struct curl_slist *headers = NULL; - const struct string_list_item *item; + struct curl_slist *headers = NULL, *h; - for_each_string_list_item(item, &extra_http_headers) - headers = curl_slist_append(headers, item->string); + for (h = extra_http_headers; h; h = h->next) + headers = curl_slist_append(headers, h->data); return headers; } -- cgit 1.4.1