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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/09/2023 16:22, Jiang Xin wrote:
From: Jiang Xin <zhiyou.jx@xxxxxxxxxxxxxxx>

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};

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;
+	}

Best Wishes

Phillip




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux