connect & http: support -4 and -6 switches for remote operations
Sometimes it is necessary to force IPv4-only or IPv6-only operation on networks where name lookups may return a non-routable address and stall remote operations. The ssh(1) command has an equivalent switches which we may pass when we run them. There may be old ssh(1) implementations out there which do not support these switches; they should report the appropriate error in that case. rsync support is untouched for now since it is deprecated and scheduled to be removed. Signed-off-by: Eric Wong <normalperson@yhbt.net> Reviewed-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f3ee9ca53b
commit
c915f11eb4
@ -489,6 +489,12 @@ static int connect_setup(struct transport *transport, int for_push)
|
||||
if (data->conn)
|
||||
return 0;
|
||||
|
||||
switch (transport->family) {
|
||||
case TRANSPORT_FAMILY_ALL: break;
|
||||
case TRANSPORT_FAMILY_IPV4: flags |= CONNECT_IPV4; break;
|
||||
case TRANSPORT_FAMILY_IPV6: flags |= CONNECT_IPV6; break;
|
||||
}
|
||||
|
||||
data->conn = git_connect(data->fd, transport->url,
|
||||
for_push ? data->options.receivepack :
|
||||
data->options.uploadpack,
|
||||
|
Reference in New Issue
Block a user