Commit dc68f2da authored by Alessandro Ghedini's avatar Alessandro Ghedini Committed by Daniel Stenberg
Browse files

url: add CURLOPT_TCP_FASTOPEN option

parent a542536c
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
.\" **************************************************************************
.\" *                                  _   _ ____  _
.\" *  Project                     ___| | | |  _ \| |
.\" *                             / __| | | | |_) | |
.\" *                            | (__| |_| |  _ <| |___
.\" *                             \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
.\" * are also available at https://curl.haxx.se/docs/copyright.html.
.\" *
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
.\" * copies of the Software, and permit persons to whom the Software is
.\" * furnished to do so, under the terms of the COPYING file.
.\" *
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
.\" * KIND, either express or implied.
.\" *
.\" **************************************************************************
.\"
.TH CURLOPT_TCP_FASTOPEN 3 "16 Feb 2016" "libcurl 7.49.0" "curl_easy_setopt options"
.SH NAME
CURLOPT_TCP_FASTOPEN \- enable TCP Fast Open
.SH SYNOPSIS
#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_FASTOPEN, long enable);
.SH DESCRIPTION
Pass a long as parameter set to 1 to enable or 0 to disable.

TCP Fast Open (RFC7413) is a mechanism that allows data to be carried in the
SYN and SYN-ACK packets and consumed by the receiving end during the initial
connection handshake, saving up to one full round-trip time (RTT).
.SH DEFAULT
0
.SH PROTOCOLS
All
.SH EXAMPLE
TODO
.SH AVAILABILITY
Added in 7.49.0. This option is currently only supported on OS X El Capitan.
.SH RETURN VALUE
Returns CURLE_OK if fast open is supported by the operating system, otherwise
returns CURLE_NOT_BUILT_IN.
+3 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ man_MANS = CURLOPT_ACCEPT_ENCODING.3 CURLOPT_ACCEPTTIMEOUT_MS.3 \
 CURLOPT_TLSAUTH_TYPE.3 CURLOPT_TLSAUTH_USERNAME.3			\
 CURLOPT_TRANSFER_ENCODING.3 CURLOPT_TRANSFERTEXT.3			\
 CURLOPT_UNRESTRICTED_AUTH.3 CURLOPT_UPLOAD.3				\
 CURLOPT_TCP_FASTOPEN.3										\
 CURLOPT_URL.3 CURLOPT_USERAGENT.3 CURLOPT_USERNAME.3 CURLOPT_USERPWD.3	\
 CURLOPT_USE_SSL.3 CURLOPT_VERBOSE.3 CURLOPT_WILDCARDMATCH.3		\
 CURLOPT_WRITEDATA.3 CURLOPT_WRITEFUNCTION.3 CURLOPT_XFERINFODATA.3	\
@@ -229,6 +230,7 @@ HTMLPAGES = CURLOPT_ACCEPT_ENCODING.html CURLOPT_ACCEPTTIMEOUT_MS.html \
 CURLOPT_TFTP_BLKSIZE.html CURLOPT_TFTP_NO_OPTIONS.html			\
 CURLOPT_TIMECONDITION.html CURLOPT_TIMEOUT.html			\
 CURLOPT_TIMEOUT_MS.html CURLOPT_TIMEVALUE.html				\
 CURLOPT_TCP_FASTOPEN.html									\
 CURLOPT_TLSAUTH_PASSWORD.html CURLOPT_TLSAUTH_TYPE.html		\
 CURLOPT_TLSAUTH_USERNAME.html CURLOPT_TRANSFER_ENCODING.html		\
 CURLOPT_TRANSFERTEXT.html CURLOPT_UNRESTRICTED_AUTH.html		\
@@ -360,6 +362,7 @@ PDFPAGES = CURLOPT_ACCEPT_ENCODING.pdf CURLOPT_ACCEPTTIMEOUT_MS.pdf \
 CURLOPT_TCP_NODELAY.pdf CURLOPT_TELNETOPTIONS.pdf			\
 CURLOPT_TFTP_BLKSIZE.pdf CURLOPT_TFTP_NO_OPTIONS.pdf			\
 CURLOPT_TIMECONDITION.pdf CURLOPT_TIMEOUT.pdf				\
 CURLOPT_TCP_FASTOPEN.pdf									\
 CURLOPT_TIMEOUT_MS.pdf CURLOPT_TIMEVALUE.pdf				\
 CURLOPT_TLSAUTH_PASSWORD.pdf CURLOPT_TLSAUTH_TYPE.pdf			\
 CURLOPT_TLSAUTH_USERNAME.pdf CURLOPT_TRANSFER_ENCODING.pdf		\
+1 −0
Original line number Diff line number Diff line
@@ -538,6 +538,7 @@ CURLOPT_TCP_KEEPALIVE 7.25.0
CURLOPT_TCP_KEEPIDLE            7.25.0
CURLOPT_TCP_KEEPINTVL           7.25.0
CURLOPT_TCP_NODELAY             7.11.2
CURLOPT_TCP_FASTOPEN            7.49.0
CURLOPT_TELNETOPTIONS           7.7
CURLOPT_TFTP_BLKSIZE            7.19.4
CURLOPT_TFTP_NO_OPTIONS         7.48.0
+3 −0
Original line number Diff line number Diff line
@@ -1686,6 +1686,9 @@ typedef enum {
     overrides the URL's host:port (only for the network layer) */
  CINIT(CONNECT_TO, STRINGPOINT, 243),

  /* Set TCP Fast Open */
  CINIT(TCP_FASTOPEN, LONG, 244),

  CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

+10 −0
Original line number Diff line number Diff line
@@ -595,6 +595,7 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
  set->tcp_keepalive = FALSE;
  set->tcp_keepintvl = 60;
  set->tcp_keepidle = 60;
  set->tcp_fastopen = FALSE;

  set->ssl_enable_npn = TRUE;
  set->ssl_enable_alpn = TRUE;
@@ -2631,6 +2632,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
  case CURLOPT_TCP_KEEPINTVL:
    data->set.tcp_keepintvl = va_arg(param, long);
    break;
  case CURLOPT_TCP_FASTOPEN:
#if defined(CONNECT_DATA_IDEMPOTENT)
    data->set.tcp_fastopen = (0 != va_arg(param, long))?TRUE:FALSE;
#else
    result = CURLE_NOT_BUILT_IN;
#endif
    break;
  case CURLOPT_SSL_ENABLE_NPN:
    data->set.ssl_enable_npn = (0 != va_arg(param, long)) ? TRUE : FALSE;
    break;
@@ -5975,6 +5983,8 @@ static CURLcode create_conn(struct SessionHandle *data,
  conn->recv[SECONDARYSOCKET] = Curl_recv_plain;
  conn->send[SECONDARYSOCKET] = Curl_send_plain;

  conn->bits.tcp_fastopen = data->set.tcp_fastopen;

  /***********************************************************************
   * file: is a special case in that it doesn't need a network connection
   ***********************************************************************/
Loading