]> git.ipfire.org Git - thirdparty/git.git/commit - http.c
remote-curl: handle URLs without protocol
authorJeff King <peff@peff.net>
Wed, 7 Sep 2016 20:06:42 +0000 (16:06 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Sep 2016 18:23:43 +0000 (11:23 -0700)
commitd63ed6ef241b2e7f124089e2672cfce8251ed390
treee005bef22590f52a842628230b62c257b92f42fa
parent0b65a8dbdb38962e700ee16776a3042beb489060
remote-curl: handle URLs without protocol

Generally remote-curl would never see a URL that did not
have "proto:" at the beginning, as that is what tells git to
run the "git-remote-proto" helper (and git-remote-http, etc,
are aliases for git-remote-curl).

However, the special syntax "proto::something" will run
git-remote-proto with only "something" as the URL. So a
malformed URL like:

  http::/example.com/repo.git

will feed the URL "/example.com/repo.git" to
git-remote-http. The resulting URL has no protocol, but the
code added by 372370f (http: use credential API to handle
proxy authentication, 2016-01-26) does not handle this case
and segfaults.

For the purposes of this code, we don't really care what the
exact protocol; only whether or not it is https. So let's
just assume that a missing protocol is not, and curl will
handle the real error (which is that the URL is nonsense).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c
t/t5550-http-fetch-dumb.sh