git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/3] support remote archive from stateless transport

From
Jiang Xin <worldhello.net@gmail.com>
Date
Sep 23, 2023, 15:21 UTC
Message-ID
<20230923152201.14741-1-worldhello.net@gmail.com>
In-Reply-To
<xmqqy1h2f5dv.fsf@gitster.g>
From: Jiang Xin <zhiyou.jx@alibaba-inc.com>

Enable stateless-rpc connection in "connect_helper()", and add support for remote archive from a stateless transport.

range-diff v1...v2:
1:  4457ca910b ! 1:  6fabd4dcab transport-helper: no connection restriction in connect_helper
    @@ Metadata
      ## Commit message ##
         transport-helper: no connection restriction in connect_helper
     
    -    For protocol-v2, "stateless-connection" can be used to establish a
    -    stateless connection between the client and the server, but trying to
    -    establish http connection by calling "transport->vtable->connect" will
    -    fail. This restriction was first introduced in commit b236752a87
    -    (Support remote archive from all smart transports, 2009-12-09) by
    -    adding a limitation in the "connect_helper()" function.
    +    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 did not work with such a transport.
     
    -    Remove the restriction in the "connect_helper()" function and use the
    -    logic in the "process_connect_service()" function to check the protocol
    -    version and service name. By this way, we can make a connection and do
    -    something useful. E.g., in a later commit, implements remote archive
    -    for a repository over HTTP protocol.
    +    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, which
    +    process_connect_service() was taught to handle the "stateless"
    +    connection, making the old safety valve in its caller that insisted
    +    that ".connect" method must be defined too strict, and forgot to loosen
    +    it.
     
    +    Remove the restriction in the "connect_helper()" function 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>
         Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
     
      ## transport-helper.c ##
