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

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

From
Jiang Xin <worldhello.net@gmail.com>
Date
Sep 24, 2023, 23:36 UTC
Message-ID
<CANYiYbHjk4CX4Uswn4sX-tH3e22uLSHk_4bwjqVO=9MWcfoHnw@mail.gmail.com>
In-Reply-To
<f4877c36-ff26-4f81-b5dd-63c929ba30c9@gmail.com>
On Sun, Sep 24, 2023 at 9:41 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 27 quoted lines
>
> On 23/09/2023 16:22, Jiang Xin wrote:
> > From: Jiang Xin <zhiyou.jx@alibaba-inc.com>
> >
> > Even though we can establish a stateless connection, we still cannot
> > archive the remote repository using a stateless HTTP protocol. Try the
> > following steps to make it work.
> >
> >   1. Add support for "git-upload-archive" service in "http-backend".
> >
> >   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 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.
>
> I'm not familiar enough with the server side of git to comment on
> whether this patch is a good idea, but I did notice one C language issue
> below.
>
> >   static struct string_list *get_parameters(void)
> > @@ -639,10 +640,19 @@ static void check_content_type(struct strbuf *hdr, const char *accepted_type)
> >
> >   static void service_rpc(struct strbuf *hdr, char *service_name)
> >   {
> > -     const char *argv[] = {NULL, "--stateless-rpc", ".", NULL};

For the original implementation, the first NULL is used as a placeholder, and will be initialized somewhere below.

Show 18 quoted lines
> In the pre-image argv[0] is initialized to NULL
>
> > +     const char *argv[4];
>
> In the post-image argv is not initialized and the first element is not
> set in the code below.
>
> >       struct rpc_service *svc = select_service(hdr, service_name);
> >       struct strbuf buf = STRBUF_INIT;
> >
> > +     if (!strcmp(service_name, "git-upload-archive")) {
> > +             argv[1] = ".";
> > +             argv[2] = NULL;
> > +     } else {
> > +             argv[1] = "--stateless-rpc";
> > +             argv[2] = ".";
> > +             argv[3] = NULL;
> > +     }
It will be initialized in the code further below, see http-backend.c:668.
        argv[0] = svc->name;
        run_service(argv, svc->buffer_input);
        strbuf_release(&buf);
Anyway, I will rewrite these code in reroll v3 to follow Eric's suggestion.
> Best Wishes
>
> Phillip
>
Previous: Phillip Wood
Message 61 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.