DORMANTno replies

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

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:48:31
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help