]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
6 years agoBUG/MEDIUM: mux_pt: Always set CS_FL_RCV_MORE.
Olivier Houchard [Tue, 4 Dec 2018 18:17:25 +0000 (19:17 +0100)] 
BUG/MEDIUM: mux_pt: Always set CS_FL_RCV_MORE.

When using the mux_pt, as we can't know if there's more data to be read,
always set CS_FL_RCV_MORE, and only remove it if we got an error or a shutr
and rcv_buf() returned 0.

6 years agoMEDIUM: h1: Realign the ibuf before calling rcv_buf if needed.
Olivier Houchard [Tue, 4 Dec 2018 17:16:45 +0000 (18:16 +0100)] 
MEDIUM: h1: Realign the ibuf before calling rcv_buf if needed.

If the ibuf only contains a small amount of data, realign it
before calling rcv_buf(), as it's probably going to be cheaper
to do so than to do 2 calls to recv().

6 years agoBUG/MEDIUM: h1: Correctly report used data with no len.
Olivier Houchard [Tue, 4 Dec 2018 16:41:58 +0000 (17:41 +0100)] 
BUG/MEDIUM: h1: Correctly report used data with no len.

When we have no content-length, and not in chunk mode, correctly
report the used data. We really used "ret", and not "max".

6 years agoMINOR: mux-h2: stop on non-DATA and non-EOM HTX blocks
Willy Tarreau [Tue, 4 Dec 2018 14:28:03 +0000 (15:28 +0100)] 
MINOR: mux-h2: stop on non-DATA and non-EOM HTX blocks

We don't want to send such blocks as DATA frames if they were ever to
appear, let's quit when meeting them.

6 years agoBUG/MEDIUM: mux-h2: don't send more HTX data than requested
Willy Tarreau [Tue, 4 Dec 2018 14:25:57 +0000 (15:25 +0100)] 
BUG/MEDIUM: mux-h2: don't send more HTX data than requested

It's incorrect to send more bytes than requested, because some filters
(e.g. compression) might intentionally hold on some blocks, so DATA
blocks must not be processed past the advertised byte count. It is not
the case for headers however.

No backport is needed.

6 years agoBUG/MEDIUM: mux-h2: stop sending HTX once the mux is blocked
Willy Tarreau [Tue, 4 Dec 2018 14:23:57 +0000 (15:23 +0100)] 
BUG/MEDIUM: mux-h2: stop sending HTX once the mux is blocked

If we're blocking on mux full, mux busy or whatever, we must get out of
the loop. In legacy mode this problem doesn't exist as we can normally
return 0 but here it's not a sufficient condition to stop sending, so
we must inspect the blocking flags as well.

No backport is needed.

6 years agoBUG/MEDIUM: mux-h2: make sure to always report HTX EOM when consumed by headers
Willy Tarreau [Tue, 4 Dec 2018 14:21:35 +0000 (15:21 +0100)] 
BUG/MEDIUM: mux-h2: make sure to always report HTX EOM when consumed by headers

The way htx_xfer_blks() was used is wrong, if we receive data, we must
report everything we found, not just the headers blocks. This ways causing
the EOM to be postponed and some fast responses (or errors) to be incorrectly
delayed.

No backport is needed.

6 years agoBUG/MEDIUM: mux-h2: properly update the window size in HTX mode
Willy Tarreau [Tue, 4 Dec 2018 14:20:11 +0000 (15:20 +0100)] 
BUG/MEDIUM: mux-h2: properly update the window size in HTX mode

When sending data in HTX mode, we forgot to update the window size, it
was the cause of the limitation to 1 GB in testing.

No backport is needed.

6 years agoBUG/MEDIUM: h2: When sending in HTX, make sure the caller knows we sent all.
Olivier Houchard [Mon, 3 Dec 2018 18:13:29 +0000 (19:13 +0100)] 
BUG/MEDIUM: h2: When sending in HTX, make sure the caller knows we sent all.

In h2_snd_buf(), when running with htx, make sure we return the amount of
data the caller specified, if we emptied the buffer, as it is what the
caller expects, and will lead to him properly consider the buffer to be
empty.

6 years agoBUG/MINOR: proto_htx: Truncate the request when an error is detected
Christopher Faulet [Tue, 4 Dec 2018 15:23:54 +0000 (16:23 +0100)] 
BUG/MINOR: proto_htx: Truncate the request when an error is detected

When HTTP_MSGF_ERROR is set on a channel (the request or the response), the
request must be truncated, not the response.

6 years agoBUG/MEDIUM: mux-h1: Release the mux H1 in h1_process() if there is no h1s
Christopher Faulet [Tue, 4 Dec 2018 15:10:44 +0000 (16:10 +0100)] 
BUG/MEDIUM: mux-h1: Release the mux H1 in h1_process() if there is no h1s

With the current design, there is always an H1 stream attached to the mux. So
after the conn_stream is detached, if we don't create a new H1 stream in
h1_process(), it is important to release the mux.

6 years agoMINOR: mux-h1: Make sure to return 1 in h1_recv() when needed
Christopher Faulet [Tue, 4 Dec 2018 15:06:28 +0000 (16:06 +0100)] 
MINOR: mux-h1: Make sure to return 1 in h1_recv() when needed

In h1_recv(), return 1 if we have data available, or if h1_recv_allowed()
failed, to be sure h1_process() is called. Also don't subscribe if our buffer
is full.

6 years agoBUG/MEDIUM: mux-h1: Always set CS_FL_RCV_MORE when data are received in h1_recv()
Christopher Faulet [Tue, 4 Dec 2018 14:54:12 +0000 (15:54 +0100)] 
BUG/MEDIUM: mux-h1: Always set CS_FL_RCV_MORE when data are received in h1_recv()

It is a warranty that the data will be handled by the stream, even if an error
is reported on the connection or on the conn_stream.

6 years agoMEDIUM: mux-h1: Revamp the way subscriptions are handled.
Olivier Houchard [Mon, 3 Dec 2018 17:46:09 +0000 (18:46 +0100)] 
MEDIUM: mux-h1: Revamp the way subscriptions are handled.

Don't always wake the tasklets subscribed to recv or send events as soon as
we had any I/O event, and don't call the wake() method if there were no
subscription, instead, wake the recv tasklet if we received data in h2_recv(),
and wake the send tasklet if we were able to send data in h2_send(), and the
buffer is not full anymore.
Only call the data_cb->wake() method if we get an error/a read 0, just in
case the stream was not subscribed to receive events.

6 years agoBUG/MEDIUM: stream_interface: Make REALLY sure we read all the data.
Olivier Houchard [Tue, 4 Dec 2018 14:46:16 +0000 (15:46 +0100)] 
BUG/MEDIUM: stream_interface: Make REALLY sure we read all the data.

In si_cs_recv(), try inconditionally to recv as long as the CS_FL_RCV_MORE is
set on the conn_stream, or we will miss some data.

