haproxy/src
Willy Tarreau 59a10fb53d MEDIUM: h2: change hpack_decode_headers() to only provide a list of headers
The current H2 to H1 protocol conversion presents some issues which will
require to perform some processing on certain headers before writing them
so it's not possible to convert HPACK to H1 on the fly.

This commit modifies the headers decoding so that it now works in two
phases : hpack_decode_headers() only decodes the HPACK stream in the
HEADERS frame and puts the result into a list. Headers which require
storage (huffman-compressed or from the dynamic table) are stored in
a chunk allocated by the H2 demuxer. Then once the headers are properly
decoded into this list, h2_make_h1_request() is called with this list
to produce the HTTP/1.1 request into the destination buffer. The list
necessarily enforces a limit. Here we use 2*MAX_HTTP_HDR, which means
that we can have as many individual cookies as we have regular headers
if a client decides to break their cookies into multiple values. This
seams reasonable and will allow the H1 parser to decide whether it's
too much or not.

Thus the output stream is not produced on the fly anymore and this will
permit to deal with certain corner cases like reparing the Cookie header
(which for now is not done).

In order to limit header duplication and parsing, the known pseudo headers
continue to be passed by their index : the name element in the list then
has a NULL pointer and the value is the pseudo header's index. Given that
these ones represent about half of the incoming requests and need to be
found quickly, it maintains an acceptable level of performance.

The code was significantly reduced by doing this because the orignal code
had to deal with HPACK and H1 combinations (eg: index vs not indexed, etc)
and now the HPACK decoding is totally focused on the decompression, and
the H1 encoding doesn't have to deal with the issue of wrapping input for
example.

