Re: [PATCH 04/11] Resumable clone: add prime-clone to remote-curl

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

 



On Fri, Sep 16, 2016 at 7:12 AM, Kevin Wern <kevin.m.wern@xxxxxxxxx> wrote:
> +static void prime_clone(void)
> +{
> +       char *result, *result_full, *line;
> +       size_t result_len;
> +       int err = 0, one_successful = 0;
> +
> +       if (request_service("git-prime-clone", &result_full, &result,
> +                       &result_len, HTTP_ERROR_GENTLE)) {
> +               while (line = packet_read_line_buf_gentle(&result, &result_len,
> +                                                         NULL)) {
> +                       char *space = strchr(line ,' ');
> +
> +                       // We will eventually support multiple resources, so
> +                       // always parse the whole message
> +                       if (err)
> +                               continue;
> +                       if (!space || strchr(space + 1, ' ')) {
> +                               if (options.verbosity > 1)
> +                                       fprintf(stderr, "prime clone "
> +                                               "protocol error: got '%s'\n",
> +                                               line);
> +                               printf("error\n");
> +                               err = 1;
> +                               continue;
> +                       }
> +
> +                       one_successful = 1;
> +                       printf("%s\n", line);

A brief overview for this service in
Documentation/technical/http-protocol.txt (and maybe
Documentation/gitremote-helpers.txt as well) would be great help. It's
a bit hard to follow because at this point I don't know anything about
the server side (and on top of that I was confused between http
send/receive vs transport send/receive, but this is my fault).

> +               }
> +               if (!one_successful && options.verbosity > 1)
> +                       fprintf(stderr, "did not get required components for "
> +                               "alternate resource\n");
> +       }
> +
> +       printf("\n");
> +       fflush(stdout);
> +       free(result_full);
> +}
-- 
Duy



[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]