6 years agoBUG/MINOR: flt_trace/compression: Use the right flag to add the HTX support
Christopher Faulet [Mon, 3 Dec 2018 21:43:41 +0000 (22:43 +0100)] 
BUG/MINOR: flt_trace/compression: Use the right flag to add the HTX support

Of course, the flag FLT_CFG_FL_HTX must be used and not
STRM_FLT_FL_HAS_FILTERS. "Fortunately", these 2 flags have the same value, so
everything worked as expected.

6 years agoBUG/MEDIUM: h2: Don't forget to wake the tasklet after shutr/shutw.
Olivier Houchard [Mon, 3 Dec 2018 17:43:16 +0000 (18:43 +0100)] 
BUG/MEDIUM: h2: Don't forget to wake the tasklet after shutr/shutw.

When reaching h2_shutr/h2_shutw, as we may have generated an empty frame,
a goaway or a rst, make sure we wake the I/O tasklet, or we may not send
what we just generated.
Also in h2_shutw(), don't forget to return if all went well, we don't want
to subscribe the h2s to wait events.

6 years agoBUG/MEDIUM: h1: Destroy a connection after detach if it has no owner.
Olivier Houchard [Mon, 3 Dec 2018 15:33:19 +0000 (16:33 +0100)] 
BUG/MEDIUM: h1: Destroy a connection after detach if it has no owner.

Destroy the connection while detaching, even if it has keep alive, if it has
no owner, or nobody else will be able to do so.

6 years agoBUG/MEDIUM: mworker: stop proxies which have no listener in the master
William Lallemand [Mon, 3 Dec 2018 19:34:44 +0000 (20:34 +0100)] 
BUG/MEDIUM: mworker: stop proxies which have no listener in the master

The previous code was only stopping the listeners in the master, not the
entire proxy.

Since we now have a polling loop in the master, there might be some side
effects, indeed some things that are still initialized. For example the
checks were still running.

6 years agoBUG/MINOR: fix ssl_fc_alpn and actually add ssl_bc_alpn
Jérôme Magnin [Mon, 3 Dec 2018 21:21:04 +0000 (22:21 +0100)] 
BUG/MINOR: fix ssl_fc_alpn and actually add ssl_bc_alpn

When ssl_bc_alpn was meant to be added, a typo slipped in and as a result ssl_fc_alpn behaved as ssl_bc_alpn,
and ssl_bc_alpn was not a valid keyword. this patch aims at fixing this.

6 years agoBUG/MINOR: htx: Force HTTP/1.1 on H1 formatting when version is 1.1 or above
Christopher Faulet [Mon, 3 Dec 2018 13:05:01 +0000 (14:05 +0100)] 
BUG/MINOR: htx: Force HTTP/1.1 on H1 formatting when version is 1.1 or above

This only happens for connections using the h1 mux. We must be sure to force the
version to HTTP/1.1 when the version of the message is 1.1 or above. It is
important for H2 messages to not send an invalid version string (HTTP/2.0) to
peers.

6 years agoMINOR: htx: Rename functions htx_*_to_str() to be H1 specific
Christopher Faulet [Mon, 3 Dec 2018 12:58:44 +0000 (13:58 +0100)] 
MINOR: htx: Rename functions htx_*_to_str() to be H1 specific

"_to_h1" suffix is now used because these function produce H1 strings. It avoids
any ambiguity on the output format.

6 years ago[RELEASE] Released version 1.9-dev9 v1.9-dev9
Willy Tarreau [Sun, 2 Dec 2018 18:31:37 +0000 (19:31 +0100)] 
[RELEASE] Released version 1.9-dev9

