summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0d5896e)
raw | patch | inline | side by side (parent: 0d5896e)
author | Mike Hommey <mh@glandium.org> | |
Sat, 6 Jun 2009 08:43:57 +0000 (16:43 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 6 Jun 2009 18:03:11 +0000 (11:03 -0700) |
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>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c | patch | blob | history |
diff --git a/http-push.c b/http-push.c
index f18da2a26334e6ea00b61cba572d25e4aa92e9c3..c5642b5d4d3dd0565a7a2b08f0f76d6bf30021a7 100644 (file)
--- a/http-push.c
+++ b/http-push.c
static int remote_exists(const char *path)
{
char *url = xmalloc(strlen(repo->url) + strlen(path) + 1);
- struct active_request_slot *slot;
- struct slot_results results;
- int ret = -1;
+ int ret;
sprintf(url, "%s%s", repo->url, path);
- slot = get_active_slot();
- slot->results = &results;
- curl_easy_setopt(slot->curl, CURLOPT_URL, url);
- curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1);
-
- if (start_active_slot(slot)) {
- run_active_slot(slot);
- if (results.http_code == 404)
- ret = 0;
- else if (results.curl_result == CURLE_OK)
- ret = 1;
- else
- fprintf(stderr, "HEAD HTTP error %ld\n", results.http_code);
- } else {
- fprintf(stderr, "Unable to start HEAD request\n");
+ switch (http_get_strbuf(url, NULL, 0)) {
+ case HTTP_OK:
+ ret = 1;
+ break;
+ case HTTP_MISSING_TARGET:
+ ret = 0;
+ break;
+ case HTTP_ERROR:
+ http_error(url, HTTP_ERROR);
+ default:
+ ret = -1;
}
-
free(url);
return ret;
}