Re: [PATCH/RFC] connect.c: Ignore extra colon after hostname
On Tue, Apr 7, 2015 at 3:50 AM, Torsten Bögershausen <tboegi@web.de> wrote:
> Ignore an extra ':' at the end of the hostname in URL's like
> "ssh://example.com:/path/to/repo"
>
> The colon is ment to separate a port number from the hostname.
Show 35 quoted lines
> If the port is empty, the colon should be ignored, see RFC 3986.
>
> It had been working for URLs with ssh:// scheme, but was unintentionally
> broken in 86ceb3, "allow ssh://user@[2001:db8::1]/repo.git"
>
> Reported-by: Reid Woodbury Jr. <reidw@rawsound.com>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
> diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
> index 02b40b1..1f67bdd 100755
> --- a/t/t5601-clone.sh
> +++ b/t/t5601-clone.sh
> @@ -387,14 +387,18 @@ do
> done
>
> #with ssh:// scheme
> -test_expect_success 'clone ssh://host.xz/home/user/repo' '
> - test_clone_url "ssh://host.xz/home/user/repo" host.xz "/home/user/repo"
> -'
> -
> -# from home directory
> -test_expect_success 'clone ssh://host.xz/~repo' '
> - test_clone_url "ssh://host.xz/~repo" host.xz "~repo"
> +#ignore trailing colon
> +for tcol in "" :
> +do
> + test_expect_success "clone ssh://host.xz$tcol/home/user/repo" '
> + test_clone_url "ssh://host.xz$tcol/home/user/repo" host.xz /home/user/repo
> + '
> + # from home directory
> + test_expect_success "clone ssh://host.xz$tcol/~repo" '
> + test_clone_url "ssh://host.xz$tcol/~repo" host.xz "~repo"
> '
> +done
> +test_done
Unwanted test_done crept in?
> # with port number
> test_expect_success 'clone ssh://host.xz:22/home/user/repo' '