git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] remote-curl: Add sanity check for url

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Mar 30, 2010, 20:08 UTC
Message-ID
<f3271551003301308y683173f6y6a4fadb01b791049@mail.gmail.com>

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
Next: Junio C Hamano
Message 1 of 3 in “remote-curl: Add sanity check for url”
  1. remote-curl: Add sanity check for urlRamkumar Ramachandra, Mar 30, 2010
  2. Junio C HamanoMar 30, 2010
  3. Ramkumar RamachandraMar 31, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.