transport-helper: no connection restriction in connect_helper
commit4a61faf75d684eb31c23521bc0e3c3cac5fd1553
authorJiang Xin <zhiyou.jx@alibaba-inc.com>
Sun, 21 Jan 2024 13:15:33 +0000 (21 21:15 +0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Jan 2024 15:54:37 +0000 (22 07:54 -0800)
tree9881bd0f5ce5621c3127eef2c383a197d5e99846
parentbcb6cae2966cc407ca1afc77413b3ef11103c175
transport-helper: no connection restriction in connect_helper

When commit b236752a (Support remote archive from all smart transports,
2009-12-09) added "remote archive" support for "smart transports", it
was for transport that supports the ".connect" method. The
"connect_helper()" function protected itself from getting called for a
transport without the method before calling process_connect_service(),
which only worked with the ".connect" method.

Later, commit edc9caf7 (transport-helper: introduce stateless-connect,
2018-03-15) added a way for a transport without the ".connect" method
to establish a "stateless" connection in protocol v2, where
process_connect_service() was taught to handle the ".stateless_connect"
method, making the old protection too strict. But commit edc9caf7 forgot
to adjust this protection accordingly. Even at the time of commit
b236752a, this protection seemed redundant, since
process_connect_service() would return 0 if the connection could not be
established, and connect_helper() would still die() early.

Remove the restriction in connect_helper() and give the function
process_connect_service() the opportunity to establish a connection
using ".connect" or ".stateless_connect" for protocol v2. So we can
connect with a stateless-rpc and do something useful. E.g., in a later
commit, implements remote archive for a repository over HTTP protocol.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Linus Arver <linusa@google.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
transport-helper.c