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

[PATCH 5/8] http: make http_get_file() external

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
May 16, 2022, 20:11 UTC
Message-ID
<47ecf804d9ce58527b55c6217fb3b6928b8feb8f.1652731865.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1233.git.1652731865.gitgitgadget@gmail.com>
From: Derrick Stolee <derrickstolee@github.com>

This method will be used in an upcoming extension of git-remote-curl to download a single file over HTTP(S) by request.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
---
 http.c | 4 ++--
 http.h | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/http.c b/http.c
index 229da4d1488..04e73149357 100644
--- a/http.c
+++ b/http.c
@@ -1945,8 +1945,8 @@ int http_get_strbuf(const char *url,
  * If a previous interrupted download is detected (i.e. a previous temporary
  * file is still around) the download is resumed.
  */
-static int http_get_file(const char *url, const char *filename,
-			 struct http_get_options *options)
+int http_get_file(const char *url, const char *filename,
+		  struct http_get_options *options)
 {
 	int ret;
 	struct strbuf tmpfile = STRBUF_INIT;
diff --git a/http.h b/http.h
index df1590e53a4..ba303cfb372 100644
--- a/http.h
+++ b/http.h
@@ -163,6 +163,15 @@ struct http_get_options {
  */
 int http_get_strbuf(const char *url, struct strbuf *result, struct http_get_options *options);
 
+/*
+ * Downloads a URL and stores the result in the given file.
+ *
+ * If a previous interrupted download is detected (i.e. a previous temporary
+ * file is still around) the download is resumed.
+ */
+int http_get_file(const char *url, const char *filename,
+		  struct http_get_options *options);
+
 int http_fetch_ref(const char *base, struct ref *ref);
 
 /* Helpers for fetching packs */
-- 
gitgitgadget
Previous: Ævar Arnfjörð Bjarmason via GitGitGadgetNext: Derrick Stolee via GitGitGadget
Message 6 of 9 in “Bundle URIs: Prepatory patches”
  1. 0/8 Bundle URIs: Prepatory patchesDerrick Stolee via GitGitGadget, May 16, 2022
  2. 1/8 connect.c: refactor sending of agent & object-formatÆvar Arnfjörð Bjarmason via GitGitGadget, May 16, 2022
  3. 2/8 dir API: add a generalized path_match_flags() functionÆvar Arnfjörð Bjarmason via GitGitGadget, May 16, 2022
  4. 3/8 fetch-pack: add a deref_without_lazy_fetch_extended()Ævar Arnfjörð Bjarmason via GitGitGadget, May 16, 2022
  5. 4/8 fetch-pack: move --keep=* option filling to a functionÆvar Arnfjörð Bjarmason via GitGitGadget, May 16, 2022
  6. 5/8 http: make http_get_file() externalDerrick Stolee via GitGitGadget, May 16, 2022
  7. 6/8 remote: move relative_url()Derrick Stolee via GitGitGadget, May 16, 2022
  8. 7/8 remote: allow relative_url() to return an absolute urlDerrick Stolee via GitGitGadget, May 16, 2022
  9. 8/8 bundle.h: make "fd" version of read_bundle_header() publicÆvar Arnfjörð Bjarmason via GitGitGadget, May 16, 2022

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.