" E.g. /?K=1\n"
" - /?t=<time> wait <time> milliseconds before responding.\n"
" E.g. /?t=500\n"
- " - /?k=<enable> Enable transfer encoding chunked with only one chunk if >0.\n"
+ " - /?k=<enable> Enable transfer encoding chunked with only one chunk if >0 (disable fast-forward and splicing).\n"
+ " - /?S=<enable> Disable use of splice() to send data if <1.\n"
" - /?R=<enable> Enable sending random data if >0.\n"
"\n"
"Note that those arguments may be cumulated on one line separated by a set of\n"
}
nego_flags |= NEGO_FF_FL_EXACT_SIZE;
+#if defined(USE_LINUX_SPLICE)
+ if ((global.tune.options & GTUNE_USE_SPLICE) && !(sd->iobuf.flags & IOBUF_FL_NO_SPLICING))
+ nego_flags |= NEGO_FF_FL_MAY_SPLICE;
+#endif
len = se_nego_ff(sd, &BUF_NULL, hs->to_write, nego_flags);
if (sd->iobuf.flags & IOBUF_FL_NO_FF) {
TRACE_DEVEL("Fast-forwarding not supported by endpoint, disable it", HS_EV_HSTRM_RESP, hs);
goto out;
}
+#if defined(USE_LINUX_SPLICE)
+ if (sd->iobuf.pipe) {
+ if (len > master_pipesize)
+ len = master_pipesize;
+ ret = tee(master_pipe->cons, sd->iobuf.pipe->prod, len, SPLICE_F_NONBLOCK);
+ if (ret > 0) {
+ sd->iobuf.pipe->data += ret;
+ hs->to_write -= ret;
+ }
+ if (!hs->to_write)
+ sd->iobuf.flags |= IOBUF_FL_EOI;
+ goto done;
+ }
+#endif
hs->to_write -= hstream_add_ff_data(hs, sd, len);
if (!hs->to_write)
sd->iobuf.flags |= IOBUF_FL_EOI;
+ done:
if (se_done_ff(sd) != 0 || !(sd->iobuf.flags & (IOBUF_FL_FF_BLOCKED|IOBUF_FL_FF_WANT_ROOM))) {
/* Something was forwarding or the consumer states it is not
* blocked anyore, don't reclaim more room */
" -c <curves> : ECSDA curves (ex: \"P-256\", \"P-384\"...)\n"
" -v : shows version\n"
" -d : enable the traces for all http protocols\n"
+ " -dS : disables splice() usage even when available\n"
" -dZ : disable zero-copy forwarding\n"
" --" QUIC_BIND_LONG_OPT " <opts> : append options to QUIC \"bind\" lines\n"
" --" TCP_BIND_LONG_OPT " <opts> : append options to TCP \"bind\" lines\n"
static const char *haterm_cfg_dflt_str =
"defaults\n"
"\tmode haterm\n"
+#if defined(USE_LINUX_SPLICE)
+ "\toption splice-response\n"
+#endif
"\ttimeout client 25s\n";
#define HATERM_CFG_CRT_STORE_STR_FMT \
else
haterm_usage(progname);
}
+#if defined(USE_LINUX_SPLICE)
+ else if (*opt == 'd' && *(opt+1) == 'S') {
+ global.tune.options &= ~GTUNE_USE_SPLICE;
+ }
+#endif
else if (*opt == 'd' && *(opt+1) == 'Z') {
global.tune.no_zero_copy_fwd |= NO_ZERO_COPY_FWD;
}