Commit Graph

20847 Commits

Author SHA1 Message Date
William Lallemand
1918bcbc12 BUILD: ssl: enable keylog for awslc
AWSLC suports SSL_CTX_set_keylog_callback(), this patch enables the
build with the keylog feature for this library.
2023-10-09 16:17:30 +02:00
William Lallemand
4428ac4f70 BUILD: ssl: add 'secure_memcmp' converter for WolfSSL and awslc
CRYPTO_memcmp is supported by both awslc and wolfssl, lets add the
suport for the 'secure_memcmp' converter into the build.
2023-10-09 15:44:50 +02:00
William Lallemand
bf426eecd7 BUILD: ssl: add 'ssl_c_r_dn' fetch for WolfSSL
WolfSSL supports SSL_get0_verified_chain() so we can activate this
feature.
2023-10-09 15:09:47 +02:00
William Lallemand
d75bc06bdc BUILD: ssl: enable 'ciphersuites' for WolfSSL
WolfSSL supports setting the 'ciphersuites', lets enable the keyword for
it.
2023-10-09 14:56:43 +02:00
William Lallemand
a62a2d8b48 MINOR: ssl: add an explicit error when 'ciphersuites' are not supported
Add an explicit error when the support for 'ciphersuites' was not enable
into the build because of the SSL library.
2023-10-09 14:46:09 +02:00
Willy Tarreau
7f1a3ee5d7 [RELEASE] Released version 2.9-dev7
Released version 2.9-dev7 with the following main changes :
    - MINOR: support for http-request set-timeout client
    - BUG/MINOR: mux-quic: remove full demux flag on ncbuf release
    - CLEANUP: freq_ctr: make all freq_ctr readers take a const
    - CLEANUP: stream: make the dump code not depend on the CLI appctx
    - MINOR: stream: split stats_dump_full_strm_to_buffer() in two
    - CLEANUP: stream: use const filters in the dump function
    - CLEANUP: stream: make strm_dump_to_buffer() take a const stream
    - MINOR: stream: make strm_dump_to_buffer() take an arbitrary buffer
    - MINOR: stream: make strm_dump_to_buffer() show the list of filters
    - MINOR: stream: make stream_dump() always multi-line
    - MINOR: streams: add support for line prefixes to strm_dump_to_buffer()
    - MEDIUM: stream: now provide full stream dumps in case of loops
    - MINOR: debug: use the more detailed stream dump in panics
    - CLEANUP: stream: remove the now unused stream_dump() function
    - Revert "BUG/MEDIUM: quic: missing check of dcid for init pkt including a token"
    - MINOR: stream: fix output alignment of stuck thread dumps
    - BUG/MINOR: proto_reverse_connect: fix FD leak on connection error
    - BUG/MINOR: tcp_act: fix attach-srv rule ACL parsing
    - MINOR: connection: define error for reverse connect
    - MINOR: connection: define mux flag for reverse support
    - MINOR: tcp_act: remove limitation on protocol for attach-srv
    - BUG/MINOR: proto_reverse_connect: fix FD leak upon connect
    - BUG/MAJOR: plock: fix major bug in pl_take_w() introduced with EBO
    - Revert "MEDIUM: sample: Small fix in function check_operator for eror reporting"
    - DOC: sample: Add a comment in 'check_operator' to explain why 'vars_check_arg' should ignore the 'err' buffer
    - DEV: sslkeylogger: handle file opening error
    - MINOR: quic: define quic-socket bind setting
    - MINOR: quic: handle perm error on bind during runtime
    - MINOR: backend: refactor specific source address allocation
    - MINOR: proto_reverse_connect: support source address setting
    - BUILD: pool: Fix GCC error about potential null pointer dereference
    - MINOR: hlua: Set context's appctx when the lua socket is created
    - MINOR: hlua: Don't preform operations on a not connected socket
    - MINOR: hlua: Save the lua socket's timeout in its context
    - MINOR: hlua: Save the lua socket's server in its context
    - MINOR: hlua: Test the hlua struct first when the lua socket is connecting
    - BUG/MEDIUM: hlua: Initialize appctx used by a lua socket on connect only
    - DEBUG: mux-h1: Fix event label from trace messages about payload formatting
    - BUG/MINOR: mux-h1: Handle read0 in rcv_pipe() only when data receipt was tried
    - BUG/MINOR: mux-h1: Ignore C-L when sending H1 messages if T-E is also set
    - BUG/MEDIUM: h1: Ignore C-L value in the H1 parser if T-E is also set
    - REGTESTS: filters: Don't set C-L header in the successful response to CONNECT
    - MINOR: mux-h1: Add flags if outgoing msg contains a header about its payload
    - MINOR: mux-h1: Rely on H1S_F_HAVE_CHNK to add T-E in outgoing messages
    - BUG/MEDIUM: mux-h1: Add C-L header in outgoing message if it was removed
    - BUG/MEDIUM: mux-h1; Ignore headers modifications about payload representation
    - BUG/MINOR: h1-htx: Keep flags about C-L/T-E during HEAD response parsing
    - MINOR: h1-htx: Declare successful tunnel establishment as bodyless
    - BUILD: quic: allow USE_QUIC to work with AWSLC
    - CI: github: add USE_QUIC=1 to aws-lc build
    - BUG/MINOR: hq-interop: simplify parser requirement
    - MEDIUM: cache: Add "Origin" header to secondary cache key
    - MINOR: haproxy: permit to register features during boot
    - MINOR: tcp_rules: tcp-{request,response} requires TCP or HTTP mode
    - MINOR: stktable: "stick" requires TCP or HTTP mode
    - MINOR: filter: "filter" requires TCP or HTTP mode
    - MINOR: backend/balance: "balance" requires TCP or HTTP mode
    - MINOR: flt_http_comp: "compression" requires TCP or HTTP mode
    - MINOR: http_htx/errors: prevent the use of some keywords when not in tcp/http mode
    - MINOR: fcgi-app: "use-fcgi-app" requires TCP or HTTP mode
    - MINOR: cfgparse-listen: "http-send-name-header" requires TCP or HTTP mode
    - MINOR: cfgparse-listen: "dynamic-cookie-key" requires TCP or HTTP mode
    - MINOR: proxy: dynamic-cookie CLIs require TCP or HTTP mode
    - MINOR: cfgparse-listen: "http-reuse" requires TCP or HTTP mode
    - MINOR: proxy: report a warning for max_ka_queue in proxy_cfg_ensure_no_http()
    - MINOR: cfgparse-listen: warn when use-server rules is used in wrong mode
    - DOC: config: unify "log" directive doc
    - MINOR: sink/log: fix some typos around postparsing logic
    - MINOR: sink: remove useless check after sink creation
    - MINOR: sink: don't rely on p->parent in sink appctx
    - MINOR: sink: don't rely on forward_px to init sink forwarding
    - MINOR: sink: refine forward_px usage
    - MINOR: sink: function to add new sink servers
    - BUG/MEDIUM: stconn: Fix comparison sign in sc_need_room()
    - BUG/MEDIUM: actions: always apply a longest match on prefix lookup
