sbot

Simple web archiver — self-contained GWTAR archives
git clone git clone https://git.krisyotam.com/krisyotam/sbot.git
Log | Files | Refs | README | LICENSE

fetch.h (644B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #ifndef FETCH_H
      4 #define FETCH_H
      5 
      6 #include <stddef.h>
      7 
      8 /* Retry settings */
      9 #define FETCH_MAX_RETRIES  3
     10 #define FETCH_RETRY_BASE   2  /* base seconds for exponential backoff */
     11 
     12 /* Response structure */
     13 typedef struct {
     14 	char *data;
     15 	size_t size;
     16 	char *content_type;
     17 	long status_code;
     18 	char *final_url;
     19 } Response;
     20 
     21 /* Initialize/cleanup curl globally */
     22 void fetch_init(void);
     23 void fetch_cleanup(void);
     24 
     25 /* Fetch a URL with automatic retry on transient errors */
     26 Response *fetch_url(const char *url);
     27 
     28 /* Free a response */
     29 void response_free(Response *resp);
     30 
     31 #endif /* FETCH_H */