summaryrefslogtreecommitdiff
path: root/xs_curl.h
diff options
context:
space:
mode:
authorGravatar default2023-01-24 15:06:58 +0100
committerGravatar default2023-01-24 15:06:58 +0100
commitfd1e281cbae03ced989631abd400062af81c48c2 (patch)
tree6ad8e8fca29c57af3ece6b470868df6c8607fb76 /xs_curl.h
parentBackport from xs. (diff)
downloadsnac2-fd1e281cbae03ced989631abd400062af81c48c2.tar.gz
snac2-fd1e281cbae03ced989631abd400062af81c48c2.tar.xz
snac2-fd1e281cbae03ced989631abd400062af81c48c2.zip
Use a shorter timeout for first output connections.
Diffstat (limited to 'xs_curl.h')
-rw-r--r--xs_curl.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/xs_curl.h b/xs_curl.h
index bed643c..09f51d6 100644
--- a/xs_curl.h
+++ b/xs_curl.h
@@ -5,8 +5,8 @@
5#define _XS_CURL_H 5#define _XS_CURL_H
6 6
7d_char *xs_http_request(char *method, char *url, d_char *headers, 7d_char *xs_http_request(char *method, char *url, d_char *headers,
8 d_char *body, int b_size, 8 d_char *body, int b_size, int *status,
9 int *status, d_char **payload, int *p_size); 9 d_char **payload, int *p_size, int timeout);
10 10
11#ifdef XS_IMPLEMENTATION 11#ifdef XS_IMPLEMENTATION
12 12
@@ -84,8 +84,8 @@ static int _post_callback(char *buffer, size_t size,
84 84
85 85
86d_char *xs_http_request(char *method, char *url, d_char *headers, 86d_char *xs_http_request(char *method, char *url, d_char *headers,
87 d_char *body, int b_size, 87 d_char *body, int b_size, int *status,
88 int *status, d_char **payload, int *p_size) 88 d_char **payload, int *p_size, int timeout)
89/* does an HTTP request */ 89/* does an HTTP request */
90{ 90{
91 d_char *response; 91 d_char *response;
@@ -101,7 +101,10 @@ d_char *xs_http_request(char *method, char *url, d_char *headers,
101 101
102 curl_easy_setopt(curl, CURLOPT_URL, url); 102 curl_easy_setopt(curl, CURLOPT_URL, url);
103 103
104 curl_easy_setopt(curl, CURLOPT_TIMEOUT, 8L); 104 if (timeout <= 0)
105 timeout = 8;
106
107 curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long) timeout);
105 108
106#ifdef FORCE_HTTP_1_1 109#ifdef FORCE_HTTP_1_1
107 /* force HTTP/1.1 */ 110 /* force HTTP/1.1 */