Released version 1.9-dev9 with the following main changes :
    - BUILD/MINOR: ssl: fix build with non-alpn/non-npn libssl
    - BUG/MINOR: mworker: Do not attempt to close(2) fd -1
    - BUILD: compression: fix build error with DEFAULT_MAXZLIBMEM
    - MINOR: compression: always create the compression pool
    - BUG/MEDIUM: mworker: fix FD leak upon reload
    - BUILD: htx: fix fprintf format inconsistency on 32-bit platforms
    - BUILD: buffers: buf.h requires unistd to get ssize_t on libmusl
    - MINOR: initcall: introduce a way to register init functions to call at boot
    - MINOR: init: process all initcalls in order at boot time
    - MEDIUM: init: convert all trivial registration calls to initcalls
    - MINOR: thread: provide a set of lock initialisers
    - MINOR: threads: add new macros to declare self-initializing locks
    - MEDIUM: init: use self-initializing spinlocks and rwlocks
    - MINOR: initcall: apply initcall to all register_build_opts() calls
    - MINOR: initcall: use initcalls for most post_{check,deinit} and per_thread*
    - MINOR: initcall: use initcalls for section parsers
    - MINOR: memory: add a callback function to create a pool
    - MEDIUM: init: use initcall for all fixed size pool creations
    - MEDIUM: memory: use pool_destroy_all() to destroy all pools on deinit()
    - MEDIUM: initcall: use initcalls for a few initialization functions
    - MEDIUM: memory: make the pool cache an array and not a thread_local
    - MINOR: ssl: free ctx when libssl doesn't support NPN
    - BUG/MINOR: proto_htx: only mark connections private if NTLM is detected
    - MINOR: h2: make struct h2_ops static
    - BUG/MEDIUM: mworker: avoid leak of client socket
    - REORG: mworker: declare master variable in global.h
    - BUG/MEDIUM: listeners: CLOEXEC flag is not correctly set
    - CLEANUP: http: Fix typo in init_http's comment
    - BUILD: Makefile: Disable -Wcast-function-type if it exists.
    - BUG/MEDIUM: h2: Don't bogusly error if the previous stream was closed.
    - REGTEST/MINOR: script: add run-regtests.sh script
    - REGTEST: Add a basic test for the cache.
    - BUG/MEDIUM: mux_pt: Don't forget to unsubscribe() on attach.
    - BUG/MINOR: ssl: ssl_sock_parse_clienthello ignores session id
    - BUG/MEDIUM: connections: Wake the stream once the mux is chosen.
    - BUG/MEDIUM: connections: Don't forget to detach the connection from the SI.
    - BUG/MEDIUM: stream_interface: Don't check if the handshake is done.
    - BUG/MEDIUM: stream_interface: Make sure we read all the data available.
    - BUG/MEDIUM: h2: Call h2_process() if there's an error on the connection.
    - REGTEST: Fix several issues.
    - REGTEST: lua: check socket functionality from a lua-task
    - BUG/MEDIUM: session: Remove the session from the session_list in session_free.
    - BUG/MEDIUM: streams: Don't assume we have a CS in sess_update_st_con_tcp.
    - BUG/MEDIUM: connections: Don't assume we have a mux in connect_server().
    - BUG/MEDIUM: connections: Remove the connection from the idle list before destroy.
    - BUG/MEDIUM: session: properly clean the outgoing connection before freeing.
    - BUG/MEDIUM: mux_pt: Don't try to send if handshake is not done.
    - MEDIUM: connections: Put H2 connections in the idle list if http-reuse always.
    - MEDIUM: h2: Destroy a connection with no stream if it has no owner.
    - MAJOR: sessions: Store multiple outgoing connections in the session.
    - MEDIUM: session: Steal owner-less connections on end of transaction.
    - MEDIUM: server: Be smarter about deciding to reuse the last server.
    - BUG/MEDIUM: Special-case http_proxy when dealing with outgoing connections.
    - BUG/MINOR: cfgparse: Fix transition between 2 sections with the same name
    - BUG/MINOR: http: Use out buffer instead of trash to display error snapshot
    - BUG/MINOR: htx: Fix block size calculation when a start-line is added/replaced
    - BUG/MINOR: mux-h1: Fix processing of "Connection: " header on outgoing messages
    - BUG/MEDIUM: mux-h1: Reset the H1 parser when an outgoing message is processed
    - BUG/MINOR: proto_htx: Send outgoing data to client to start response processing
    - BUG/MINOR: htx: Stop a header or a start line lookup on the first EOH or EOM
    - BUG/MINOR: connection: report mux modes when HTX is supported
    - MINOR: htx: add a function to cut the beginning of a DATA block
    - MEDIUM: conn_stream: Add a way to get mux's info on a CS from the upper layer
    - MINOR: mux-h1: Implement get_cs_info() callback
    - MINOR: stream: Rely on CS's info if it exists and fallback on session's ones
    - MINOR: proto_htx: Use conn_stream's info to set t_idle duration when possible
    - MINOR: mux-h1: Don't rely on the stream anymore in h1_set_srv_conn_mode()
    - MINOR: mux-h1: Write last chunk and trailers if not found in the HTX message
    - MINOR: mux-h1: Be prepare to fail when EOM is added during trailers parsing
    - MINOR: mux-h1: Subscribe to send in h1_snd_buf() when not all data have been sent
    - MINOR: mux-h1: Consume channel's data in a loop in h1_snd_buf()
    - MEDIUM: mux-h1: Add keep-alive outgoing connections in connections list
    - MINOR: htx: Add function to add an HTX block just before another one
    - MINOR: htx: Add function to iterate on an HTX message using HTX blocks
    - MINOR: htx: Add a function to find the HTX block corresponding to a data offset
    - MINOR: stats: Don't add end-of-data marker and trailers in the HTX response
    - MEDIUM: htx: Change htx_sl to be a struct instead of an union
    - MINOR: htx: Add the start-line offset for the HTX message in the HTX structure
    - MEDIUM: htx: Don't rely on h1_sl anymore except during H1 header parsing
    - MINOR: proto-htx: Use the start-line flags to set the HTTP messsage ones
    - MINOR: htx: Add BODYLESS flags on the HTX start-line and the HTTP message
    - MINOR: proto_htx: Use full HTX messages to send 100-Continue responses
    - MINOR: proto_htx: Use full HTX messages to send 103-Early-Hints responses
    - MINOR: proto_htx: Use full HTX messages to send 401 and 407 responses
    - MINOR: proto_htx: Send valid HTX message when redir mode is enabled on a server
    - MINOR: proto_htx: Send valid HTX message to send 30x responses
    - MEDIUM: proto_htx: Convert all HTTP error messages into HTX
    - MINOR: mux-h1: Process conn_mode on the EOH when no connection header is found
    - MINOR: mux-h1: Change client conn_mode on an explicit close for the response
    - MINOR: mux-h1: Capture bad H1 messages
    - MAJOR: filters: Adapt filters API to be compatible with the HTX represenation
    - MEDIUM: proto_htx/filters: Add data filtering during the forwarding
    - MINOR: flt_trace: Adapt to be compatible with the HTX representation
    - MEDIUM: compression: Adapt to be compatible with the HTX representation
    - MINOR: h2: implement H2->HTX request header frame transcoding
    - MEDIUM: mux-h2: register mux for both HTTP and HTX modes
    - MEDIUM: mux-h2: make h2_rcv_buf() support HTX transfers
    - MEDIUM: mux-h2: make h2_snd_buf() HTX-aware
    - MEDIUM: mux-h2: add basic H2->HTX transcoding support for headers
    - MEDIUM: mux-h2: implement emission of H2 headers frames from HTX blocks
    - MEDIUM: mux-h2: implement the emission of DATA frames from HTX DATA blocks
    - MEDIUM: mux-h2: support passing H2 DATA frames to HTX blocks
    - BUG/MINOR: cfgparse: Fix the call to post parser of the last sections parsed
    - BUG/MEDIUM: mux-h2: don't lose the first response header in HTX mode
    - BUG/MEDIUM: mux-h2: remove the HTX EOM block on H2 response headers
    - MINOR: listener: the mux_proto entry in the bind_conf is const
    - MINOR: connection: create conn_get_best_mux_entry()
    - MINOR: server: the mux_proto entry in the server is const
    - MINOR: config: make sure to associate the proper mux to bind and servers
    - MINOR: hpack: add ":path" to the list of common header fields
    - MINOR: h2: add new functions to produce an HTX message from an H2 response
    - MINOR: mux-h2: mention that the mux is compatible with both sides
    - MINOR: mux-h2: implement an outgoing stream allocator : h2c_bck_stream_new()
    - MEDIUM: mux-h2: start to create the outgoing mux
    - MEDIUM: mux-h2: implement encoding of H2 request on the backend side
    - MEDIUM: mux-h2: make h2_frt_decode_headers() direction-agnostic
    - MEDIUM: mux-h2: make h2_process_demux() capable of processing responses as well
    - MEDIUM: mux-h2: Implement h2_attach().
    - MEDIUM: mux-h2: Don't bother flagging outgoing connections as TOOMANY.
    - REGTEST: Fix LEVEL 4 script 0 of "connection" module.
    - MINOR: connection: Fix a comment.
    - MINOR: mux: add a "max_streams" method.
    - MEDIUM: servers: Add a way to keep idle connections alive.
    - CLEANUP: fix typos in the htx subsystem
    - CLEANUP: Fix typo in the chunk headers file
    - CLEANUP: Fix typos in the h1 subsystem
    - CLEANUP: Fix typos in the h2 subsystem
    - CLEANUP: Fix a typo in the mini-clist header
    - CLEANUP: Fix a typo in the proto_htx subsystem
    - CLEANUP: Fix typos in the proto_tcp subsystem
    - CLEANUP: Fix a typo in the signal subsystem
    - CLEANUP: Fix a typo in the session subsystem
    - CLEANUP: Fix a typo in the queue subsystem
    - CLEANUP: Fix typos in the shctx subsystem
    - CLEANUP: Fix typos in the socket pair protocol subsystem
    - CLEANUP: Fix typos in the map management functions
    - CLEANUP: Fix typo in the fwrr subsystem
    - CLEANUP: Fix typos in the cli subsystem
    - CLEANUP: Fix typo in the 51d subsystem
    - CLEANUP: Fix a typo in the base64 subsystem
    - CLEANUP: Fix a typo in the connection subsystem
    - CLEANUP: Fix a typo in the protocol header file
    - CLEANUP: Fix a typo in the checks header file
    - CLEANUP: Fix typos in the file descriptor subsystem
    - CLEANUP: Fix a typo in the listener subsystem
    - BUG/MINOR: lb-map: fix unprotected update to server's score
    - BUILD: threads: fix minor build warnings when threads are disabled

