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@xxxxxxxxxxxxxx> 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.netI 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:
git push 2001:470:1f05:79::1:1 master
when they mean git push [2001:470:1f05:79::1]:1 master -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Attachment:
signature.asc
Description: Digital signature