2023-10-06 22:03:17 +02:00
Willy Tarreau
1e3422e6b0 BUG/MEDIUM: actions: always apply a longest match on prefix lookup
Many actions take arguments after a parenthesis. When this happens, they
have to be tagged in the parser with KWF_MATCH_PREFIX so that a sub-word
is sufficient (since by default the whole block including the parenthesis
is taken).

The problem with this is that the parser stops on the first match. This
was OK years ago when there were very few actions, but over time new ones
were added and many actions are the prefix of another one (e.g. "set-var"
is the prefix of "set-var-fmt"). And what happens in this case is that the
first word is picked. Most often that doesn't cause trouble because such
similar-looking actions involve the same custom parser so actually the
wrong selection of the first entry results in the correct parser to be
used anyway and the error to be silently hidden.

But it's getting worse when accidentally declaring prefixes in multiple
files, because in this case it will solely depend on the object file link
order: if the longest name appears first, it will be properly detected,
but if it appears last, its other prefix will be detected and might very
well not be related at all and use a distinct parser. And this is random
enough to make some actions succeed or fail depending on the build options
that affect the linkage order. Worse: what if a keyword is the prefix of
another one, with a different parser but a compatible syntax ? It could
seem to work by accident but not do the expected operations.

The correct solution is to always look for the longest matching name.
This way the correct keyword will always be matched and used and there
will be no risk to randomly pick the wrong anymore.

This fix must be backported to the relevant stable releases.
2023-10-06 17:06:44 +02:00
Christopher Faulet
a633338b55 BUG/MEDIUM: stconn: Fix comparison sign in sc_need_room()
sc_need_room() function may be called with a negative value. In this case,
the intent is to be notified if any space was made in the channel buffer. In
the function, we get the min between the requested room and the maximum
possible room in the buffer, considering it may be an HTX buffer.