6 years agoBUILD: threads: fix minor build warnings when threads are disabled
Willy Tarreau [Sun, 2 Dec 2018 18:28:41 +0000 (19:28 +0100)] 
BUILD: threads: fix minor build warnings when threads are disabled

These potential null-deref warnings are emitted on gcc 7 and above
when threads are disabled due to the use of objt_server() after an
existing validity test. Let's switch to __objt_server() since we
know the pointer is valid, it will not confuse the compiler.

Some of these may be backported to 1.8.

6 years agoBUG/MINOR: lb-map: fix unprotected update to server's score
Willy Tarreau [Sun, 2 Dec 2018 18:22:55 +0000 (19:22 +0100)] 
BUG/MINOR: lb-map: fix unprotected update to server's score

The loop trying to figure the best server is theorically capable of
finishing the loop with best == NULL, causing the HA_ATOMIC_SUB()
to fail there. However for this to happen the list should be empty,
which is avoided at the beginning of the function. As it is, the
function still remains at risk so better address this now.

This patch should be backported to 1.8.

6 years agoCLEANUP: Fix a typo in the listener subsystem
Joseph Herlant [Sun, 25 Nov 2018 21:36:58 +0000 (13:36 -0800)] 
CLEANUP: Fix a typo in the listener subsystem

Fixes a typo in the code comment of the listener subsystem.

6 years agoCLEANUP: Fix typos in the file descriptor subsystem
Joseph Herlant [Sun, 25 Nov 2018 21:34:43 +0000 (13:34 -0800)] 
CLEANUP: Fix typos in the file descriptor subsystem

Fixes 2 typos in the code comment of the file descriptor subsystem.

6 years agoCLEANUP: Fix a typo in the checks header file
Joseph Herlant [Sun, 25 Nov 2018 21:28:30 +0000 (13:28 -0800)] 
CLEANUP: Fix a typo in the checks header file

Fixes a typo in the code comments of the checks header file.

6 years agoCLEANUP: Fix a typo in the protocol header file
Joseph Herlant [Sun, 25 Nov 2018 21:26:40 +0000 (13:26 -0800)] 
CLEANUP: Fix a typo in the protocol header file

Fixes a typo in the code comments of the header file holding the general
protocol primitives.

6 years agoCLEANUP: Fix a typo in the connection subsystem
Joseph Herlant [Sun, 25 Nov 2018 21:21:12 +0000 (13:21 -0800)] 
CLEANUP: Fix a typo in the connection subsystem

Fixes a typo in the code comments of the connection subsystem.

6 years agoCLEANUP: Fix a typo in the base64 subsystem
Joseph Herlant [Sun, 25 Nov 2018 21:16:35 +0000 (13:16 -0800)] 
CLEANUP: Fix a typo in the base64 subsystem

Fixes a typo in the code comments of the base64 subsystem.

6 years agoCLEANUP: Fix typo in the 51d subsystem
Joseph Herlant [Sun, 25 Nov 2018 21:15:13 +0000 (13:15 -0800)] 
CLEANUP: Fix typo in the 51d subsystem

Fixes a typo in the code comments of the 51d subsystem.

6 years agoCLEANUP: Fix typos in the cli subsystem
Joseph Herlant [Sun, 25 Nov 2018 20:51:45 +0000 (12:51 -0800)] 
CLEANUP: Fix typos in the cli subsystem

Fixes typos in the code comments of the cli subsystem.

6 years agoCLEANUP: Fix typo in the fwrr subsystem
Joseph Herlant [Sun, 25 Nov 2018 20:44:37 +0000 (12:44 -0800)] 
CLEANUP: Fix typo in the fwrr subsystem

Fixes a typo in the code comment of the fwrr subsystem.

6 years agoCLEANUP: Fix typos in the map management functions
Joseph Herlant [Sun, 25 Nov 2018 19:48:18 +0000 (11:48 -0800)] 
CLEANUP: Fix typos in the map management functions

Fixes typos in the code comments of the MAP management functions.

6 years agoCLEANUP: Fix typos in the socket pair protocol subsystem
Joseph Herlant [Sun, 25 Nov 2018 19:43:27 +0000 (11:43 -0800)] 
CLEANUP: Fix typos in the socket pair protocol subsystem

Fixes typos in the code comments of the socket pair protocol subsystem.

6 years agoCLEANUP: Fix typos in the shctx subsystem
Joseph Herlant [Sun, 25 Nov 2018 19:31:31 +0000 (11:31 -0800)] 
CLEANUP: Fix typos in the shctx subsystem

Fixes typos in the code comments of the shctx subsystem.

6 years agoCLEANUP: Fix a typo in the queue subsystem
Joseph Herlant [Sun, 25 Nov 2018 19:26:48 +0000 (11:26 -0800)] 
CLEANUP: Fix a typo in the queue subsystem

Fixes a typo in the code comments of the queue subsystem.

6 years agoCLEANUP: Fix a typo in the session subsystem
Joseph Herlant [Sun, 25 Nov 2018 19:22:10 +0000 (11:22 -0800)] 
CLEANUP: Fix a typo in the session subsystem

Fixes a typo in the code comments of the session subsystem.

6 years agoCLEANUP: Fix a typo in the signal subsystem
Joseph Herlant [Sun, 25 Nov 2018 19:19:40 +0000 (11:19 -0800)] 
CLEANUP: Fix a typo in the signal subsystem

Fixes a typo in the code comments of the signal subsystem.

6 years agoCLEANUP: Fix typos in the proto_tcp subsystem
Joseph Herlant [Sun, 25 Nov 2018 20:59:12 +0000 (12:59 -0800)] 
CLEANUP: Fix typos in the proto_tcp subsystem

Fixes typos in the code comments of the proto_tcp subsystem.

6 years agoCLEANUP: Fix a typo in the proto_htx subsystem
Joseph Herlant [Sun, 25 Nov 2018 19:00:25 +0000 (11:00 -0800)] 
CLEANUP: Fix a typo in the proto_htx subsystem

Fixes a typo in the code comments of the proto_htx subsystem.

6 years agoCLEANUP: Fix a typo in the mini-clist header
Joseph Herlant [Sun, 25 Nov 2018 18:57:13 +0000 (10:57 -0800)] 
CLEANUP: Fix a typo in the mini-clist header

Fixes a typo in the code comments of the mini-clist header.

6 years agoCLEANUP: Fix typos in the h2 subsystem
Joseph Herlant [Sun, 25 Nov 2018 18:54:45 +0000 (10:54 -0800)] 
CLEANUP: Fix typos in the h2 subsystem

Fixes typos in the code comments of the h2 subsystem.

6 years agoCLEANUP: Fix typos in the h1 subsystem
Joseph Herlant [Sun, 25 Nov 2018 18:52:20 +0000 (10:52 -0800)] 
CLEANUP: Fix typos in the h1 subsystem

