Skip to content

Commit c1d024b

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1f6cf45 commit c1d024b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

http.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,8 +1945,8 @@ int http_get_strbuf(const char *url,
19451945
* If a previous interrupted download is detected (i.e. a previous temporary
19461946
* file is still around) the download is resumed.
19471947
*/
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)
19501950
{
19511951
int ret;
19521952
struct strbuf tmpfile = STRBUF_INIT;

http.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ struct http_get_options {
163163
*/
164164
int http_get_strbuf(const char *url, struct strbuf *result, struct http_get_options *options);
165165

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+
166175
int http_fetch_ref(const char *base, struct ref *ref);
167176

168177
/* Helpers for fetching packs */

0 commit comments

Comments
 (0)