However this max value is unsigned and leads to an unsigned comparison,
casting the negative value to an unsigned value. Of course, in this case,
this always leads to the wrong result. This bug seems to have no effect but
it is hard to be sure.

To fix the issue, we take care to respect the requested room sign by casting
the max value to a signed integer.

This patch must be backported to 2.8.
2023-10-06 15:34:31 +02:00
Aurelien DARRAGON
31e8a003a5 MINOR: sink: function to add new sink servers
Move the sft creation part out of sink_finalize() function so that it
becomes possible to register sink's servers without forward_px being
set.
2023-10-06 15:34:31 +02:00
Aurelien DARRAGON
205d480d9f MINOR: sink: refine forward_px usage
now forward_px only serves as a hint to know if a proxy was created
specifically for the sink, in which case the sink is responsible for it.

Everywhere forward_px was used in appctx context: get the parent proxy from
the sft->srv instead.

This permits to finally get rid of the double link dependency between sink
and proxy.
2023-10-06 15:34:31 +02:00
Aurelien DARRAGON
405567c125 MINOR: sink: don't rely on forward_px to init sink forwarding
Instead, we check if at least one sft has been registered into the sink,
if it is the case, then we need to init the forwarding for the sink.
2023-10-06 15:34:31 +02:00
Aurelien DARRAGON
3c53f6cb76 MINOR: sink: don't rely on p->parent in sink appctx
Removing unnecessary dependency on proxy->parent pointer in
sink appctx functions by directly using the sink sft from the
applet->svcctx to get back to sink related structs.

Thanks to this, proxy used for a ringbuf does not have to be exclusive
to a single sink anymore.
2023-10-06 15:34:31 +02:00
Aurelien DARRAGON
ec770b7924 MINOR: sink: remove useless check after sink creation
It's useless to check if sink has been created with BUF type after
calling sink_new_buf() since the goal of the function is to create
a new sink of BUF type.
2023-10-06 15:34:31 +02:00
Aurelien DARRAGON
cb01da8d12 MINOR: sink/log: fix some typos around postparsing logic
Fixing some typos that have been overlooked during the recent log/sink
API improvements. Using this patch to make sink_new_from_logsrv() static
since it is not used outside of sink.c
2023-10-06 15:34:31 +02:00
Aurelien DARRAGON
e5d23d8676 DOC: config: unify "log" directive doc
"log" directive description was found 2 times in the configuration file:

First, in 3.1 in the "global parameters" chapter, and then in 4.2 in the
per-proxy keyword options.

Both descriptions are almost identical: having to maintain the "same"
documentation in 2 different places is error-prone. Due to this, some
precisions have been added in one of them, and were missing from
the other, and vice-versa, probably because one didn't see that the
"log" directive was also documented elsewhere.

To prevent the 2 descriptions from further diverging, and make it easier
to maintain, we merge them in the per-proxy "log" directive description
(in 4.2 chapter), and we add a pointer to it in the global "log" to
encourage the user to refer to the per-proxy "log" documentation for
usage details.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
19a1210dcd MINOR: cfgparse-listen: warn when use-server rules is used in wrong mode
haproxy will report a warning when "use-server" keyword is used within a
backend that doesn't support server rules to inform the user that rules
will be ignored.