Fixes typos in the code comments of the h1 subsystem.

6 years agoCLEANUP: Fix typo in the chunk headers file
Joseph Herlant [Sun, 25 Nov 2018 18:49:51 +0000 (10:49 -0800)] 
CLEANUP: Fix typo in the chunk headers file

Fix a typo detected in the chunk.h header file's code comments.

6 years agoCLEANUP: fix typos in the htx subsystem
Joseph Herlant [Sun, 25 Nov 2018 18:43:27 +0000 (10:43 -0800)] 
CLEANUP: fix typos in the htx subsystem

Fix typos detected in the code comments of the htx subsystem.

6 years agoMEDIUM: servers: Add a way to keep idle connections alive.
Olivier Houchard [Sun, 2 Dec 2018 13:11:41 +0000 (14:11 +0100)] 
MEDIUM: servers: Add a way to keep idle connections alive.

Add a new keyword for servers, "idle-timeout". If set, unused connections are
kept alive until the timeout happens, and will be picked for reuse if no
other connection is available.

6 years agoMINOR: mux: add a "max_streams" method.
Olivier Houchard [Sun, 2 Dec 2018 00:31:17 +0000 (01:31 +0100)] 
MINOR: mux: add a "max_streams" method.

Add a new method to muxes, "max_streams", that returns the max number of
streams the mux can handle. This will be used to know if a mux is in use
or not.

6 years agoMINOR: connection: Fix a comment.
Olivier Houchard [Sat, 1 Dec 2018 23:35:08 +0000 (00:35 +0100)] 
MINOR: connection: Fix a comment.

Connections can now have an owner for outgoing connections, so update
the comment tu reflect that.

6 years agoREGTEST: Fix LEVEL 4 script 0 of "connection" module.
Frédéric Lécaille [Thu, 29 Nov 2018 13:23:32 +0000 (14:23 +0100)] 
REGTEST: Fix LEVEL 4 script 0 of "connection" module.

Prevent this script from creating a UNIX socket in ${testdir} which
is the parent directory of the script. Prefer use ${tmpdir} which
is the temporary working directory for the script.

6 years agoMEDIUM: mux-h2: Don't bother flagging outgoing connections as TOOMANY.
Olivier Houchard [Wed, 28 Nov 2018 14:41:48 +0000 (15:41 +0100)] 
MEDIUM: mux-h2: Don't bother flagging outgoing connections as TOOMANY.

When creating a new stream, don't bother flagging a connection with
H2_CF_DEM_TOOMANY if we created the last available stream. We won't create
any other anyway, because h2_avail_streams() would return 0 available streams,
and has it is a blocking flag, it prevents us from reading data after.

6 years agoMEDIUM: mux-h2: Implement h2_attach().
Olivier Houchard [Tue, 27 Nov 2018 16:36:33 +0000 (17:36 +0100)] 
MEDIUM: mux-h2: Implement h2_attach().

Implement h2_attach(), so that we can have multiple streams in one outgoin
h2 connection.

6 years agoMEDIUM: mux-h2: make h2_process_demux() capable of processing responses as well
Willy Tarreau [Mon, 8 Oct 2018 12:53:27 +0000 (14:53 +0200)] 
MEDIUM: mux-h2: make h2_process_demux() capable of processing responses as well

The function now calls h2c_bck_handle_headers() or h2c_frt_handle_headers()
depending on the connection's side. The former doesn't create a new stream
but feeds an existing one. At this point it's possible to forward an H2
request to a backend server and retrieve the response headers.

6 years agoMEDIUM: mux-h2: make h2_frt_decode_headers() direction-agnostic
Willy Tarreau [Mon, 8 Oct 2018 12:51:56 +0000 (14:51 +0200)] 
MEDIUM: mux-h2: make h2_frt_decode_headers() direction-agnostic

This function does not really depend on the request, all it does is
also valid for H2 responses found on the backend side, so this patch
renames it and makes it call the appropriate decoder based on the
direction.

6 years agoMEDIUM: mux-h2: implement encoding of H2 request on the backend side
Willy Tarreau [Fri, 5 Oct 2018 09:35:57 +0000 (11:35 +0200)] 
MEDIUM: mux-h2: implement encoding of H2 request on the backend side

This creates an H2 HEADERS frame from an HTX request. The code is
very similar to the response encoding, so probably that in the future
we'll have to factor these functions differently. The HTX's start line
type is used to decide on the direction. We also purposely error out
when trying to encode an H2 request from an H1 message since it's not
implemented.

6 years agoMEDIUM: mux-h2: start to create the outgoing mux
Willy Tarreau [Wed, 3 Oct 2018 12:26:37 +0000 (14:26 +0200)] 
MEDIUM: mux-h2: start to create the outgoing mux

For now it reports an immediate error when trying to encode the request
since it doesn't parse as a response. We take care of sending the preface
and settings frame with the outgoing connection, and not to wait for a
preface during the H2_CS_PREFACE phase for outgoing connections.

6 years agoMINOR: mux-h2: implement an outgoing stream allocator : h2c_bck_stream_new()
Willy Tarreau [Fri, 5 Oct 2018 07:35:00 +0000 (09:35 +0200)] 
MINOR: mux-h2: implement an outgoing stream allocator : h2c_bck_stream_new()

For the backend we'll need to allocate streams as well. Let's do this
with h2c_bck_stream_new(). The stream ID allocator was split from it
so that the caller can decide whether or not to stay on the same
connection or create a new one. It possibly isn't the best way to do
this as once we're on the mux it's too late to give up creation of a
new stream. Another approach would possibly consist in detaching muxes
that reached their connection count limit before they can be reused.

Instead of choosing the stream id as soon as the stream is created, wait
until data is about to be sent. If we don't do that, the stream may send
data out of order, and so the stream 3 may send data before the stream 1,
and then when the stream 1 will try to send data, the other end will
consider that an error, as stream ids should always be increased.

Cc: Olivier Houchard <ohouchard@haproxy.com>
6 years agoMINOR: mux-h2: mention that the mux is compatible with both sides
Willy Tarreau [Wed, 3 Oct 2018 08:25:20 +0000 (10:25 +0200)] 
MINOR: mux-h2: mention that the mux is compatible with both sides

We declare two configurations for the H2 mux. One supporting only
the frontend in HTTP mode and one supporting both sides in HTX mode.

This is only to ease development at this point. Trying to assign an h2
mux on the server side will still fail during h2_init() anyway instead
of at config parsing time.

6 years agoMINOR: h2: add new functions to produce an HTX message from an H2 response
Willy Tarreau [Mon, 8 Oct 2018 12:49:20 +0000 (14:49 +0200)] 
MINOR: h2: add new functions to produce an HTX message from an H2 response

The new function h2_prepare_htx_stsline() produces an HTX response message
from an H2 response presented as a list of header fields.

6 years agoMINOR: hpack: add ":path" to the list of common header fields
Willy Tarreau [Sun, 2 Dec 2018 11:43:18 +0000 (12:43 +0100)] 
MINOR: hpack: add ":path" to the list of common header fields

