http: make http_get_file() external

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed May 16, 2022 at 20:11 UTC c1d024b84378d099f6ff9bb74e442d17587f3081
2 files changed +11 -2
http.c
+2 -2
@@ -1945,8 +1945,8 @@ int http_get_strbuf(const char *url,
1945 * If a previous interrupted download is detected (i.e. a previous temporary
1946 * file is still around) the download is resumed.
1947 */
1948 -static int http_get_file(const char *url, const char *filename,
1949 - struct http_get_options *options)
1948 +int http_get_file(const char *url, const char *filename,
1949 + struct http_get_options *options)
1950 {
1951 int ret;
1952 struct strbuf tmpfile = STRBUF_INIT;
http.h
+9
@@ -163,6 +163,15 @@ struct http_get_options {
163 */
164 int http_get_strbuf(const char *url, struct strbuf *result, struct http_get_options *options);
165
166 +/*
167 + * Downloads a URL and stores the result in the given file.
168 + *
169 + * If a previous interrupted download is detected (i.e. a previous temporary
170 + * file is still around) the download is resumed.
171 + */
172 +int http_get_file(const char *url, const char *filename,
173 + struct http_get_options *options);
174 +
175 int http_fetch_ref(const char *base, struct ref *ref);
176
177 /* Helpers for fetching packs */