http: refactor options to http_get_*
[gitweb.git] / http.h
diff --git a/http.h b/http.h
index d77c1b54f24d142461b9e1a0d11cf6de041bc59f..40404b4836b5599bff75badc9e762d6e8594665f 100644 (file)
--- a/http.h
+++ b/http.h
@@ -125,11 +125,16 @@ extern void append_remote_object_url(struct strbuf *buf, const char *url,
 extern char *get_remote_object_url(const char *url, const char *hex,
                                   int only_two_digit_prefix);
 
-/* Options for http_request_*() */
-#define HTTP_NO_CACHE          1
-#define HTTP_KEEP_ERROR                2
+/* Options for http_get_*() */
+struct http_get_options {
+       unsigned no_cache:1,
+                keep_error:1;
 
-/* Return values for http_request_*() */
+       /* If non-NULL, returns the content-type of the response. */
+       struct strbuf *content_type;
+};
+
+/* Return values for http_get_*() */
 #define HTTP_OK                        0
 #define HTTP_MISSING_TARGET    1
 #define HTTP_ERROR             2
@@ -142,7 +147,7 @@ extern char *get_remote_object_url(const char *url, const char *hex,
  *
  * If the result pointer is NULL, a HTTP HEAD request is made instead of GET.
  */
-int http_get_strbuf(const char *url, struct strbuf *content_type, struct strbuf *result, int options);
+int http_get_strbuf(const char *url, struct strbuf *result, struct http_get_options *options);
 
 extern int http_fetch_ref(const char *base, struct ref *ref);