aboutsummaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-03-07 12:47:15 -0800
committerJunio C Hamano <gitster@pobox.com>2010-03-07 12:47:15 -0800
commit92db3fb95c8f42e35664f01b62a12080b172c3f5 (patch)
treeb02c4a35ee0fae29c36393ca732f03be4105b04a /transport.c
parentc2b456b8956c2091318edaee362119e0e96b86b7 (diff)
parent53a52ff33d42faf2dcceea5b33f8049bd9416555 (diff)
downloadgit-92db3fb95c8f42e35664f01b62a12080b172c3f5.tar.gz
git-92db3fb95c8f42e35664f01b62a12080b172c3f5.tar.xz
Merge branch 'il/loosen-remote-helper-names'
* il/loosen-remote-helper-names: Allow '+', '-' and '.' in remote helper names
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/transport.c b/transport.c
index 1a360cfb4..f07bd33e8 100644
--- a/transport.c
+++ b/transport.c
@@ -870,6 +870,21 @@ static int is_file(const char *url)
return S_ISREG(buf.st_mode);
}
+static int isurlschemechar(int first_flag, int ch)
+{
+ /*
+ * The set of valid URL schemes, as per STD66 (RFC3986) is
+ * '[A-Za-z][A-Za-z0-9+.-]*'. But use sightly looser check
+ * of '[A-Za-z0-9][A-Za-z0-9+.-]*' because earlier version
+ * of check used '[A-Za-z0-9]+' so not to break any remote
+ * helpers.
+ */
+ int alphanumeric, special;
+ alphanumeric = ch > 0 && isalnum(ch);
+ special = ch == '+' || ch == '-' || ch == '.';
+ return alphanumeric || (!first_flag && special);
+}
+
static int is_url(const char *url)
{
const char *url2, *first_slash;
@@ -894,7 +909,7 @@ static int is_url(const char *url)
*/
url2 = url;
while (url2 < first_slash - 1) {
- if (!isalnum((unsigned char)*url2))
+ if (!isurlschemechar(url2 == url, (unsigned char)*url2))
return 0;
url2++;
}
@@ -928,7 +943,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
if (url) {
const char *p = url;
- while (isalnum(*p))
+ while (isurlschemechar(p == url, *p))
p++;
if (!prefixcmp(p, "::"))
helper = xstrndup(url, p - url);