The ":path" header field will be used a lot with outgoing requests,
let's encode it with its index.

6 years agoMINOR: config: make sure to associate the proper mux to bind and servers
Willy Tarreau [Sun, 2 Dec 2018 12:09:09 +0000 (13:09 +0100)] 
MINOR: config: make sure to associate the proper mux to bind and servers

Currently a mux may be forced on a bind or server line by specifying the
"proto" keyword. The problem is that the mux may depend on the proxy's
mode, which is not known when parsing this keyword, so a wrong mux could
be picked.

Let's simply update the mux entry while checking its validity. We do have
the name and the side, we only need to see if a better mux fits based on
the proxy's mode. It also requires to remove the side check while parsing
the "proto" keyword since a wrong mux could be picked.

This way it becomes possible to declare multiple muxes with the same
protocol names and different sides or modes.

6 years agoMINOR: server: the mux_proto entry in the server is const
Willy Tarreau [Sun, 2 Dec 2018 12:08:34 +0000 (13:08 +0100)] 
MINOR: server: the mux_proto entry in the server is const

Same as previous commit. We'll have to update this one soon, let's
avoid any cast and mark it const as it really is.

6 years agoMINOR: connection: create conn_get_best_mux_entry()
Willy Tarreau [Sun, 2 Dec 2018 12:04:43 +0000 (13:04 +0100)] 
MINOR: connection: create conn_get_best_mux_entry()

We currently have conn_get_best_mux() to return the best mux for a
given protocol name, side and proxy mode. But we need the mux entry
as well in order to fix the bind_conf and servers at the end of the
config parsing. Let's split the function in two parts. It's worth
noting that the <conn> argument is never used anymore so this part
is eligible to some cleanup.

6 years agoMINOR: listener: the mux_proto entry in the bind_conf is const
Willy Tarreau [Sun, 2 Dec 2018 12:03:57 +0000 (13:03 +0100)] 
MINOR: listener: the mux_proto entry in the bind_conf is const

We'll have to update this one soon, let's avoid any cast and mark it
const as it really is.

6 years agoBUG/MEDIUM: mux-h2: remove the HTX EOM block on H2 response headers
Willy Tarreau [Sun, 2 Dec 2018 11:28:01 +0000 (12:28 +0100)] 
BUG/MEDIUM: mux-h2: remove the HTX EOM block on H2 response headers

If we decided to emit the end of stream flag on the H2 response headers
frame, we must remove the EOM block from the HTX stream, otherwise it
will lead to an extra DATA frame being sent with the ES flag and will
violate the protocol.

6 years agoBUG/MEDIUM: mux-h2: don't lose the first response header in HTX mode
Willy Tarreau [Sun, 2 Dec 2018 11:11:16 +0000 (12:11 +0100)] 
BUG/MEDIUM: mux-h2: don't lose the first response header in HTX mode

When converting response headers from HTX to H2, we accidently skipped
the first header block.

6 years agoBUG/MINOR: cfgparse: Fix the call to post parser of the last sections parsed
Christopher Faulet [Sun, 2 Dec 2018 08:37:38 +0000 (09:37 +0100)] 
BUG/MINOR: cfgparse: Fix the call to post parser of the last sections parsed

Wrong variable was used to know if we need to call the callback
post_section_parser() or not. We must use 'cs' and not 'pcs'.