To this day, only TCP and HTTP backends can make use of it.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
3934901e51 MINOR: proxy: report a warning for max_ka_queue in proxy_cfg_ensure_no_http()
Display a warning when max_ka_queue is set (it is the case when
"max-keep-alive-queue" directive is used within a proxy section) to inform
the user that this directives depends on the "http" mode to work and thus
will safely be ignored.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
65f1124b5d MINOR: cfgparse-listen: "http-reuse" requires TCP or HTTP mode
Prevent the use of the "http-reuse" keyword in proxy section when neither
the TCP nor the HTTP mode is set.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
403fdee6a4 MINOR: proxy: dynamic-cookie CLIs require TCP or HTTP mode
Prevent the use of "dynamic-cookie" related CLI commands if the backend
is not in TCP or HTTP mode.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
0b09727a22 MINOR: cfgparse-listen: "dynamic-cookie-key" requires TCP or HTTP mode
Prevent the use of the "dynamic-cookie-key" keyword in proxy sections
when TCP or HTTP modes are not set.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
d354947365 MINOR: cfgparse-listen: "http-send-name-header" requires TCP or HTTP mode
Prevent the use of the "http-send-name-header" keyword in proxy section
when neither TCP or HTTP mode is set.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
0ba731f50b MINOR: fcgi-app: "use-fcgi-app" requires TCP or HTTP mode
Prevent the use of the "use-fcgi-app" keyword in proxy sections where
neither TCP nor HTTP mode is set.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
b41b77b4cc MINOR: http_htx/errors: prevent the use of some keywords when not in tcp/http mode
Prevent the use of "errorfile", "errorfiles" and various errorloc options
in proxies that are neither in TCP or HTTP mode.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
225526dc16 MINOR: flt_http_comp: "compression" requires TCP or HTTP mode
Prevent the use of "compression" keyword in proxy sections when the proxy
is neither in tcp or http mode.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
1e0093a317 MINOR: backend/balance: "balance" requires TCP or HTTP mode
Prevent the use of "balance" and associated keywords when proxy is neither
in tcp or http mode.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
f9422551cd MINOR: filter: "filter" requires TCP or HTTP mode
Prevent the use of "filter" when proxy is not in TCP or HTTP mode.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
098ae743fd MINOR: stktable: "stick" requires TCP or HTTP mode
Prevent the use of "stick-table" and "stick *" when proxy is neither in
tcp or http mode.
2023-10-06 15:34:30 +02:00
Aurelien DARRAGON
09b15e4163 MINOR: tcp_rules: tcp-{request,response} requires TCP or HTTP mode
Prevent the use of tcp-{request,response} keyword in proxies that are
neither in TCP or HTTP modes.
2023-10-06 15:34:30 +02:00
Willy Tarreau
90fa2eaa15 MINOR: haproxy: permit to register features during boot
The regtests are using the "feature()" predicate but this one can only
rely on build-time options. It would be nice if some runtime-specific
options could be detected at boot time so that regtests could more
flexibly adapt to what is supported (capabilities, splicing, etc).

Similarly, certain features that are currently enabled with USE_XXX
could also be automatically detected at build time using ifdefs and
would simplify the configuration, but then we'd lose the feature
report in the feature list which is convenient for regtests.

This patch makes sure that haproxy -vv shows the variable's contents
and not the macro's contents, and adds a new hap_register_feature()
to allow the code to register a new keyword.
2023-10-06 11:40:02 +02:00
Remi Tricot-Le Breton
a5e96425a2 MEDIUM: cache: Add "Origin" header to secondary cache key
This patch add a hash of the Origin header to the cache's secondary key.
This enables to manage store responses that have a "Vary: Origin" header
in the cache when vary is enabled.
This cannot be considered as a means to manage CORS requests though, it
only processes the Origin header and hashes the presented value without
any form of URI normalization.

This need was expressed by Philipp Hossner in GitHub issue #251.

Co-Authored-by: Philipp Hossner <philipp.hossner@posteo.de>
2023-10-05 10:53:54 +02:00
Amaury Denoyelle
544e320f80 BUG/MINOR: hq-interop: simplify parser requirement
hq-interop should be limited for QUIC testing. As such, its code should
be kept plain simple and not implement too many things.

This patch fixes issues which may cause rare QUIC interop failures :
- remove some unneeded BUG_ON() as parser should not be too strict
- remove support of partial message parsing
- ensure buffer data does not wrap as it was not properly handled. In
  any case, this should never happen as only a single message will be
  stored for each qcs buffer.

This should be backported up to 2.6.
2023-10-04 17:32:23 +02:00
William Lallemand
aaa326b571 CI: github: add USE_QUIC=1 to aws-lc build
Feature are limited but aws-lc can now build with USE_QUIC=1.
2023-10-04 17:03:34 +02:00
William Lallemand
45174e4fdc BUILD: quic: allow USE_QUIC to work with AWSLC
This patch fixes the build with AWSLC and USE_QUIC=1, this is only meant
to be able to build for now and it's not feature complete.

The set_encryption_secrets callback has been split in set_read_secret
and set_write_secret.

Missing features:

- 0RTT was disabled.
- TLS1_3_CK_CHACHA20_POLY1305_SHA256, TLS1_3_CK_AES_128_CCM_SHA256 were disabled
- clienthello callback is missing, certificate selection could be
  limited (RSA + ECDSA at the same time)
