Re: [WIP Patch 05/12] Use the new http API in get_refs_via_curl()
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 18, 2009, 15:12 UTC
- Message-ID
- <alpine.DEB.1.00.0901181611380.3586@pacific.mpi-cbg.de>
- In-Reply-To
- <1232265877-3649-6-git-send-email-mh@glandium.org>
Hi,
On Sun, 18 Jan 2009, Mike Hommey wrote:
Show 26 quoted lines
> @@ -450,26 +447,8 @@ static struct ref *get_refs_via_curl(struct transport *transport)
> refs_url = xmalloc(strlen(transport->url) + 11);
> sprintf(refs_url, "%s/info/refs", transport->url);
>
> - slot = get_active_slot();
> - slot->results = &results;
> - curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
> - curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
> - curl_easy_setopt(slot->curl, CURLOPT_URL, refs_url);
> - curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);
> -
> - if (start_active_slot(slot)) {
> - run_active_slot(slot);
> - if (results.curl_result != CURLE_OK) {
> - strbuf_release(&buffer);
> - if (missing_target(&results))
> - die("%s not found: did you run git update-server-info on the server?", refs_url);
> - else
> - die("%s download error - %s", refs_url, curl_errorstr);
> - }
> - } else {
> - strbuf_release(&buffer);
> - die("Unable to start HTTP request");
> - }
> + if (http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE) != HTTP_OK)
> + goto cleanup;Why not die() as the original code?
Ciao, Dscho