git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 18/23] http-push.c::remote_exists(): use the new http API
@ 2009-06-05 16:05 Tay Ray Chuan
  2009-06-05 20:54 ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Tay Ray Chuan @ 2009-06-05 16:05 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Johannes Schindelin, Mike Hommey

From:	Mike Hommey <mh@glandium.org>
Subject: [WIP Patch 08/12] Use the new http API in update_remote_info_refs()
Date:	Sun, 18 Jan 2009 09:04:33 +0100

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 http-push.c |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/http-push.c b/http-push.c
index b01db75..455e0aa 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2005,29 +2005,22 @@ static void update_remote_info_refs(struct remote_lock *lock)
 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;
 }
--
1.6.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 18/23] http-push.c::remote_exists(): use the new http API
  2009-06-05 16:05 [PATCH 18/23] http-push.c::remote_exists(): use the new http API Tay Ray Chuan
@ 2009-06-05 20:54 ` Jakub Narebski
  2009-06-06  1:03   ` Tay Ray Chuan
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2009-06-05 20:54 UTC (permalink / raw)
  To: Tay Ray Chuan
  Cc: Git Mailing List, Junio C Hamano, Johannes Schindelin,
	Mike Hommey

Tay Ray Chuan <rctay89@gmail.com> writes:

> From:	Mike Hommey <mh@glandium.org>
> Subject: [WIP Patch 08/12] Use the new http API in update_remote_info_refs()

What is the subject of this patch:
  "http-push.c::remote_exists(): use the new http API"
or
  "Use the new http API in update_remote_info_refs()"?

> Date:	Sun, 18 Jan 2009 09:04:33 +0100
> 
> Signed-off-by: Mike Hommey <mh@glandium.org>
> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 18/23] http-push.c::remote_exists(): use the new http API
  2009-06-05 20:54 ` Jakub Narebski
@ 2009-06-06  1:03   ` Tay Ray Chuan
  0 siblings, 0 replies; 4+ messages in thread
From: Tay Ray Chuan @ 2009-06-06  1:03 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Git Mailing List, Junio C Hamano, Johannes Schindelin,
	Mike Hommey

Hi,

On Sat, Jun 6, 2009 at 4:54 AM, Jakub Narebski<jnareb@gmail.com> wrote:
> What is the subject of this patch:
>  "http-push.c::remote_exists(): use the new http API"
> or
>  "Use the new http API in update_remote_info_refs()"?

See my reply to patch #19.

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 18/23] http-push.c::remote_exists(): use the new http API
       [not found] <cover.1244277116.git.rctay89@gmail.com>
@ 2009-06-06  8:43 ` Tay Ray Chuan
  0 siblings, 0 replies; 4+ messages in thread
From: Tay Ray Chuan @ 2009-06-06  8:43 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Johannes Schindelin, Mike Hommey

From:	Mike Hommey <mh@glandium.org>

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---

This is based on Mike's earlier patch:

Subject: [WIP Patch 08/12] Use the new http API in update_remote_info_refs()
Date:	Sun, 18 Jan 2009 09:04:33 +0100

 http-push.c |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/http-push.c b/http-push.c
index b01db75..455e0aa 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2005,29 +2005,22 @@ static void update_remote_info_refs(struct remote_lock *lock)
 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;
 }
--
1.6.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-06  8:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-05 16:05 [PATCH 18/23] http-push.c::remote_exists(): use the new http API Tay Ray Chuan
2009-06-05 20:54 ` Jakub Narebski
2009-06-06  1:03   ` Tay Ray Chuan
     [not found] <cover.1244277116.git.rctay89@gmail.com>
2009-06-06  8:43 ` Tay Ray Chuan

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).