Curl and libcurl 7.18.0
Public curl releases: 103
- Command line options: 125
+ Command line options: 126
curl_easy_setopt() options: 150
Public functions in libcurl: 56
Public web site mirrors: 42
o --data-urlencode
o CURLOPT_PROXY_TRANSFER_MODE
- o --no-keep-alive - now curl does connections with keep-alive enabled by
+ o --no-keepalive - now curl does connections with keep-alive enabled by
default
o --socks4a added (proxy type CURLPROXY_SOCKS4A for libcurl)
o --socks5-hostname added (CURLPROXY_SOCKS5_HOSTNAME for libcurl)
o curl_easy_pause()
o CURLOPT_SEEKFUNCTION and CURLOPT_SEEKDATA
+ o --keepalive-time
This release includes the following bugfixes:
Emil Romanus, Alessandro Vesely, Ray Pekowski, Spacen Jasset, Andrew Moise,
Gilles Blanc, David Wright, Vikram Saxena, Mateusz Loskot, Gary Maxwell,
Dmitry Kurochkin, Mohun Biswas, Richard Atterer, Maxim Perenesenko,
- Daniel Egger, Jeff Johnson, Nikitinskit Dmitriy, Georg Lippitsch
+ Daniel Egger, Jeff Johnson, Nikitinskit Dmitriy, Georg Lippitsch, Eric Landes
Thanks! (and sorry if I forgot to mention someone)
\fBhttp://curl.haxx.se/docs/sslcerts.html\fP
If this option is used twice, the second time will again disable it.
+.IP "--keepalive-time <seconds>"
+This option sets the time a connection needs to remain idle before sending
+keepalive probes and the time between individual keepalive probes. It is
+currently effective on operating systems offering the TCP_KEEPIDLE and
+TCP_KEEPINTVL socket options (meaning Linux, recent AIX, HP-UX and more). This
+option has no effect if \fI--no-keepalive\fP is used. (Added in 7.18.0)
+
+If this option is used multiple times, the last occurrence sets the amount.
.IP "--key <key>"
(SSL/SSH) Private key file name. Allows you to provide your private key in this
separate file.
Using this option will disable that buffering.
If this option is used twice, the second will again switch on buffering.
-.IP "--no-keep-alive"
-Disables the use of keep-alive messages on the TCP connection, as by default
+.IP "--no-keepalive"
+Disables the use of keepalive messages on the TCP connection, as by default
curl enables them.
-If this option is used twice, the second will again enable keep-alive.
+If this option is used twice, the second will again enable keepalive.
.IP "--no-sessionid"
(SSL) Disable curl's use of SSL session-ID caching. By default all transfers
are done using the cache. Note that while nothing ever should get hurt by
#endif
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h> /* for IPPROTO_TCP */
+#endif
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h> /* for TCP_KEEPIDLE, TCP_KEEPINTVL */
+#endif
+
/* The last #include file should be: */
#ifdef CURLDEBUG
#ifndef CURLTOOLDEBUG
char *libcurl; /* output libcurl code to this file name */
bool raw;
bool post301;
- bool nokeepalive;
+ bool nokeepalive; /* for keepalive needs */
+ long alivetime;
+
struct OutStruct *outs;
};
" -I/--head Show document info only",
" -j/--junk-session-cookies Ignore session cookies read from file (H)",
" --interface <interface> Specify network interface/address to use",
+ " --keepalive-time <seconds> Interval between keepalive probes",
" --krb <level> Enable kerberos with specified security level (F)",
" -k/--insecure Allow connections to SSL sites without certs (H)",
" -K/--config Specify which config file to read",
" --netrc-optional Use either .netrc or URL; overrides -n",
" --ntlm Use HTTP NTLM authentication (H)",
" -N/--no-buffer Disable buffering of the output stream",
- " --no-keep-alive Disable keep-alive use on the connection",
+ " --no-keepalive Disable keepalive use on the connection",
" --no-sessionid Disable SSL session-ID reusing (SSL)",
" -o/--output <file> Write output to <file> instead of stdout",
" -O/--remote-name Write output to a file named as the remote file",
}
-static int set_so_keepalive(void *clientp, curl_socket_t curlfd,
- curlsocktype purpose)
+static int sockoptcallback(void *clientp, curl_socket_t curlfd,
+ curlsocktype purpose)
{
struct Configurable *config = (struct Configurable *)clientp;
- int onoff = config->nokeepalive ? 0 : 1;
+ int onoff = 1; /* this callback is only used if we ask for keepalives on the
+ connection */
+ long keepidle = config->alivetime;
switch (purpose) {
case CURLSOCKTYPE_IPCXN:
warnf(clientp, "Could not set SO_KEEPALIVE!\n");
return 0;
}
+ else {
+ if (config->alivetime) {
+#ifdef TCP_KEEPIDLE
+ if(setsockopt(curlfd, IPPROTO_TCP, TCP_KEEPIDLE, (void *)&keepidle,
+ sizeof(keepidle)) < 0) {
+ /* don't abort operation, just issue a warning */
+ SET_SOCKERRNO(0);
+ warnf(clientp, "Could not set TCP_KEEPIDLE!\n");
+ return 0;
+ }
+#endif
+#ifdef TCP_KEEPINTVL
+ if(setsockopt(curlfd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&keepidle,
+ sizeof(keepidle)) < 0) {
+ /* don't abort operation, just issue a warning */
+ SET_SOCKERRNO(0);
+ warnf(clientp, "Could not set TCP_KEEPINTVL!\n");
+ return 0;
+ }
+#endif
+ }
+ }
break;
default:
break;
{"$z", "libcurl", TRUE},
{"$#", "raw", FALSE},
{"$0", "post301", FALSE},
- {"$1", "no-keep-alive", FALSE},
- {"$2", "socks5-hostname", TRUE},
+ {"$1", "no-keepalive", FALSE},
+ {"$2", "socks5-hostname", TRUE},
+ {"$3", "keepalive-time", TRUE},
{"0", "http1.0", FALSE},
{"1", "tlsv1", FALSE},
case '0': /* --post301 */
config->post301 ^= TRUE;
break;
- case '1': /* --no-keep-alive */
+ case '1': /* --no-keepalive */
config->nokeepalive ^= TRUE;
break;
+ case '3': /* --keepalive-time */
+ if(str2num(&config->alivetime, nextarg))
+ return PARAM_BAD_NUMERIC;
+ break;
}
break;
case '#': /* --progress-bar */
/* curl 7.17.1 */
my_setopt(curl, CURLOPT_POST301, config->post301);
if (!config->nokeepalive) {
- my_setopt(curl, CURLOPT_SOCKOPTFUNCTION, set_so_keepalive);
+ my_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockoptcallback);
my_setopt(curl, CURLOPT_SOCKOPTDATA, config);
}