diff options
| author | default <nobody@localhost> | 2023-01-24 15:06:58 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2023-01-24 15:06:58 +0100 |
| commit | fd1e281cbae03ced989631abd400062af81c48c2 (patch) | |
| tree | 6ad8e8fca29c57af3ece6b470868df6c8607fb76 /xs_curl.h | |
| parent | 4baf56c4ce2c02363ed04cf11c068c6cbffcf199 (diff) | |
Use a shorter timeout for first output connections.
Diffstat (limited to 'xs_curl.h')
| -rw-r--r-- | xs_curl.h | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -5,8 +5,8 @@ #define _XS_CURL_H d_char *xs_http_request(char *method, char *url, d_char *headers, - d_char *body, int b_size, - int *status, d_char **payload, int *p_size); + d_char *body, int b_size, int *status, + d_char **payload, int *p_size, int timeout); #ifdef XS_IMPLEMENTATION @@ -84,8 +84,8 @@ static int _post_callback(char *buffer, size_t size, d_char *xs_http_request(char *method, char *url, d_char *headers, - d_char *body, int b_size, - int *status, d_char **payload, int *p_size) + d_char *body, int b_size, int *status, + d_char **payload, int *p_size, int timeout) /* does an HTTP request */ { d_char *response; @@ -101,7 +101,10 @@ d_char *xs_http_request(char *method, char *url, d_char *headers, curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_TIMEOUT, 8L); + if (timeout <= 0) + timeout = 8; + + curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long) timeout); #ifdef FORCE_HTTP_1_1 /* force HTTP/1.1 */ |