commit b1ebf3b36ff38d95f3c552bcddb2ad4c3e910d06 from: Stefan Sperling date: Tue Apr 16 11:34:03 2024 UTC add comments to the HTTP fetching process which clarify how it works commit - 7457011ad491370bd5ae4cbd56c4065715659fc0 commit + b1ebf3b36ff38d95f3c552bcddb2ad4c3e910d06 blob - 53f97cf1eb90762e361151b23bfb6223d09c5302 blob + 8d8ebb693f81dbed4045da8fa1c57f90b2e362a2 --- libexec/got-fetch-http/got-fetch-http.c +++ libexec/got-fetch-http/got-fetch-http.c @@ -381,6 +381,7 @@ get_refs(int https, const char *host, const char *port "service=git-upload-pack", NULL) == -1) goto err; + /* Fetch the initial reference announcement from the server. */ if (http_parse_reply(&bio, &chunked, UPLOAD_PACK_ADV) == -1) goto err; @@ -454,6 +455,10 @@ upload_request(int https, const char *host, const char NULL, UPLOAD_PACK_REQ) == -1) goto err; + /* + * Read have/want lines generated by got-fetch-pack and forward + * them to the server in the POST request body. + */ for (;;) { r = fread(buf, 1, 4, in); if (r != 4) @@ -491,6 +496,7 @@ upload_request(int https, const char *host, const char if (http_parse_reply(&bio, &chunked, UPLOAD_PACK_RES) == -1) goto err; + /* Fetch pack file data from server. */ for (;;) { r = http_read(&bio, chunked, &chunksz, buf, sizeof(buf)); if (r == -1)