From: Johannes Schindelin Date: Sun, 18 Jan 2009 15:14:35 GMT Subject: Re: [WIP Patch 07/12] Use the new http API in http-push.c:fetch_indices() Message-ID: In-Reply-To: <1232265877-3649-8-git-send-email-mh@glandium.org> Hi, On Sun, 18 Jan 2009, Mike Hommey wrote: > @@ -1018,28 +1016,10 @@ static int fetch_indices(void) > url = xmalloc(strlen(remote->url) + 20); > sprintf(url, "%sobjects/info/packs", remote->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, 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); > - free(url); > - if (results.http_code == 404) > - return 0; > - else > - return error("%s", curl_errorstr); > - } > - } else { > - strbuf_release(&buffer); > - free(url); > - return error("Unable to start request"); > + if (http_get_strbuf(url, &buffer, 0) != HTTP_OK) { > + ret = -1; > + goto cleanup; > } Let's make that ret = error("%s", curl_errorstr); okay? Ciao, Dscho