2023-10-04 16:55:19 +02:00
Christopher Faulet
225a4d02e1 MINOR: h1-htx: Declare successful tunnel establishment as bodyless
Successful responses to a CONNECT or to a upgrade request have no payload.
Be explicit on this point by setting HTX_SL_F_BODYLESS_RESP flag on the HTX
start-line.
2023-10-04 15:34:18 +02:00
Christopher Faulet
b6c32f1e04 BUG/MINOR: h1-htx: Keep flags about C-L/T-E during HEAD response parsing
When a response to a HEAD request is parsed, flags to know if the content
length is set or if the payload is chunked must be preserved.. It is
important because of the previous fix. Otherwise, these headers will be
removed from the response sent to the client.

This patch must only backported if "BUG/MEDIUM: mux-h1; Ignore headers
modifications about payload representation" is backported.
2023-10-04 15:34:18 +02:00
Christopher Faulet
f89ba27caa BUG/MEDIUM: mux-h1; Ignore headers modifications about payload representation
We now ignore modifications during the message analysis about the payload
representation if only headers are updated and not meta-data. It means a C-L
header removed to add a T-E one or the opposite via HTTP actions. This kind
of changes are ignored because it is extremly hard to be sure the payload
will be properly formatted.

It is an issue since the HTX was introduced and it was never reported. Thus,
there is no reason to backport this patch for now. It relies on following commits:

  * MINOR: mux-h1: Add flags if outgoing msg contains a header about its payload
  * MINOR: mux-h1: Rely on H1S_F_HAVE_CHNK to add T-E in outgoing messages
  * BUG/MEDIUM: mux-h1: Add C-L header in outgoing message if it was removed
2023-10-04 15:34:18 +02:00
Christopher Faulet
c43742c188 BUG/MEDIUM: mux-h1: Add C-L header in outgoing message if it was removed
If a C-L header was found during parsing of a message but it was removed via
a HTTP action, it is re-added during the message formatting. Indeed, if
headers about the payload are modified, meta-data of the message must also
be updated. Otherwise, it is not possible to guarantee the message will be
properly formatted.

To do so, we rely on the flag H1S_F_HAVE_CLEN.

This patch should not be backported except an issue is explicitly
reported. It relies on "MINOR: mux-h1: Add flags if outgoing msg contains a
header about its payload".
2023-10-04 15:34:18 +02:00
Christopher Faulet
accd3e911c MINOR: mux-h1: Rely on H1S_F_HAVE_CHNK to add T-E in outgoing messages
If a message is declared to have a known length but no C-L or T-E headers
are set, a "Transfer-Encoding; chunked" header is automatically added. It is
useful for H2/H3 messages with no C-L header. There is now a flag to know
this header was found or added. So we use it.
2023-10-04 15:34:18 +02:00
Christopher Faulet
f32e28eddc MINOR: mux-h1: Add flags if outgoing msg contains a header about its payload
If a "Content-length" or "Transfer-Encoding; chunked" headers is found or
inserted in an outgoing message, a specific flag is now set on the H1
stream. H1S_F_HAVE_CLEN is set for "Content-length" header and
H1S_F_HAVE_CHNK for "Transfer-Encoding: chunked".

This will be useful to properly format outgoing messages, even if one of
these headers was removed by hand (with no update of the message meta-data).
2023-10-04 15:34:18 +02:00
Christopher Faulet
6f6aed92b7 REGTESTS: filters: Don't set C-L header in the successful response to CONNECT
in random-forwarding.vtc script, adding "Content-Lnegth; 0" header in the
successful response to the CONNECT request is invalid but it may also lead
to wrong check on the response. "rxresp" directive don"t handle CONNECT
response. Thus "-no_obj" must be added instead, to be sure the payload won't
be retrieved or expected.
2023-10-04 15:34:18 +02:00
Christopher Faulet
e7964eac2d BUG/MEDIUM: h1: Ignore C-L value in the H1 parser if T-E is also set
In fact, during the parsing there is already a test to remove the
Content-Length header if a Transfer-Encoding one is found. However, in the
parser, the content-length value was still used to set the body length (the
final one and the remaining one). This value is thus also used to set the
extra field in the HTX message and is then used during the sending stage to
announce the chunk size.

So, Content-Length header value must be ignored by the H1 parser to properly
reformat the message when it is sent.