One bug was addressed here (though it couldn't happen at the moment). The
H2 demuxer used to detect a failure to write the request into the H1 buffer
and would then detect if the output buffer wraps, realign it and try again.
The problem by doing so was that the HPACK context was already modified and
not rewindable. Thus the size check is now performed first and a failure is
reported if it doesn't fit.
2017-11-21 21:13:36 +01:00
..
51d.c MINOR: threads: Don't start when device a detection module is used 2017-10-31 13:58:33 +01:00
acl.c MINOR: acl: Pass the ACLs as an explicit parameter of build_acl_cond 2017-10-31 11:36:12 +01:00
action.c MINOR: action: Add function to check rules using an action ACT_ACTION_TRK_* 2017-10-31 11:36:12 +01:00
applet.c MEDIUM: applets: Don't process more than 200 active applets at once 2017-11-16 11:19:46 +01:00
arg.c BUG/MEDIUM: arg: ensure that we properly unlink unresolved arguments on error 2017-04-13 12:20:52 +02:00
auth.c CLEANUP: auth: use the build options list to report its support 2016-12-21 21:30:54 +01:00
backend.c BUILD: ssl: fix build of backend without ssl 2017-11-08 14:28:08 +01:00
base64.c [MINOR] add encode/decode function for 30-bit integers from/to base64 2010-10-30 19:04:33 +02:00
buffer.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
cache.c CLEANUP: cache: remove wrong comment 2017-11-20 19:22:27 +01:00
cfgparse.c BUG/MEDIUM: mworker: does not close inherited FD 2017-11-15 19:53:33 +01:00
channel.c MINOR: channel: make the channel be a const in all {ci,co}_get* functions 2017-10-19 15:01:08 +02:00
checks.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
chunk.c BUG/MEDIUM: threads: Run the poll loop on the main thread too 2017-10-31 13:58:33 +01:00
cli.c MINOR: cli: make "show fd" report the fd's thread mask 2017-11-10 16:53:09 +01:00
compression.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
connection.c BUG/MINOR: send-proxy-v2: string size must include ('\0') 2017-11-01 07:58:20 +01:00
da.c BUG/MEDIUM: deviceatlas: ignore not valuable HTTP request data 2017-11-17 10:41:40 +01:00
dns.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
ev_epoll.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
ev_kqueue.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
ev_poll.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
ev_select.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
fd.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
filters.c MEDIUM: threads/filters: Add init/deinit callback per thread 2017-10-31 13:58:32 +01:00
flt_http_comp.c MEDIUM: threads/compression: Make HTTP compression thread-safe 2017-10-31 13:58:32 +01:00
flt_spoe.c BUG/MINOR: spoe: check buffer size before acquiring or releasing it 2017-11-13 11:38:12 +01:00
flt_trace.c MINOR: threads/filters: Update trace filter to add _per_thread callbacks 2017-10-31 13:58:32 +01:00
freq_ctr.c BUG/MAJOR: threads/freq_ctr: use a memory barrier to detect changes 2017-10-31 18:01:18 +01:00
frontend.c MAJOR: connection : Split struct connection into struct connection and struct conn_stream. 2017-10-31 18:03:23 +01:00
h1.c BUG/MINOR: h1: the HTTP/1 make status code parser check for digits 2017-11-09 11:15:45 +01:00
h2.c MEDIUM: h2: add a function to emit an HTTP/1 request from a headers list 2017-11-21 21:13:33 +01:00
haproxy.c MEDIUM: mworker: Add systemd Type=notify support 2017-11-20 18:39:41 +01:00
hash.c MINOR: hash: add new function hash_crc32 2015-01-20 19:48:05 +01:00
hathreads.c BUG/MINOR: threads: tid_bit must be a unsigned long 2017-11-14 18:11:28 +01:00
hdr_idx.c OPTIM/MINOR: move the hdr_idx pools out of the proxy struct 2011-10-24 18:15:04 +02:00
hlua.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
hlua_fcn.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
hpack-dec.c MEDIUM: h2: change hpack_decode_headers() to only provide a list of headers 2017-11-21 21:13:36 +01:00
hpack-enc.c MEDIUM: hpack: implement basic hpack encoding 2017-10-31 18:03:24 +01:00
hpack-huff.c MINOR: hpack: implement the HPACK Huffman table decoder 2017-10-31 18:03:24 +01:00
hpack-tbl.c MINOR: hpack: implement the header tables management 2017-10-31 18:03:24 +01:00
i386-linux-vsys.c MEDIUM: listener: add support for linux's accept4() syscall 2012-10-08 20:11:03 +02:00
lb_chash.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
lb_fas.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
lb_fwlc.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
lb_fwrr.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
lb_map.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
listener.c BUG/MEDIUM: mworker: does not close inherited FD 2017-11-15 19:53:33 +01:00
log.c MAJOR: connection : Split struct connection into struct connection and struct conn_stream. 2017-10-31 18:03:23 +01:00
lru.c MINOR: lru: new function to delete <nb> least recently used keys 2016-01-11 07:31:35 +01:00
mailers.c MEDIUM: Add parsing of mailers section 2015-02-03 00:24:16 +01:00
map.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
memory.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
mux_h2.c MEDIUM: h2: change hpack_decode_headers() to only provide a list of headers 2017-11-21 21:13:36 +01:00
mux_pt.c BUG/MAJOR: mux_pt: don't dereference a connstream after ->wake() 2017-11-03 15:55:24 +01:00
namespace.c CLEANUP: namespaces: use the build options list to report it 2016-12-21 21:30:54 +01:00
pattern.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
payload.c MINOR: payload: add new sample fetch functions to process distcc protocol 2017-10-13 11:47:19 +02:00
peers.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
pipe.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
proto_http.c MEDIUM: cache: enable the HTTP analysers 2017-11-20 19:22:27 +01:00
proto_tcp.c MAJOR: connection : Split struct connection into struct connection and struct conn_stream. 2017-10-31 18:03:23 +01:00
proto_udp.c CLEANUP: fix inconsistency between fd->iocb, proto->accept and accept() 2016-04-14 11:18:22 +02:00
proto_uxst.c MEDIUM: threads/fd: Initialize the process mask during the call to fd_insert 2017-10-31 13:58:30 +01:00
protocol.c BUILD: protocol: fix some build errors on OpenBSD 2016-08-10 19:31:58 +02:00
proxy.c CLEANUP: global: introduce variable pid_bit to avoid shifts with relative_pid 2017-11-10 19:08:14 +01:00
queue.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
raw_sock.c BUG/MINOR: threads: Add missing THREAD_LOCAL on static here and there 2017-10-31 13:58:33 +01:00
rbtree.c [MINOR] imported the rbtree function from Linux kernel 2007-01-07 02:12:57 +01:00
regex.c MINOR: threads/regex: Change Regex trash buffer into a thread local variable 2017-10-31 13:58:31 +01:00
sample.c MINOR: threads/sample: Change temp_smp into a thread local variable 2017-10-31 13:58:31 +01:00
server.c BUILD: server: check->desc always exists 2017-11-20 21:33:21 +01:00
session.c MEDIUM: session: make use of the connection's destroy callback 2017-10-31 18:03:24 +01:00
sha1.c IMPORT: sha1: import SHA1 functions 2017-10-25 04:45:48 +02:00
shctx.c BUILD: shctx: do not depend on openssl anymore 2017-11-08 14:33:36 +01:00
signal.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
ssl_sock.c MINOR: ssl: Make sure we don't shutw the connection before the handshake. 2017-11-16 19:04:10 +01:00
standard.c MINOR: tools: emphasize the node being worked on in the tree dump 2017-11-15 19:43:05 +01:00
stats.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
stick_table.c BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix 2017-11-07 11:10:24 +01:00
stream.c BUG/MAJOR: stream: ensure analysers are always called upon close 2017-11-20 15:58:22 +01:00
stream_interface.c BUG/MINOR: stream-int: don't try to read again when CF_READ_DONTWAIT is set 2017-11-20 16:13:16 +01:00
task.c MAJOR: polling: Use active_tasks_mask instead of tasks_run_queue 2017-11-16 11:19:46 +01:00
tcp_rules.c MEDIUM: threads/proxy: Add a lock per proxy and atomically update proxy vars 2017-10-31 13:58:30 +01:00
time.c BUG/MAJOR: threads/time: Store the time deviation in an 64-bits integer 2017-10-31 13:58:33 +01:00
trace.c CONTRIB: trace: try to display the function's return value on exit 2017-10-24 19:54:25 +02:00
uri_auth.c CLEANUP: uniformize last argument of malloc/calloc 2016-04-03 14:17:42 +02:00
vars.c MINOR: threads: Use __decl_hathreads to declare locks 2017-11-13 11:38:17 +01:00
wurfl.c MINOR: threads: Don't start when device a detection module is used 2017-10-31 13:58:33 +01:00
xxhash.c CLEANUP: remove unneeded casts 2016-04-03 14:17:42 +02:00