ah http1.1 deal with pipelined headers properly
authorAndy Green <andy.green@linaro.org>
Sat, 30 Jan 2016 03:43:10 +0000 (11:43 +0800)
committerAndy Green <andy.green@linaro.org>
Sat, 30 Jan 2016 03:43:10 +0000 (11:43 +0800)
commit4019aab8da469eab328a66c2e1ab0a059458f7b6
tree4b020c43b6c288f25d6d79fb6072533daca8a824
parent1b2c9a23e13dd250b193e4302a8d48c5be97d16b
ah http1.1 deal with pipelined headers properly

Connections must hold an ah for the whole time they are
processing one header set, even if eg, the headers are
fragmented and it involves network roundtrip times.

However on http1.1 / keepalive, it must drop the ah when
there are no more header sets to deal with, and reacquire
the ah later when more data appears.  It's because the
time between header sets / http1.1 requests is unbounded
and the ah would be tied up forever.

But in the case that we got pipelined http1.1 requests,
even partial already buffered, we must keep the ah,
resetting it instead of dropping it.  Because we store
the rx data conveniently in a per-tsi buffer since it only
does one thing at a time per thread, we cannot go back to
the event loop to await a new ah inside one service action.

But no problem since we definitely already have an ah,
let's just reuse it at http completion time if more rx is
already buffered.

NB: attack.sh makes request with echo | nc, this
accidentally sends a trailing '\n' from the echo showing
this problem.  With this patch attack.sh can complete well.

Signed-off-by: Andy Green <andy.green@linaro.org>
lib/client.c
lib/parsers.c
lib/private-libwebsockets.h
lib/server.c
test-server/test-server-http.c