This patch must be backported as far as 2.6. Lower versions don"t handle
this case.
2023-10-04 15:34:18 +02:00
Christopher Faulet
c367957851 BUG/MINOR: mux-h1: Ignore C-L when sending H1 messages if T-E is also set
In fact, it is already done but both flags (H1_MF_CLEN and H1_MF_CHUNK) are
set on the H1 parser. Thus it is errorprone when H1 messages are sent,
especially because most of time, the "Content-length" case is processed
before the "chunked" one. This may lead to compute the wrong chunk size and
to miss the last chunk.

This patch must be backported as far as 2.6. This case is not handled in 2.4
and lower.
2023-10-04 15:34:18 +02:00
Christopher Faulet
331241b084 BUG/MINOR: mux-h1: Handle read0 in rcv_pipe() only when data receipt was tried
In rcv_pipe() callback we must be careful to not report the end of stream
too early because some data may still be present in the input buffer. If we
report a EOS here, this will block the subsequent call to rcv_buf() to
process remaining input data. This only happens when we try a last
rcv_pipe() when the xfer length is unknown and all data was already received
in the input buffer. Concretely this happens with a payload larger than a
buffer but lower than 2 buffers.

This patch must be backported as far as 2.7.
2023-10-04 15:34:18 +02:00
Christopher Faulet
2225cb660c DEBUG: mux-h1: Fix event label from trace messages about payload formatting
The label used for in/out trace messages about payload formatting was not
the right one. Use H1_EV_TX_BODY, instead of H1_EV_TX_HDRS.
2023-10-04 15:34:18 +02:00
Christopher Faulet
751b59c40b BUG/MEDIUM: hlua: Initialize appctx used by a lua socket on connect only
Ths appctx used by a lua socket was synchronously initialized after the
appctx creation. The connect itself is performed later. However it is an
issue because the script may be interrupted beteween the two operation. In
this case, the stream attached to the appctx is woken up before any
destination is set. The stream will try to connect but without destination,
it fails. When the lua script is rescheduled and the connect is performed,
the connection has already failed and an error is returned.

To fix the issue, we must be sure to not woken up the stream before the
connect. To do so, we must defer the appctx initilization. It is now perform
on connect.

This patch relies on the following commits:

  * MINOR: hlua: Test the hlua struct first when the lua socket is connecting
  * MINOR: hlua: Save the lua socket's server in its context
  * MINOR: hlua: Save the lua socket's timeout in its context
  * MINOR: hlua: Don't preform operations on a not connected socket
  * MINOR: hlua: Set context's appctx when the lua socket is created

All the series must be backported as far as 2.6.
2023-10-04 15:34:13 +02:00
Christopher Faulet
66fc9238f0 MINOR: hlua: Test the hlua struct first when the lua socket is connecting
It makes sense to first verify the hlua context is valid. It is probably
better than doing it after updated the appctx.
2023-10-04 15:34:10 +02:00
Christopher Faulet
6f4041c75d MINOR: hlua: Save the lua socket's server in its context
For the same reason than the timeout, the server used by a lua socket is now
saved in its context. This will be mandatory to fix issues with the lua
sockets.
2023-10-04 15:34:06 +02:00
Christopher Faulet
0be1ae2fa2 MINOR: hlua: Save the lua socket's timeout in its context
When the lua socket timeout is set, it is now saved in its context. If there
is already a stream attached to the appctx, the timeout is then immediately
modified. Otherwise, it is modified when the stream is created, thus during
the appctx initialization.

For now, the appctx is initialized when it is created. But this will change
to fix issues with the lua sockets. Thus, this patch is mandatory.
2023-10-04 15:34:03 +02:00
Christopher Faulet
ee687aa18d MINOR: hlua: Don't preform operations on a not connected socket
There is nothing that prevent someone to create a lua socket and try to
receive or to write before the connection was established ot after the
shutdown was performed. The same is true when info about the socket are
retrieved.

It is not an issue because this will fail later. But now, we check the
socket is connected or not earlier. It is more effecient but it will be also
mandatory to fix issue with the lua sockets.
2023-10-04 15:34:00 +02:00
Christopher Faulet
ed9333827a MINOR: hlua: Set context's appctx when the lua socket is created
The lua socket's context referenced the owning appctx. It was set when the
appctx was initialized. It is now performed when the appctx is created. It
is a small change but this will be required to fix several issues with the
lua sockets.
2023-10-04 15:33:57 +02:00