Skip to content

Commit

Permalink
Added support for new curl option: CURLOPT_CONNECTTIMEOUT_MS
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Shurdesov committed Jan 9, 2024
1 parent 5e72b80 commit 1f3597b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ Select [CURL options](https://curl.haxx.se/libcurl/c/curl_easy_setopt.html) are
* [CURLOPT_TCP_KEEPALIVE](https://curl.haxx.se/libcurl/c/CURLOPT_TCP_KEEPALIVE.html)
* [CURLOPT_TCP_KEEPIDLE](https://curl.haxx.se/libcurl/c/CURLOPT_TCP_KEEPIDLE.html)
* [CURLOPT_CONNECTTIMEOUT](https://curl.haxx.se/libcurl/c/CURLOPT_CONNECTTIMEOUT.html)
* [CURLOPT_CONNECTTIMEOUT_MS](https://curl.haxx.se/libcurl/c/CURLOPT_CONNECTTIMEOUT_MS.html)
* [CURLOPT_USERAGENT](https://curl.haxx.se/libcurl/c/CURLOPT_USERAGENT.html)

For example,
Expand Down
3 changes: 2 additions & 1 deletion http.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ static http_curlopt settable_curlopts[] = {
{ "CURLOPT_TIMEOUT", NULL, CURLOPT_TIMEOUT, CURLOPT_LONG, false },
{ "CURLOPT_TIMEOUT_MS", NULL, CURLOPT_TIMEOUT_MS, CURLOPT_LONG, false },
{ "CURLOPT_CONNECTTIMEOUT", NULL, CURLOPT_CONNECTTIMEOUT, CURLOPT_LONG, false },
{ "CURLOPT_CONNECTTIMEOUT_MS", NULL, CURLOPT_CONNECTTIMEOUT_MS, CURLOPT_LONG, false },
{ "CURLOPT_USERAGENT", NULL, CURLOPT_USERAGENT, CURLOPT_STRING, false },
{ "CURLOPT_USERPWD", NULL, CURLOPT_USERPWD, CURLOPT_STRING, false },
{ "CURLOPT_IPRESOLVE", NULL, CURLOPT_IPRESOLVE, CURLOPT_LONG, false },
Expand Down Expand Up @@ -838,7 +839,7 @@ http_get_handle()

/* Always want a default fast (1 second) connection timeout */
/* User can over-ride with http_set_curlopt() if they wish */
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, 1);
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT_MS, 1000);
curl_easy_setopt(handle, CURLOPT_TIMEOUT_MS, 5000);

/* Set the user agent. If not set, use PG_VERSION as default */
Expand Down

0 comments on commit 1f3597b

Please sign in to comment.