From 2ff91b3bcdd2f8a521c813cb03a2cf4c62df6996 Mon Sep 17 00:00:00 2001 From: Hubert Tarasiuk Date: Sun, 24 May 2015 15:01:16 +0200 Subject: [PATCH 5/9] Add --tcp-fast-open option. * src/init.c (commands[]): Add command. * src/init.c (defaults): Enable fast-open by default. * src/options.h (options): Add tcp_fast_open option. --- src/init.c | 3 +++ src/main.c | 7 +++++++ src/options.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/init.c b/src/init.c index a436ef2..13e2f31 100644 --- a/src/init.c +++ b/src/init.c @@ -282,6 +282,9 @@ static const struct { { "spider", &opt.spider, cmd_boolean }, { "startpos", &opt.start_pos, cmd_bytes }, { "strictcomments", &opt.strict_comments, cmd_boolean }, +#ifdef HAVE_TFO + { "tcp-fast-open", &opt.tcp_fast_open, cmd_boolean }, +#endif { "timeout", NULL, cmd_spec_timeout }, { "timestamping", &opt.timestamping, cmd_boolean }, { "tries", &opt.ntry, cmd_number_inf }, diff --git a/src/main.c b/src/main.c index a0044d9..513244d 100644 --- a/src/main.c +++ b/src/main.c @@ -299,6 +299,9 @@ static struct cmdline_option option_data[] = { "spider", 0, OPT_BOOLEAN, "spider", -1 }, { "start-pos", 0, OPT_VALUE, "startpos", -1 }, { "strict-comments", 0, OPT_BOOLEAN, "strictcomments", -1 }, +#ifdef HAVE_TFO + { "tcp-fast-open", 0, OPT_BOOLEAN, "tcp-fast-open", -1 }, +#endif { "timeout", 'T', OPT_VALUE, "timeout", -1 }, { "timestamping", 'N', OPT_BOOLEAN, "timestamping", -1 }, { "if-modified-since", 0, OPT_BOOLEAN, "if-modified-since", -1 }, @@ -653,6 +656,10 @@ HTTP options:\n"), --auth-no-challenge send Basic HTTP authentication information\n\ without first waiting for the server's\n\ challenge\n"), +#ifdef HAVE_TFO + N_("\ + --tcp-fast-open use TCP Fast Open for HTTP requests\n"), +#endif "\n", #ifdef HAVE_SSL diff --git a/src/options.h b/src/options.h index bef1f10..b746678 100644 --- a/src/options.h +++ b/src/options.h @@ -126,6 +126,9 @@ struct options char *http_passwd; /* HTTP password. */ char **user_headers; /* User-defined header(s). */ bool http_keep_alive; /* whether we use keep-alive */ +#ifdef HAVE_TFO + bool tcp_fast_open; /* use TCP Fast Open (RFC7413) */ +#endif bool use_proxy; /* Do we use proxy? */ bool allow_cache; /* Do we allow server-side caching? */ -- 2.4.1