This patch must be backported in 1.8 with the commit 7805e2b ("BUG/MINOR:
cfgparse: Fix transition between 2 sections with the same name").

6 years agoMEDIUM: mux-h2: support passing H2 DATA frames to HTX blocks
Willy Tarreau [Sat, 1 Dec 2018 22:23:04 +0000 (23:23 +0100)] 
MEDIUM: mux-h2: support passing H2 DATA frames to HTX blocks

This is used for uploads, we can now convert H2 DATA frames to HTX
DATA blocks. It's uncertain whether it's better to reuse the same
function or to split it in two at this point. For now the same
function was added with some paths specific to HTX. In this mode
we loop back to the same or next frame in order to try to complete
DATA blocks.

6 years agoMEDIUM: mux-h2: implement the emission of DATA frames from HTX DATA blocks
Willy Tarreau [Sat, 1 Dec 2018 18:25:56 +0000 (19:25 +0100)] 
MEDIUM: mux-h2: implement the emission of DATA frames from HTX DATA blocks

At the moment the way it's done is not optimal. We should aggregate multiple
blocks into a single DATA frame, and we should merge the ES flag with the
last one when we already know we've reached the end. For now and for an
easier tracking of the HTX stream, an individual empty DATA frame is sent
with the ES bit when EOM is met.

The DATA function is called for DATA, EOD and EOM since these stats indicate
that a previous frame was already produced without the ES flag (typically a
headers frame or another DATA frame). Thus it makes sense to handle all these
blocks there.

There's still an uncertainty on the way the EOD and EOM HTX blocks must be
accounted for, as they're counted as one byte in the HTX stream, but if we
count that byte off when parsing these blocks, we end up sending too much
and desynchronizing the HTX stream. Maybe it hides an issue somewhere else.

At least it's possible to reliably retrieve payloads up to 1 GB over H2/HTX
now. It's still unclear why larger ones are interrupted at 1 GB.

6 years agoMEDIUM: mux-h2: implement emission of H2 headers frames from HTX blocks
Willy Tarreau [Sat, 1 Dec 2018 18:17:53 +0000 (19:17 +0100)] 
MEDIUM: mux-h2: implement emission of H2 headers frames from HTX blocks

When using HTX, we need a separate function to emit a headers frame.
The code is significantly different from the H1 to H2 conversion, though
it borrows some parts there. It looks like the part building the H2 frame
from the headers list could be factored out, however some of the logic
around dealing with end of stream or block sizes remains different.

With this patch it becomes possible to retrieve bodyless HTTP responses
using H2 over HTX.

6 years agoMEDIUM: mux-h2: add basic H2->HTX transcoding support for headers
Willy Tarreau [Tue, 27 Nov 2018 08:29:36 +0000 (09:29 +0100)] 
MEDIUM: mux-h2: add basic H2->HTX transcoding support for headers

When the proxy is configured to use HTX mode, the headers frames
will be converted to HTX header blocks instead of HTTP/1 messages.
This requires very little modifications to the existing function
so it appeared better to do it this way than to duplicate it.

Only the request headers are handled, responses are not processed
yet and data frames are not processed yet either. The return value
is inaccurate but this is not an issue since we're using it as a
boolean : data received or not.

6 years agoMEDIUM: mux-h2: make h2_snd_buf() HTX-aware
Willy Tarreau [Sat, 1 Dec 2018 17:59:00 +0000 (18:59 +0100)] 
MEDIUM: mux-h2: make h2_snd_buf() HTX-aware

Now h2_snd_buf() will check the proxy's mode to decide whether to use
HTX-specific send functions or legacy functions. In HTX mode, the HTX
blocks of the output buffer will be parsed and the related functions
will be called accordingly based on the block type, and unimplemented
blocks will be skipped. For now all blocks are skipped, this is only
helpful for debugging.

6 years agoMEDIUM: mux-h2: make h2_rcv_buf() support HTX transfers
Willy Tarreau [Sat, 1 Dec 2018 22:19:43 +0000 (23:19 +0100)] 
MEDIUM: mux-h2: make h2_rcv_buf() support HTX transfers

The function needs to be slightly adapted to transfer HTX blocks, since
it may face a full buffer on the receive path, thus it needs to transfer
HTX blocks between the two sides ignoring the <count> argument in this
mode.

6 years agoMEDIUM: mux-h2: register mux for both HTTP and HTX modes
Willy Tarreau [Fri, 30 Nov 2018 15:49:47 +0000 (16:49 +0100)] 
MEDIUM: mux-h2: register mux for both HTTP and HTX modes

The H2 mux will now be called for both HTTP and HTX modes. For now the
data transferr functions are not HTX-aware so this will lead to problems
if used as-is but it's convenient for development and debugging.

6 years agoMINOR: h2: implement H2->HTX request header frame transcoding
Willy Tarreau [Tue, 27 Nov 2018 14:34:18 +0000 (15:34 +0100)] 
MINOR: h2: implement H2->HTX request header frame transcoding

Till now we could only produce an HTTP/1 request from a list of H2
request headers. Now the new function h2_make_htx_request() does the
same but using the HTX encoding instead, while respecting the H2
semantics. The code is not much different from the first version,
only the encoding differs.

For now it's not used.

6 years agoMEDIUM: compression: Adapt to be compatible with the HTX representation
Christopher Faulet [Fri, 30 Nov 2018 21:29:48 +0000 (22:29 +0100)] 
MEDIUM: compression: Adapt to be compatible with the HTX representation

Functions analyzing request and response headers have been duplicated and
adapted to support HTX messages. The callback http_payload have been implemented
to handle the data compression itself. It loops on HTX blocks and replace
uncompressed value of DATA block by compressed one. Unlike the HTTP legacy
version, there is no chunk at all. So HTX version is significantly easier.

6 years agoMINOR: flt_trace: Adapt to be compatible with the HTX representation
Christopher Faulet [Fri, 30 Nov 2018 21:23:32 +0000 (22:23 +0100)] 
MINOR: flt_trace: Adapt to be compatible with the HTX representation

The callback http_headers has been updated to dump HTX headers when the HTX
internal representation is in use. And the callback http_payload has been
implemented with its hexdump function.

6 years agoMEDIUM: proto_htx/filters: Add data filtering during the forwarding
Christopher Faulet [Fri, 30 Nov 2018 21:22:32 +0000 (22:22 +0100)] 
MEDIUM: proto_htx/filters: Add data filtering during the forwarding

If there is data filters registered on the stream, the function
flt_http_payload() is called before forwarding any data. And the function
flt_http_end() is called when all data are forwarded. While at least one data
filter reamins registered on the stream, no fast forwarding is used.

6 years agoMAJOR: filters: Adapt filters API to be compatible with the HTX represenation
Christopher Faulet [Fri, 30 Nov 2018 14:18:09 +0000 (15:18 +0100)] 
MAJOR: filters: Adapt filters API to be compatible with the HTX represenation

First, to be called on HTX streams, a filter must explicitly be declared as
compatible by setting the flag STRM_FLT_FL_HAS_FILTERS on the filter's config at
HAProxy startup. This flag is checked when a filter implementation is attached
to a stream.

Then, some changes have been made on HTTP callbacks. The callback http_payload
has been added to filter HTX data. It will be called on HTX streams only. It
replaces the callbacks http_data, http_chunk_trailers and http_forward_data,
called on legacy HTTP streams only and marked as deprecated. The documention
(once updated)) will give all information to implement this new callback. Other
HTTP callbacks will be called for HTX and HTTP legacy streams. So it is the
filter's responsibility to known which kind of data it handles. The macro
IS_HTX_STRM should be used in such cases.

There is at least a noticeable changes in the way data are forwarded. In HTX,
after the call to the callback http_headers, all the headers are considered as
forwarded. So, in http_payload, only the body and eventually the trailers will
be filtered.

6 years agoMINOR: mux-h1: Capture bad H1 messages
Christopher Faulet [Thu, 29 Nov 2018 22:01:45 +0000 (23:01 +0100)] 
MINOR: mux-h1: Capture bad H1 messages

First of all, an dedicated error snapshot, h1_snapshot, has been added. It
contains more or less the some info than http_snapshot but adapted for H1
messages. Then, the function h1_capture_bad_message() has been added to capture
bad H1 messages. And finally, the function h1_show_error_snapshot() is used to
dump these errors. Only Headers or data parsing are captured.

6 years agoMINOR: mux-h1: Change client conn_mode on an explicit close for the response
Christopher Faulet [Thu, 29 Nov 2018 08:55:22 +0000 (09:55 +0100)] 
MINOR: mux-h1: Change client conn_mode on an explicit close for the response

in h1_set_cli_conn_mode(), on the response path, If the response's connection
header is explicitly set to close and if the request is unfinished (state !=
DONE), then the client connection is marked as WANT_CLO.

6 years agoMINOR: mux-h1: Process conn_mode on the EOH when no connection header is found
Christopher Faulet [Wed, 28 Nov 2018 15:32:50 +0000 (16:32 +0100)] 
MINOR: mux-h1: Process conn_mode on the EOH when no connection header is found

Instead of looking for a connection header just after the start line to know if
we must process the conn_mode by hand or if we wait to parse the connection
header, we now delay this processing when the end of headers is reached. A flag
is used to know if it was already done (or skipped) or not. This save a lookup
on headers.

6 years agoMEDIUM: proto_htx: Convert all HTTP error messages into HTX
Christopher Faulet [Thu, 29 Nov 2018 15:48:49 +0000 (16:48 +0100)] 
MEDIUM: proto_htx: Convert all HTTP error messages into HTX

During startup, after the configuration parsing, all HTTP error messages
(errorloc, errorfile or default messages) are converted into HTX messages and
stored in dedicated buffers. We use it to return errors in the HTX analyzers
instead of using ugly OOB blocks.

6 years agoMINOR: proto_htx: Send valid HTX message to send 30x responses
Christopher Faulet [Wed, 28 Nov 2018 21:58:13 +0000 (22:58 +0100)] 
MINOR: proto_htx: Send valid HTX message to send 30x responses

The function htx_apply_redirect_rule() has been rewritten to send a valid
HTX message.

6 years agoMINOR: proto_htx: Send valid HTX message when redir mode is enabled on a server
Christopher Faulet [Wed, 28 Nov 2018 16:46:40 +0000 (17:46 +0100)] 
MINOR: proto_htx: Send valid HTX message when redir mode is enabled on a server

The function htx_perform_server_redirect() has been rewritten to send a valid
HTX message.

