rev-list --remove-empty: add minimum help and doc entry.
[git/dscho.git] / http.h
blobed4ea3340e48307e087a311136d1fe4f74b2d607
1 #ifndef HTTP_H
2 #define HTTP_H
4 #include "cache.h"
6 #include <curl/curl.h>
7 #include <curl/easy.h>
9 #if LIBCURL_VERSION_NUM >= 0x070908
10 #define USE_CURL_MULTI
11 #define DEFAULT_MAX_REQUESTS 5
12 #endif
14 #if LIBCURL_VERSION_NUM < 0x070704
15 #define curl_global_cleanup() do { /* nothing */ } while(0)
16 #endif
17 #if LIBCURL_VERSION_NUM < 0x070800
18 #define curl_global_init(a) do { /* nothing */ } while(0)
19 #endif
21 #if LIBCURL_VERSION_NUM < 0x070c04
22 #define NO_CURL_EASY_DUPHANDLE
23 #endif
25 struct active_request_slot
27 CURL *curl;
28 FILE *local;
29 int in_use;
30 CURLcode curl_result;
31 long http_code;
32 void *callback_data;
33 void (*callback_func)(void *data);
34 struct active_request_slot *next;
37 struct buffer
39 size_t posn;
40 size_t size;
41 void *buffer;
44 /* Curl request read/write callbacks */
45 extern size_t fread_buffer(void *ptr, size_t eltsize, size_t nmemb,
46 struct buffer *buffer);
47 extern size_t fwrite_buffer(const void *ptr, size_t eltsize,
48 size_t nmemb, struct buffer *buffer);
49 extern size_t fwrite_null(const void *ptr, size_t eltsize,
50 size_t nmemb, struct buffer *buffer);
52 /* Slot lifecycle functions */
53 extern struct active_request_slot *get_active_slot(void);
54 extern int start_active_slot(struct active_request_slot *slot);
55 extern void run_active_slot(struct active_request_slot *slot);
56 extern void finish_all_active_slots(void);
58 #ifdef USE_CURL_MULTI
59 extern void fill_active_slots(void);
60 extern void step_active_slots(void);
61 #endif
63 extern void http_init(void);
64 extern void http_cleanup(void);
66 extern int data_received;
67 extern int active_requests;
69 #ifdef USE_CURL_MULTI
70 extern int max_requests;
71 extern CURLM *curlm;
72 #endif
73 #ifndef NO_CURL_EASY_DUPHANDLE
74 extern CURL *curl_default;
75 #endif
76 extern char curl_errorstr[CURL_ERROR_SIZE];
78 extern int curl_ssl_verify;
79 extern char *ssl_cert;
80 #if LIBCURL_VERSION_NUM >= 0x070902
81 extern char *ssl_key;
82 #endif
83 #if LIBCURL_VERSION_NUM >= 0x070908
84 extern char *ssl_capath;
85 #endif
86 extern char *ssl_cainfo;
87 extern long curl_low_speed_limit;
88 extern long curl_low_speed_time;
90 extern struct curl_slist *pragma_header;
91 extern struct curl_slist *no_range_header;
93 extern struct active_request_slot *active_queue_head;
95 #endif /* HTTP_H */