summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-03-15 14:38:03 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-03-15 14:38:03 +0000
commit36c88343d3c807c432bcd35a559c8db4947ff1a2 (patch)
treed9728767927fe623330bc9bec50cf77fcb3a2247
parent2360e5ce126d4e7453f15f5d7a6f3527d01a3938 (diff)
downloadgnurl-36c88343d3c807c432bcd35a559c8db4947ff1a2.tar.gz
gnurl-36c88343d3c807c432bcd35a559c8db4947ff1a2.tar.bz2
gnurl-36c88343d3c807c432bcd35a559c8db4947ff1a2.zip
Added --connect-timeout support
-rw-r--r--src/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index a6c6264bf..af0db73cf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -247,9 +247,11 @@ static void help(void)
" --data-ascii <data> HTTP POST ASCII data (H)\n"
" --data-binary <data> HTTP POST binary data (H)\n"
" -D/--dump-header <file> Write the headers to this file\n"
+ " --egd-file <file> EGD socket path for random data (SSL)\n"
" -e/--referer Referer page (H)");
puts(" -E/--cert <cert[:passwd]> Specifies your certificate file and password (HTTPS)\n"
" --cacert <file> CA certifciate to verify peer against (HTTPS)\n"
+ " --connect-timeout <seconds> Maximum time allowed for connection\n"
" -f/--fail Fail silently (no output at all) on errors (H)\n"
" -F/--form <name=content> Specify HTTP POST data (H)\n"
" -g/--globoff Disable URL sequences and ranges using {} and []\n"
@@ -275,6 +277,7 @@ static void help(void)
puts(" -r/--range <range> Retrieve a byte range from a HTTP/1.1 or FTP server\n"
" -s/--silent Silent mode. Don't output anything\n"
" -S/--show-error Show error. With -s, make curl show errors when they occur\n"
+ " --stderr <file> Where to redirect stderr. - means stdout.\n"
" -t/--telnet-option <OPT=val> Set telnet option\n"
" -T/--upload-file <file> Transfer/upload <file> to remote site\n"
" --url <URL> Another way to specify URL to work with");
@@ -284,6 +287,7 @@ static void help(void)
" -V/--version Outputs version number then quits\n"
" -w/--write-out [format] What to output after completion\n"
" -x/--proxy <host[:port]> Use proxy. (Default port is 1080)\n"
+ " --random-file <file> File to use for reading random data from (SSL)\n"
" -X/--request <command> Specific request command to use");
puts(" -y/--speed-time Time needed to trig speed-limit abort. Defaults to 30\n"
" -Y/--speed-limit Stop transfer if below speed-limit for 'speed-time' secs\n"
@@ -292,10 +296,7 @@ static void help(void)
" -2/--sslv2 Force usage of SSLv2 (H)\n"
" -3/--sslv3 Force usage of SSLv3 (H)");
puts(" -#/--progress-bar Display transfer progress as a progress bar\n"
- " --crlf Convert LF to CRLF in upload. Useful for MVS (OS/390)\n"
- " --stderr <file> Where to redirect stderr. - means stdout.\n"
- " --random-file <file> File to use for reading random data from (SSL)\n"
- " --egd-file <file> EGD socket path for random data (SSL)");
+ " --crlf Convert LF to CRLF in upload. Useful for MVS (OS/390)");
}
struct LongShort {
@@ -315,6 +316,7 @@ struct Configurable {
long postfieldsize;
char *referer;
long timeout;
+ long connecttimeout;
long maxredirs;
char *headerfile;
char *ftpport;
@@ -528,6 +530,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"5", "url", TRUE},
{"5a", "random-file", TRUE},
{"5b", "egd-file", TRUE},
+ {"5c", "connect-timeout", TRUE},
{"2", "sslv2", FALSE},
{"3", "sslv3", FALSE},
@@ -684,6 +687,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
case 'b': /* egd-file */
GetStr(&config->egd_file, nextarg);
break;
+ case 'c': /* connect-timeout */
+ config->connecttimeout=atoi(nextarg);
+ break;
default: /* the URL! */
{
struct getout *url;
@@ -1839,6 +1845,7 @@ operate(struct Configurable *config, int argc, char *argv[])
/* new in libcurl 7.7: */
curl_easy_setopt(curl, CURLOPT_RANDOM_FILE, config->random_file);
curl_easy_setopt(curl, CURLOPT_EGDSOCKET, config->egd_file);
+ curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, config->connecttimeout);
res = curl_easy_perform(curl);