summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 28307b9)
raw | patch | inline | side by side (parent: 28307b9)
author | Mike Hommey <mh@glandium.org> | |
Sat, 6 Jun 2009 08:43:55 +0000 (16:43 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 6 Jun 2009 18:03:10 +0000 (11:03 -0700) |
The error message ("Unable to start request") has been removed, since
the http API already prints it.
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the http API already prints it.
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c | patch | blob | history |
index df22180778c2eca8be9f14029e2ca380a6de71f1..2a493720126009fad0eba12fcadbae7264d5b72b 100644 (file)
--- a/http.c
+++ b/http.c
{
char *url;
struct strbuf buffer = STRBUF_INIT;
- struct active_request_slot *slot;
- struct slot_results results;
- int ret;
+ int ret = -1;
url = quote_ref_url(base, ref->name);
- 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_HTTPHEADER, NULL);
- curl_easy_setopt(slot->curl, CURLOPT_URL, url);
- if (start_active_slot(slot)) {
- run_active_slot(slot);
- if (results.curl_result == CURLE_OK) {
- strbuf_rtrim(&buffer);
- if (buffer.len == 40)
- ret = get_sha1_hex(buffer.buf, ref->old_sha1);
- else if (!prefixcmp(buffer.buf, "ref: ")) {
- ref->symref = xstrdup(buffer.buf + 5);
- ret = 0;
- } else
- ret = 1;
- } else {
- ret = error("Couldn't get %s for %s\n%s",
- url, ref->name, curl_errorstr);
+ if (http_get_strbuf(url, &buffer, HTTP_NO_CACHE) == HTTP_OK) {
+ strbuf_rtrim(&buffer);
+ if (buffer.len == 40)
+ ret = get_sha1_hex(buffer.buf, ref->old_sha1);
+ else if (!prefixcmp(buffer.buf, "ref: ")) {
+ ref->symref = xstrdup(buffer.buf + 5);
+ ret = 0;
}
- } else {
- ret = error("Unable to start request");
}
strbuf_release(&buffer);