1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_SERVER_RESPONSE_TIMEOUT 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_CONNECTTIMEOUT (3) 9 - CURLOPT_LOW_SPEED_LIMIT (3) 10 - CURLOPT_TIMEOUT (3) 11--- 12 13# NAME 14 15CURLOPT_SERVER_RESPONSE_TIMEOUT - time allowed to wait for server response 16 17# SYNOPSIS 18 19~~~c 20#include <curl/curl.h> 21 22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT, 23 long timeout); 24~~~ 25 26# DESCRIPTION 27 28Pass a long. Causes libcurl to set a *timeout* period (in seconds) on the 29amount of time that the server is allowed to take in order to send a response 30message for a command before the session is considered dead. While libcurl is 31waiting for a response, this value overrides CURLOPT_TIMEOUT(3). It is 32recommended that if used in conjunction with CURLOPT_TIMEOUT(3), you set 33CURLOPT_SERVER_RESPONSE_TIMEOUT(3) to a value smaller than 34CURLOPT_TIMEOUT(3). 35 36This option was formerly known as CURLOPT_FTP_RESPONSE_TIMEOUT. 37 38# DEFAULT 39 40None 41 42# PROTOCOLS 43 44FTP, IMAP, POP3, SMTP, and SSH 45 46# EXAMPLE 47 48~~~c 49int main(void) 50{ 51 CURL *curl = curl_easy_init(); 52 if(curl) { 53 CURLcode res; 54 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt"); 55 /* wait no more than 23 seconds */ 56 curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT, 23L); 57 res = curl_easy_perform(curl); 58 59 curl_easy_cleanup(curl); 60 } 61} 62~~~ 63 64# AVAILABILITY 65 66Added in 7.10.8. Used under this name since 7.20.0 67 68Support for SSH is predicated on a new enough (1.11.0) version of libssh2 69being available when compiling libcurl. 70 71# RETURN VALUE 72 73Returns CURLE_OK if supported, and CURLE_UNKNOWN_OPTION if not. Returns 74CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value or a value that when 75converted to milliseconds is too large. 76