From: Jeff King Date: Thu, 10 Nov 2011 07:49:20 GMT Subject: [PATCH 04/14] http: add a public function for arbitrary-callback request Message-ID: <20111110074920.GD27950@sigill.intra.peff.net> In-Reply-To: <20111110074330.GA27925@sigill.intra.peff.net> The http_request function recently learned to take arbitrary callbacks; let's expose this functionality to callers. Signed-off-by: Jeff King --- http.c | 6 ++++++ http.h | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/http.c b/http.c index 9ffd894..91451e9 100644 --- a/http.c +++ b/http.c @@ -886,6 +886,12 @@ int http_get_strbuf(const char *url, struct strbuf *result, int options) return http_request_reauth(url, fwrite_buffer, result, 0, options); } +int http_get_callback(const char *url, curl_write_callback cb, + void *data, long offset, int options) +{ + return http_request_reauth(url, cb, data, offset, options); +} + /* * Downloads an url and stores the result in the given file. * diff --git a/http.h b/http.h index ee16069..4977bde 100644 --- a/http.h +++ b/http.h @@ -132,6 +132,9 @@ extern void append_remote_object_url(struct strbuf *buf, const char *url, */ int http_get_strbuf(const char *url, struct strbuf *result, int options); +int http_get_callback(const char *url, curl_write_callback cb, void *data, + long offset, int options); + /* * Prints an error message using error() containing url and curl_errorstr, * and returns ret. -- 1.7.7.2.7.g9f96f