aboutsummaryrefslogtreecommitdiff
path: root/lib/sendf.c
diff options
context:
space:
mode:
authorAlessandro Ghedini <alessandro@ghedini.me>2017-11-05 23:59:55 +0000
committerDaniel Stenberg <daniel@haxx.se>2017-11-24 10:49:59 +0100
commit979b012eeb1908e7e3ad13c736fb1dbc73187780 (patch)
tree2394f1bc436fbb337a666abc2daa5d5033a0d382 /lib/sendf.c
parent9f691be3d49840690f7d3a22e81e6fd3e03f0900 (diff)
connect: add support for new TCP Fast Open API on Linux
The new API added in Linux 4.11 only requires setting a socket option before connecting, without the whole sento() machinery. Notably, this makes it possible to use TFO with SSL connections on Linux as well, without the need to mess around with OpenSSL (or whatever other SSL library) internals. Closes #2056
Diffstat (limited to 'lib/sendf.c')
-rw-r--r--lib/sendf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sendf.c b/lib/sendf.c
index cbdb233fd..a1cb8e478 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -22,6 +22,10 @@
#include "curl_setup.h"
+#ifdef HAVE_LINUX_TCP_H
+#include <linux/tcp.h>
+#endif
+
#include <curl/curl.h>
#include "urldata.h"
@@ -360,7 +364,7 @@ ssize_t Curl_send_plain(struct connectdata *conn, int num,
available. */
pre_receive_plain(conn, num);
-#ifdef MSG_FASTOPEN /* Linux */
+#if defined(MSG_FASTOPEN) && !defined(TCP_FASTOPEN_CONNECT) /* Linux */
if(conn->bits.tcp_fastopen) {
bytes_written = sendto(sockfd, mem, len, MSG_FASTOPEN,
conn->ip_addr->ai_addr, conn->ip_addr->ai_addrlen);