-:  ---------- > 2:  1d687abc7e transport-helper: run do_take_over in connect_helper
2:  d4242d1f27 ! 3:  051d66f48e archive: support remote archive from stateless transport
    @@ Commit message
     
          1. Add support for "git-upload-archive" service in "http-backend".
     
    -     2. Unable to access the URL ".../info/refs?service=git-upload-archive"
    -        to detect the protocol version, use the "git-upload-pack" service
    -        instead.
    +     2. Use the URL ".../info/refs?service=git-upload-pack" to detect the
    +        protocol version, instead of use the "git-upload-archive" service.
     
    -     3. "git-archive" does not resolve the protocol version and capabilities
    -        when connecting to remote-helper, so the remote-helper should not
    -        send them.
    -
    -     4. "git-archive" may not be able to disconnect the stateless
    -        connection. Run "do_take_over()" to take_over the transfer for
    -        a graceful disconnect function.
    +     3. "git-archive" does not expect to see protocol version and
    +        capabilities when connecting to remote-helper, so do not send them
    +        in "remote-curl.c" for the "git-upload-archive" service.
     
         Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
     
    @@ transport-helper.c: static int process_connect_service(struct transport *transpo
      		strbuf_addf(&cmdbuf, "stateless-connect %s\n", name);
      		ret = run_connect(transport, &cmdbuf);
      		if (ret)
    -@@ transport-helper.c: static int connect_helper(struct transport *transport, const char *name,
    - 
    - 	fd[0] = data->helper->out;
    - 	fd[1] = data->helper->in;
    -+
    -+	do_take_over(transport);
    - 	return 0;
    - }
    - 
Jiang Xin (3):
  transport-helper: no connection restriction in connect_helper
  transport-helper: run do_take_over in connect_helper
  archive: support remote archive from stateless transport
 http-backend.c         | 15 +++++++++++++--
 remote-curl.c          | 14 +++++++++++---
 t/t5003-archive-zip.sh | 30 ++++++++++++++++++++++++++++++
 transport-helper.c     |  7 ++++---
 4 files changed, 58 insertions(+), 8 deletions(-)
-- 
2.40.1.50.gf560bcc116.dirty
Previous: Jiang XinNext: Junio C Hamano
Message 5 of 61 in “transport-helper: no connection restriction in connect_helper”
  1. 1/2 transport-helper: no connection restriction in connect_helperJiang Xin, Sep 19, 2023
  2. 2/2 archive: support remote archive from stateless transportJiang Xin, Sep 19, 2023
  3. Junio C HamanoSep 19, 2023
  4. Jiang XinSep 20, 2023
  5. 0/3 support remote archive from stateless transportJiang Xin, Sep 23, 2023
  6. Junio C HamanoSep 25, 2023
  7. Jiang XinSep 26, 2023
  8. 1/3 transport-helper: no connection restriction in connect_helperJiang Xin, Sep 23, 2023
  9. Junio C HamanoSep 25, 2023
  10. 2/3 transport-helper: run do_take_over in connect_helperJiang Xin, Sep 23, 2023
  11. Junio C HamanoSep 25, 2023
  12. Jiang XinOct 4, 2023
  13. 0/4 support remote archive from stateless transportJiang Xin, Oct 4, 2023
  14. 1/4 transport-helper: no connection restriction in connect_helperJiang Xin, Oct 4, 2023
  15. 3/4 transport-helper: call do_take_over() in connect_helperJiang Xin, Oct 4, 2023
  16. 4/4 archive: support remote archive from stateless transportJiang Xin, Oct 4, 2023
  17. 2/4 transport-helper: call do_take_over() in process_connectJiang Xin, Oct 4, 2023
  18. Junio C HamanoOct 4, 2023
  19. 0/4 support remote archive via stateless transportJiang Xin, Dec 14, 2023
  20. 1/4 transport-helper: no connection restriction in connect_helperJiang Xin, Dec 14, 2023
  21. Linus ArverJan 12, 2024
  22. Junio C HamanoJan 12, 2024
  23. Jiang XinJan 16, 2024
  24. Linus ArverJan 18, 2024
  25. Jiang XinJan 19, 2024
  26. Linus ArverJan 20, 2024
  27. 2/4 transport-helper: call do_take_over() in process_connectJiang Xin, Dec 14, 2023
  28. 3/4 transport-helper: call do_take_over() in connect_helperJiang Xin, Dec 14, 2023
  29. Linus ArverJan 12, 2024
  30. Jiang XinJan 16, 2024
  31. 4/4 archive: support remote archive from stateless transportJiang Xin, Dec 14, 2023
  32. Linus ArverJan 12, 2024
  33. 0/6 support remote archive via stateless transportJiang Xin, Jan 16, 2024
  34. 1/6 transport-helper: no connection restriction in connect_helperJiang Xin, Jan 16, 2024
  35. Linus ArverJan 20, 2024
  36. 2/6 remote-curl: supports git-upload-archive serviceJiang Xin, Jan 16, 2024
  37. Linus ArverJan 20, 2024
  38. 3/6 transport-helper: protocol-v2 supports upload-archiveJiang Xin, Jan 16, 2024
  39. 4/6 http-backend: new rpc-service for git-upload-archiveJiang Xin, Jan 16, 2024
  40. 5/6 transport-helper: call do_take_over() in connect_helperJiang Xin, Jan 16, 2024
  41. Linus ArverJan 20, 2024
  42. 6/6 transport-helper: call do_take_over() in process_connectJiang Xin, Jan 16, 2024
  43. Linus ArverJan 20, 2024
  44. Jiang XinJan 21, 2024
  45. 0/6 support remote archive via stateless transportJiang Xin, Jan 21, 2024
  46. 1/6 transport-helper: no connection restriction in connect_helperJiang Xin, Jan 21, 2024
  47. 2/6 remote-curl: supports git-upload-archive serviceJiang Xin, Jan 21, 2024
  48. 3/6 transport-helper: protocol v2 supports upload-archiveJiang Xin, Jan 21, 2024
  49. 4/6 http-backend: new rpc-service for git-upload-archiveJiang Xin, Jan 21, 2024
  50. 5/6 transport-helper: call do_take_over() in connect_helperJiang Xin, Jan 21, 2024
  51. 6/6 transport-helper: call do_take_over() in process_connectJiang Xin, Jan 21, 2024
  52. Linus ArverJan 21, 2024
  53. Junio C HamanoJan 22, 2024
  54. 3/3 archive: support remote archive from stateless transportJiang Xin, Sep 23, 2023
  55. Eric SunshineSep 24, 2023
  56. Jiang XinSep 24, 2023
  57. rsbecker@nexbridge.comSep 24, 2023
  58. Jiang XinSep 25, 2023
  59. rsbecker@nexbridge.comSep 25, 2023
  60. Phillip WoodSep 24, 2023
  61. Jiang XinSep 24, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.