6 years agoMINOR: proto_htx: Use full HTX messages to send 401 and 407 responses
Christopher Faulet [Wed, 28 Nov 2018 14:59:42 +0000 (15:59 +0100)] 
MINOR: proto_htx: Use full HTX messages to send 401 and 407 responses

Instead of replying by adding an OOB block in the HTX structure, we now add a
valid HTX message. The old code relied on the function http_reply_and_close() to
send 401/407 responses. Now, we push it in the response's buffer. So we take
care to drain the request's channel and to shutdown the response's channel for
the read.

6 years agoMINOR: proto_htx: Use full HTX messages to send 103-Early-Hints responses
Christopher Faulet [Wed, 28 Nov 2018 12:55:14 +0000 (13:55 +0100)] 
MINOR: proto_htx: Use full HTX messages to send 103-Early-Hints responses

Instead of replying by adding an OOB block in the HTX structure, we now add a
valid HTX message. A header block is added to each early-hint rule, prefixed by
the start line if it is the first one. The response is terminated and forwarded
when the rules execution is stopped or when a rule of another type is applied.

6 years agoMINOR: proto_htx: Use full HTX messages to send 100-Continue responses
Christopher Faulet [Wed, 28 Nov 2018 09:01:23 +0000 (10:01 +0100)] 
MINOR: proto_htx: Use full HTX messages to send 100-Continue responses

Instead of replying by adding an OOB block in the HTX structure, we now add a
valid HTX message.

6 years agoMINOR: htx: Add BODYLESS flags on the HTX start-line and the HTTP message
Christopher Faulet [Tue, 27 Nov 2018 15:51:09 +0000 (16:51 +0100)] 
MINOR: htx: Add BODYLESS flags on the HTX start-line and the HTTP message

the flags HTX_SL_F_BODYLESS and HTTP_MSGF_BODYLESS have been added. These flags
are set when the corresponding HTTP message has no body at all.

6 years agoMINOR: proto-htx: Use the start-line flags to set the HTTP messsage ones
Christopher Faulet [Tue, 27 Nov 2018 10:21:21 +0000 (11:21 +0100)] 
MINOR: proto-htx: Use the start-line flags to set the HTTP messsage ones

the flags of the HTX start-line (HTX_SL_F_*) are mapped on ones of the HTTP
message (HTTP_MSGS_*). So we can easily retrieve info from the parsing in HTX
analyzers.

6 years agoMEDIUM: htx: Don't rely on h1_sl anymore except during H1 header parsing
Christopher Faulet [Mon, 26 Nov 2018 20:37:08 +0000 (21:37 +0100)] 
MEDIUM: htx: Don't rely on h1_sl anymore except during H1 header parsing

Instead, we now use the htx_sl coming from the HTX message. It avoids to have
too H1 specific code in version-agnostic parts. Of course, the concept of the
start-line is higly influenced by the H1, but the structure htx_sl can be
adapted, if necessary. And many things depend on a start-line during HTTP
analyzis. Using the structure htx_sl also avoid boring conversions between HTX
version and H1 version.

6 years agoMINOR: htx: Add the start-line offset for the HTX message in the HTX structure
Christopher Faulet [Mon, 26 Nov 2018 14:05:52 +0000 (15:05 +0100)] 
MINOR: htx: Add the start-line offset for the HTX message in the HTX structure

If there is no start-line, this offset is set to -1. Otherwise, it is the
relative address where the start-line is stored in the data block. When the
start-line is added, replaced or removed, this offset is updated accordingly. On
remove, if the start-line is no set and if the next block is a start-line, the
offset is updated. Finally, when an HTX structure is defragmented, the offset is
also updated accordingly.

6 years agoMEDIUM: htx: Change htx_sl to be a struct instead of an union
Christopher Faulet [Mon, 26 Nov 2018 10:13:57 +0000 (11:13 +0100)] 
MEDIUM: htx: Change htx_sl to be a struct instead of an union

The HTX start-line is now a struct. It will be easier to extend, if needed. Same
info can be found, of course. In addition it is now possible to set flags on
it. It will be used to set some infos about the message.

Some macros and functions have been added in proto/htx.h to help accessing
different parts of the start-line.

6 years agoMINOR: stats: Don't add end-of-data marker and trailers in the HTX response
Christopher Faulet [Wed, 21 Nov 2018 12:51:07 +0000 (13:51 +0100)] 
MINOR: stats: Don't add end-of-data marker and trailers in the HTX response

Because the mux H1 is able to handle these blocks by itself, it is easier to
ignore them in the stats applet.

6 years agoMINOR: htx: Add a function to find the HTX block corresponding to a data offset
Christopher Faulet [Thu, 22 Nov 2018 10:28:18 +0000 (11:28 +0100)] 
MINOR: htx: Add a function to find the HTX block corresponding to a data offset

The function htx_find_blk() returns the HTX block containing data with a given
offset, relatively to the beginning of the HTX message. It is a good way to skip
outgoing data and find the first HTX block not already processed.

6 years agoMINOR: htx: Add function to iterate on an HTX message using HTX blocks
Christopher Faulet [Thu, 22 Nov 2018 10:23:23 +0000 (11:23 +0100)] 
MINOR: htx: Add function to iterate on an HTX message using HTX blocks

the functions htx_get_next() and htx_get_prev() are used to iterate on an HTX
message using blocks position. With htx_get_next_blk() and htx_get_prev_blk(),
it is possible to do the same, but with HTX blocks. Of course, internally, we
rely on position's versions to do so. But it is handy for callers to not take
care of the blocks position.

6 years agoMINOR: htx: Add function to add an HTX block just before another one
Christopher Faulet [Thu, 22 Nov 2018 10:20:43 +0000 (11:20 +0100)] 
MINOR: htx: Add function to add an HTX block just before another one

The function htx_add_data_before() can be used to add an HTX block before
another one. For instance, it could be used to add some data before the
end-of-message marker.

6 years agoMEDIUM: mux-h1: Add keep-alive outgoing connections in connections list
Christopher Faulet [Fri, 23 Nov 2018 22:10:39 +0000 (23:10 +0100)] 
MEDIUM: mux-h1: Add keep-alive outgoing connections in connections list

With the legacy representation, keep-alive outgoing connections are added in
private/idle/safe connections list when the transaction is cleaned up. But this
stage does not exist with the HTX representaion because a new stream, and
therefore a new transaction, is created for each request. So it is now handled
when the stream is detached from the connection.

6 years agoMINOR: mux-h1: Consume channel's data in a loop in h1_snd_buf()
Christopher Faulet [Thu, 22 Nov 2018 09:58:42 +0000 (10:58 +0100)] 
MINOR: mux-h1: Consume channel's data in a loop in h1_snd_buf()

In h1_snd_buf(), the data sending is done synchronously, as much as possible. So
if some data remains in the channel's buffer, because there was not enougth
place in the output buffer, it may be good the retry after a send because some
space may have been released when sending. Most of time the output buffer is
empty and all channel's data are consumed the first time. And if no data are
sent, we don't retry to do more. So the loop is just here to optimize edge cases
without any cost for all others.