From: "Torsten Bögershausen" <tboegi@web.de>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
"Torsten Bögershausen" <tboegi@web.de>,
git@vger.kernel.org, lists@hcf.yourweb.de
Subject: Re: [PATCH 1/3] connect.c: Improve parsing of literal IPV6 addresses
Date: Thu, 22 Jan 2015 23:05:29 +0100 [thread overview]
Message-ID: <54C17429.1090403@web.de> (raw)
In-Reply-To: <20150122200702.GA96498@vauxhall.crustytoothpaste.net>
On 2015-01-22 21.07, brian m. carlson wrote:
> On Mon, Jan 19, 2015 at 06:21:24PM +0100, Torsten Bögershausen wrote:
>> When parsing an URL, older Git versions did handle
>> URLs like ssh://2001:db8::1/repo.git the same way as
>> ssh://[2001:db8::1]/repo.git
>>
>> Commit 83b058 broke the parsing of IPV6 adresses without "[]":
>> It was written in mind that the fist ':' in a URL was the beginning of a
>> port number, while the old code was more clever:
>> Literal IPV6 addresses have always at least two ':'.
>> When the "hostandport" had a ':' and the rest of the hostandport string
>> could be parsed into an integer between 0 and 65536, then it was used
>> as a port number, like "host:22".
>> Otherwise the first ':' was assumed to be part of a literal IPV6 address,
>> like "ssh://[2001:db8::1]/repo.git" or "ssh://[::1]/repo.git".
>>
>> Re-introduce the old parsing in get_host_and_port().
>>
>> Improve the parsing to handle URLs which have a user name and a literal
>> IPV6 like "ssh://user@[2001:db8::1]/repo.git".
>> (Thanks to Christian Taube <lists@hcf.yourweb.de> for reporting this long
>> standing issue)
>>
>> Another regression was introduced in 83b058:
>> A non-RFC conform URL like "[localhost:222]" could be used in older versions
>> of Git to connect to run "ssh -p 222 localhost".
>> The new stricter parsing did not allow this any more.
>> See even 8d3d28f5dba why "[localhost:222]" should be declared a feature.
>
> I'm not sure this is a very good idea. While this may have worked in the past, it's also completely inconsistent with the way all non-SSH URLs work in Git:
>
> vauxhall ok % git push https://bmc@2001:470:1f05:79::1/git/bmc/homedir.git master
> fatal: unable to access 'https://bmc@2001:470:1f05:79::1/git/bmc/homedir.git/': IPv6 numerical address used in URL without brackets
>
> vauxhall no % git push https://bmc@[castro.crustytoothpaste.net]/git/bmc/homedir.git master
> fatal: unable to access 'https://bmc@[castro.crustytoothpaste.net]/git/bmc/homedir.git/': Could not resolve host: [castro.crustytoothpaste.net]
>
> vauxhall no % git push https://bmc@[castro.crustytoothpaste.net:443]/git/bmc/homedir.git master
> fatal: unable to access 'https://bmc@[castro.crustytoothpaste.net:443]/git/bmc/homedir.git/': Could not resolve host: [castro.crustytoothpaste.net
>
> I would argue that people using IPv6 literals in URLs should already know how to do it correctly, and the consistency between SSH and HTTPS URLs is a feature, not a bug. In the non-URL SSH form, you still have to use the bracketed form to deal with the case in which somebody creates a directory called "1" in their home directory and writes:
>
We want to support ssh://bmc@2001:470:1f05:79::1/git/bmc/homedir.git/
because e.g. the Git shipped with Debian (1.7.10.4) (and a lot of other installations) supports it.
We want to support ssh://bmc@[2001:470:1f05:79::1]/git/bmc/homedir.git/
because that is what other people may expect to work as well:
ssh://bmc@[2001:470:1f05:79::1]:4444/git/bmc/homedir.git/
> git push 2001:470:1f05:79::1:1 master
> when they mean
>
> git push [2001:470:1f05:79::1]:1 master
That I don't understand this, where is the path name in your example ?
Everything after the first ':' is the path in the short form:
bmc@hostxx:/git/bmc/homedir.git/
If you really want to use a literal IPV6 with the short form, you must use the brackets:
bmc@[2001:470:1f05:79::1]:/git/bmc/homedir.git/
(And you can not have a port number here)
Nobody forces somebody to use any specific form.
next prev parent reply other threads:[~2015-01-22 22:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 17:21 [PATCH 1/3] connect.c: Improve parsing of literal IPV6 addresses Torsten Bögershausen
2015-01-22 20:07 ` brian m. carlson
2015-01-22 22:05 ` Torsten Bögershausen [this message]
2015-01-22 23:41 ` brian m. carlson
2015-02-18 18:40 ` Junio C Hamano
2015-02-19 16:42 ` Torsten Bögershausen
2015-02-19 17:54 ` Junio C Hamano
2015-02-19 19:40 ` brian m. carlson
2015-02-20 22:11 ` Torsten Bögershausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54C17429.1090403@web.de \
--to=tboegi@web.de \
--cc=git@vger.kernel.org \
--cc=lists@hcf.yourweb.de \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.