git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Daniel Barkalow <barkalow@iabervon.org>,
	Junio C Hamano <gitster@pobox.com>,
	Tay Ray Chuan <rctay89@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	Sverre Rabbelier <srabbelier@gmail.com>
Subject: [PATCH] remote-curl: Add sanity check for url
Date: Wed, 31 Mar 2010 01:38:42 +0530	[thread overview]
Message-ID: <f3271551003301308y683173f6y6a4fadb01b791049@mail.gmail.com> (raw)

Previously, `git remote-http foo` and subsquent commands would try to
work on a HTML page. This patch fixes the bug by making one assumption
about the URL handled by libcurl: it must contain the string "://"

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 remote-curl.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/remote-curl.c b/remote-curl.c
index b76bfcb..9320897 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -112,6 +112,9 @@ static struct discovery* discover_refs(const char *service)
 	}
 	refs_url = strbuf_detach(&buffer, NULL);

+	/* sanity check: does this look like a url expected by libcurl? */
+	if (!strstr(url, "://"))
+		die("%s is not a url supported by this remote helper", url);
 	http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE);

 	/* try again with "plain" url (no ? or & appended) */
-- 
1.7.0.3

             reply	other threads:[~2010-03-30 20:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30 20:08 Ramkumar Ramachandra [this message]
2010-03-30 23:45 ` [PATCH] remote-curl: Add sanity check for url Junio C Hamano
2010-03-31  2:43   ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3271551003301308y683173f6y6a4fadb01b791049@mail.gmail.com \
    --to=artagnon@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rctay89@gmail.com \
    --cc=spearce@spearce.org \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).