Re: [PATCH v2 3/3] archive: support remote archive from stateless transport
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Sep 24, 2023, 13:41 UTC
- Message-ID
- <f4877c36-ff26-4f81-b5dd-63c929ba30c9@gmail.com>
- In-Reply-To
- <20230923152201.14741-4-worldhello.net@gmail.com>
On 23/09/2023 16:22, Jiang Xin wrote:
Show 14 quoted lines
> 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.
Show 6 quoted lines
> 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};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.
Show 11 quoted lines
> 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;
> + }Best Wishes
Phillip