[PATCH 1/3] MINOR: cache: Remove the `hash` part of the accept-encoding secondary key

2021-01-16 Thread Tim Duesterhus
As of commit 6ca89162dc881df8fecd7713ca1fe5dbaa66b315 this hash no longer is required, because unknown encodings are not longer stored and known encodings do not use the cache. --- include/haproxy/http_ana-t.h | 2 +- src/cache.c | 80 2

[PATCH 2/3] CLEANUP: Rename accept_encoding_hash_cmp to accept_encoding_bitmap_cmp

2021-01-16 Thread Tim Duesterhus
For the `accept-encoding` header a bitmap and not a hash is stored. --- src/cache.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cache.c b/src/cache.c index 965509871..9e01de402 100644 --- a/src/cache.c +++ b/src/cache.c @@ -97,7 +97,7 @@ struct

[PATCH v2] BUG/MINOR: hlua: Fix memory leak in hlua_alloc

2021-01-08 Thread Tim Duesterhus
Willy, Thierry, v2 fixes the commit message (adding a missing 'hlua:' after the type and severity) and also reduces the amount of duplicated code. Best regards Tim Düsterhus Apply with `git am --scissors` to automatically cut the commit message. -- >8 -- During a configuration check valgrind

[PATCH] BUG/MINOR: Fix memory leak in hlua_alloc

2021-01-07 Thread Tim Duesterhus
During a configuration check valgrind reports: ==14425== 0 bytes in 106 blocks are definitely lost in loss record 1 of 107 ==14425==at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14425==by 0x4C2FDEF: realloc (in

[PATCH] BUILD: Print a warning when building without USE_OPENSSL=1

2021-01-05 Thread Tim Duesterhus
Add a warning to the `haproxy` target when building without USE_OPENSSL. --- Makefile | 4 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 4e6c834ed..e60b7d3c8 100644 --- a/Makefile +++ b/Makefile @@ -912,6 +912,10 @@ endif haproxy: $(OPTIONS_OBJS) $(OBJS)

[PATCH] DOC: Improve the message printed when running `make` w/o `TARGET`

2021-01-05 Thread Tim Duesterhus
Rephrase the message to no longer talk about something that "is no longer supported", but about what actually *is* supported. Adjustments include: - Removal of rare targets to make it easier to find the proper one. - Reformatting to be easier to read (more newlines) - Explanation of common

[PATCH] BUG/MINOR: Error out when a `server` has an `AF_UNSPEC` address

2021-01-03 Thread Tim Duesterhus
Willy, Thayne, find the patch below. I am adding Thayne as CC as it was your commit that uncovered the issue and the crash happened in a function you wrote. Maybe you might want to add some additional checks somewhere? Best regards Tim Düsterhus Apply with `git am --scissors` to automatically

[PATCH] BUG/MINOR: cfgparse: Fail if the strdup() for `rule->be.name` for `use_backend` fails

2021-01-03 Thread Tim Duesterhus
This patch fixes GitHub issue #1024. I could track the `strdup` back to commit 3a1f5fda109fc56ae127d03eaf34ce027c9542e1 which is 1.9-dev8. It's probably not worth the effort to backport it across this refactoring. This patch should be backported to 1.9+. --- src/cfgparse-listen.c | 4 1

[PATCH 1/2] BUG/MINOR: lua: Fix memory leak error cases in hlua_config_prepend_path

2021-01-03 Thread Tim Duesterhus
In case of an error `p` is not properly freed. Minor leak during configuration parsing in out of memory situations, no backport needed. --- src/hlua.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/hlua.c b/src/hlua.c index b6138251a..7ac0274a2

[PATCH 2/2] DOC: lua: Use consistent error message 'memory allocation failed'

2021-01-03 Thread Tim Duesterhus
Other locations in the configuration parser use 'memory allocation failed', so use this one as well. --- src/hlua.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hlua.c b/src/hlua.c index 7ac0274a2..6fff60147 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -8384,17

[PATCH] BUG/MINOR: sink: Return an allocation failure in __sink_new if strdup() fails

2021-01-03 Thread Tim Duesterhus
This patch fixes GitHub issue #1023. The function was introduced in commit 67b5a161b4aa5cf9eb18a609fcbb64ec744ae7ea, which first appeared in 2.1-dev2. The fix should be backported to 2.1+. --- src/sink.c | 13 + 1 file changed, 13 insertions(+) diff --git a/src/sink.c b/src/sink.c

[PATCH 1/3] BUG/MEDIUM: ssl: Fix type of tlskeys_reference

2021-01-02 Thread Tim Duesterhus
tlskeys_reference was a raw `struct list` instead of a `struct tls_keys_ref` (which contains the `struct list`). This was uncritical in this specific case, because the `struct list` is the first member of `struct tls_keys_ref`. Thus address of the `struct tls_keys_ref` will be identical to the

[PATCH 3/3] CLEANUP: ssl: Remove useless local variable in tlskeys_list_get_next()

2021-01-02 Thread Tim Duesterhus
`getnext` was only used to fill `ref` at the beginning of the function. Both have the same type. Replace the parameter name by `ref` to remove the useless local variable. --- src/ssl_sock.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ssl_sock.c b/src/ssl_sock.c

[PATCH 2/3] CLEANUP: ssl: Remove useless loop in tlskeys_list_get_next()

2021-01-02 Thread Tim Duesterhus
This loop was always exited in the first iteration by `return`. --- src/ssl_sock.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 01a5b3c4c..7ea8e26a3 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -6362,17 +6362,14

[PATCH 1/2] CLEANUP: Reduce scope of `header_name` in http_action_store_cache()

2021-01-02 Thread Tim Duesterhus
This variable is only needed deeply nested in a single location and clang's static analyzer complains about a dead initialization. Reduce the scope to satisfy clang and the human that reads the function. --- src/cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

[PATCH 2/2] CLEANUP: Reduce scope of `hdr_age` in http_action_store_cache()

2021-01-02 Thread Tim Duesterhus
This is only required to process the `age` header. --- src/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache.c b/src/cache.c index 609465897..cf994a95e 100644 --- a/src/cache.c +++ b/src/cache.c @@ -977,7 +977,6 @@ static void set_secondary_key_encoding(struct

[PATCH 3/3] CLEANUP: Apply the coccinelle patch for `XXXcmp()` on contrib/

2021-01-02 Thread Tim Duesterhus
Compare the various `cmp()` functions against zero. --- contrib/mod_defender/spoa.c| 8 contrib/mod_defender/standalone.c | 18 +- contrib/modsecurity/spoa.c | 8 .../prometheus-exporter/service-prometheus.c

[PATCH 0/3] Compare the return value of `XXXcmp()` functions with zero

2021-01-02 Thread Tim Duesterhus
Willy, I've eyeballed the full diff to verify that this does not introduce any accidental logic changes. It looks good to me, but of course I might have missed anything. The coccinelle patch can be found in the commit message. It's very simple, but on the other hand I'm lacking coccinelle

[PATCH 2/3] CLEANUP: Apply the coccinelle patch for `XXXcmp()` on include/

2021-01-02 Thread Tim Duesterhus
Compare the various `XXXcmp()` functions against zero. --- include/haproxy/action.h | 2 +- include/haproxy/protobuf.h | 28 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/haproxy/action.h b/include/haproxy/action.h index

[PATCH v2] BUG/MEDIUM: cache: Fix hash collision in `accept-encoding` handling for `Vary`

2020-12-29 Thread Tim Duesterhus
This patch fixes GitHub Issue #988. Commit ce9e7b25217c46db1ac636b2c885a05bf91ae57e was not sufficient, because it fell back to a hash comparison if the bitmap of known encodings was not acceptable instead of directly returning the the cached response is not compatible. This patch also extends

[PATCH] BUG/MEDIUM: cache: Fix hash collision in `accept-encoding` handling for `Vary`

2020-12-28 Thread Tim Duesterhus
This patch fixes GitHub Issue #988. Commit ce9e7b25217c46db1ac636b2c885a05bf91ae57e was not sufficient, because it fell back to a hash comparison if the bitmap of known encodings was not acceptable instead of directly returning the the cached response is not compatible. This patch also extends

[PATCH] BUG/???: mux_h2: Add missing braces

2020-12-21 Thread Tim Duesterhus
Willy, please fill in the severity yourself, because I don't know what effects this bug causes. Check the issue for details: https://github.com/haproxy/haproxy/issues/1015 Best regards Tim Düsterhus Apply with `git am --scissors` to automatically cut the commit message. -- >8 -- This is a

[PATCH 3/3] CI: Set DEBUG=-DDEBUG_STRICT=1 in GitHub Actions

2020-11-21 Thread Tim Duesterhus
This was missing when migrating from Travis. --- .github/workflows/compliance.yml | 1 + .github/workflows/vtest.yml | 1 + .github/workflows/windows.yml| 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index

[PATCH 2/3] BUILD: Show the value of DEBUG= in haproxy -vv

2020-11-21 Thread Tim Duesterhus
Previously this was not visible after building. --- Makefile | 1 + src/haproxy.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Makefile b/Makefile index ff2084dd1..dd85e51a2 100644 --- a/Makefile +++ b/Makefile @@ -919,6 +919,7 @@ src/haproxy.o: src/haproxy.c $(DEP)

[PATCH 1/3] BUILD: Make DEBUG part of .build_opts

2020-11-21 Thread Tim Duesterhus
This forces a recompilation if the value of DEBUG= changes. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b93b0a872..ff2084dd1 100644 --- a/Makefile +++ b/Makefile @@ -878,7 +878,7 @@ help: # Used only to force a rebuild if some build

[PATCH 0/2] CI Updates

2020-11-19 Thread Tim Duesterhus
Willy, Ilya, find two patches improving the CI. 1) This lays the foundation to check the workflow trigger in the matrix generator Python script, allowing us to move less important jobs into a daily / weekly schedule. 2) This cleans up the Windows CI. I've made sure to re-use as much as

[PATCH 1/2] CI: Pass the github.event_name to matrix.py

2020-11-19 Thread Tim Duesterhus
This is a preparation to later run some matrix entries on schedule only. Within the matrix.py script it can now be detected whether the workflow is running on schedule by using: if build_type == "schedule": matrix.append(...) --- .github/matrix.py | 9 +

[PATCH 2/2] CI: Clean up Windows CI

2020-11-19 Thread Tim Duesterhus
index 0..5393a4c3a --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,60 @@ +# Copyright 2019 Ilya Shipitsin +# Copyright 2020 Tim Duesterhus +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as publi

[PATCH] CI: Make the h2spec workflow more consistent with the VTest workflow

2020-11-13 Thread Tim Duesterhus
This PR aims to make the workflow more consistent, by reusing the same wording for the step names and the same commands to make it look like the vtest workflow as much as possible. It was renamed to compliance.yml to match the human readable name better. This also allows to extend the workflow

[PATCH] REGTESTS: Add sample_fetches/cook.vtc

2020-11-13 Thread Tim Duesterhus
Add a reg-test verifying the fix in dea7c209f8a77b471323dd97bdc1ac4d7a17b812. Some parts of the configuration used in the were taken from the initial bug report from Maciej. Should be backported together with dea7c209f8a77b471323dd97bdc1ac4d7a17b812 (all stable versions). Co-authored-by: Maciej

[PATCH v2] CI: Stop hijacking the hosts file

2020-11-11 Thread Tim Duesterhus
Willy, fixed a typo in the commit message. not -> now. Sorry for the noise with the separate mails! Best regards Tim Düsterhus Apply with `git am --scissors` to automatically cut the commit message. -- >8 -- vtest/VTest#24 is merged now. This step is no longer required. ---

[PATCH] CI: Stop hijacking the hosts file

2020-11-11 Thread Tim Duesterhus
vtest/VTest#24 is merged not. This step is no longer required. --- .github/workflows/vtest.yml | 6 -- 1 file changed, 6 deletions(-) diff --git a/.github/workflows/vtest.yml b/.github/workflows/vtest.yml index c3571b876..28e814153 100644 --- a/.github/workflows/vtest.yml +++

[PATCH 1/2] CLEANUP: cache: Make should_send_notmodified_response easier to read

2020-10-22 Thread Tim Duesterhus
- Favor early return over a `retval` variable and `break` in a loop. - Avoid the use of `else`. - Remove useless comparison with `1` / `0`. --- src/cache.c | 30 +++--- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/cache.c b/src/cache.c index

[PATCH 2/2] BUG/MINOR: cache: Check the return value of http_replace_res_status

2020-10-22 Thread Tim Duesterhus
Send the full body if the status `304` cannot be applied. This should be the most graceful failure. Specific for 2.3, no backport needed. --- src/cache.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cache.c b/src/cache.c index 9564158fc..6798e5197 100644 ---

[PATCH 0/2] Cache fixes

2020-10-22 Thread Tim Duesterhus
William, Rémi, I'm super happy to see that the support for if-none-match made it into 2.3. I already was considering poking under some of the recent -devX announcements, but thought it already was too late for it and thus did not. Consider taking the following patches: - CLEANUP: This one

[PATCH v2 2/2] MINOR: ssl: Add error if a crt-list might be truncated

2020-09-29 Thread Tim Duesterhus
Similar to warning during the parsing of the regular configuration file that was added in 2fd5bdb439da29f15381aeb57c51327ba57674fc this patch adds a warning to the parsing of a crt-list if the file does not end in a newline (and thus might have been truncated). The logic essentially just was

[PATCH v2 1/2] CLEANUP: ssl: Use structured format for error line report during crt-list parsing

2020-09-29 Thread Tim Duesterhus
This reuses the known `parsing [%s:%d]:` from regular config file error reporting. --- src/ssl_crtlist.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c index fd141fc50..f1c15e051 100644 ---

[PATCH 2/2] MINOR: ssl: Add error if a crt-list might be truncated

2020-09-28 Thread Tim Duesterhus
see https://github.com/haproxy/haproxy/issues/860#issuecomment-693422936 see 0354b658f061d00d5ab4b728d7deeff2c8f1503a This should be backported as a warning to 2.2. --- src/ssl_crtlist.c | 28 ++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git

[PATCH 1/2] CLEANUP: ssl: Use structured format for error line report during crt-list parsing

2020-09-28 Thread Tim Duesterhus
This reuses the known `parsing [%s:%d]:` from regular config file error reporting. --- src/ssl_crtlist.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c index fd141fc50..f1c15e051 100644 ---

[PATCH v2 1/2] BUG/MINOR: Fix type passed of sizeof() for calloc()

2020-09-12 Thread Tim Duesterhus
newsrv->curr_idle_thr is of type `unsigned int`, not `int`. Fix this issue by simply passing the dereferenced pointer to sizeof, which is the preferred style anyway. This bug was introduced in commit dc2f2753e97ecfe94827de56ee9efd2cd6d39ad3. It first appeared in 2.2-dev5. The patch must be

[PATCH v2 2/2] CLEANUP: Do not use a fixed type for 'sizeof' in 'calloc'

2020-09-12 Thread Tim Duesterhus
Changes performed using the following coccinelle patch: @@ type T; expression E; expression t; @@ ( t = calloc(E, sizeof(*t)) | - t = calloc(E, sizeof(T)) + t = calloc(E, sizeof(*t)) ) Looking through the commit history, grepping for coccinelle

[PATCH v2 0/2] Fixed type in sizeof in calloc

2020-09-12 Thread Tim Duesterhus
Willy, Am 12.09.20 um 18:52 schrieb Willy Tarreau: > Thanks for doing this, I really appreciate it as I too hate having > a named type in calloc, as it doesn't survive code changes over time. > > I'd rather have one patch to fix the known bug and the rest as a > cleanup patch however, so that we

[PATCH] BUG/MINOR: Do not use a fixed type for 'sizeof' in 'calloc'

2020-09-12 Thread Tim Duesterhus
This fixes at least one instance where the wrong type was given to sizeof. clang-analyzer complained that in src/cfgparse.c line 3614 (newsrv->curr_idle_thr): > Result of 'calloc' is converted to a pointer of type 'unsigned int', which is > incompatible with sizeof operand type 'int' Changes

[PATCH 5/5] CLEANUP: haproxy: Free post_check_list in deinit()

2020-09-10 Thread Tim Duesterhus
This allocation is technically always reachable and cannot leak, but so are a few others that *are* freed. --- src/haproxy.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/haproxy.c b/src/haproxy.c index 0dc81c78c..e70870ab0 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2407,6

[PATCH 3/5] CLEANUP: haproxy: Free post_proxy_check_list in deinit()

2020-09-10 Thread Tim Duesterhus
This allocation is technically always reachable and cannot leak, but so are a few others that *are* freed. --- src/haproxy.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/haproxy.c b/src/haproxy.c index 663922e72..b01707096 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2403,6

[PATCH 1/5] BUG/MINOR: haproxy: Free uri_auth->scope during deinit

2020-09-10 Thread Tim Duesterhus
Given the following example configuration: listen http bind *:80 mode http stats scope . Running a configuration check with valgrind reports: ==16341== 26 (24 direct, 2 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 13 ==16341==at

[PATCH 2/5] CLEANUP: Free old_argv on deinit

2020-09-10 Thread Tim Duesterhus
This allocation technically is always reachable and cannot leak, however other global variables such as `oldpids` are already being freed. This is in an attempt to get HAProxy to a state where there are zero live allocations after a clean exit. --- src/haproxy.c | 1 + 1 file changed, 1

[PATCH 4/5] CLEANUP: haproxy: Free per_thread_*_list in deinit()

2020-09-10 Thread Tim Duesterhus
This allocation is technically always reachable and cannot leak, but so are a few others that *are* freed. --- src/haproxy.c | 24 1 file changed, 24 insertions(+) diff --git a/src/haproxy.c b/src/haproxy.c index b01707096..0dc81c78c 100644 --- a/src/haproxy.c +++

[PATCH 0/5] More deinit / free stuff

2020-09-10 Thread Tim Duesterhus
Willy, this basically is a continuation from my series in July: https://www.mail-archive.com/haproxy@formilux.org/msg37808.html One more real bugfix and 4 more frees of live allocations for consistency with the surrounding code. Best regards Tim Düsterhus (5): BUG/MINOR: haproxy: Free

[PATCH] CLEANUP: Update .gitignore

2020-09-06 Thread Tim Duesterhus
This excludes the currently tracked files from being ignored. --- .gitignore | 4 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 7e45489d2..3a760af99 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,11 @@ # than blocking about 500 different test files and bug

[PATCH] MINOR: Commit .gitattributes

2020-09-05 Thread Tim Duesterhus
Commit .gitattributes to the repository to allow GitHub downloads to properly fill in the SUBVERS and VERDATE files. It also prevents the engineer in charge of the release to forget creating it when a new branch is released. see https://www.mail-archive.com/haproxy@formilux.org/msg38107.html No

[PATCH v3 1/4] MINOR: http: Add `enum etag_type http_get_etag_type(const struct ist)`

2020-09-01 Thread Tim Duesterhus
http_get_etag_type returns whether a given `etag` is a strong, weak, or invalid ETag. --- include/haproxy/http-t.h | 6 ++ include/haproxy/http.h | 21 + 2 files changed, 27 insertions(+) diff --git a/include/haproxy/http-t.h b/include/haproxy/http-t.h index

[PATCH v3 2/4] CLEANUP: compression: Make use of http_get_etag_type()

2020-09-01 Thread Tim Duesterhus
This commit makes the compressor use http_get_etag_type to validate the ETag instead of using an ad-hoc condition. --- src/flt_http_comp.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index 87f359d03..0360d94be 100644 ---

[PATCH v3 3/4] MINOR: http: Add `int etag_compare(struct ist, struct ist, int)`

2020-09-01 Thread Tim Duesterhus
/http.c index 937d4d0d0..98ee0e198 100644 --- a/src/http.c +++ b/src/http.c @@ -2,6 +2,7 @@ * HTTP semantics * * Copyright 2000-2018 Willy Tarreau + * Copyright 2020 Tim Duesterhus * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU

[PATCH v3 4/4] MEDIUM: cache: Add support for if-none-match for cache responses

2020-09-01 Thread Tim Duesterhus
atch: W/\"etag\"" + rxresp + expect resp.status == 304 +} -run diff --git a/src/cache.c b/src/cache.c index b42262948..04cd6000f 100644 --- a/src/cache.c +++ b/src/cache.c @@ -4,6 +4,8 @@ * Copyright 2017 HAProxy Technologies * William Lallemand * + * Copyright 2

[PATCH v3 0/4] Add support for if-none-match for cache responses

2020-09-01 Thread Tim Duesterhus
William, Christopher, Am 01.09.20 um 10:29 schrieb Christopher Faulet: >>> There is no applet for uncached requests. So there is no reason to call >>> the release callback function. Looking at your 4th patch, you should >>> manually release 'if_none_match' variable for uncached requests in the

[RFC PATCH v2 1/4] MINOR: http: Add `enum etag_type http_get_etag_type(const struct ist)`

2020-08-28 Thread Tim Duesterhus
http_get_etag_type returns whether a given `etag` is a strong, weak, or invalid ETag. --- include/haproxy/http-t.h | 6 ++ include/haproxy/http.h | 21 + 2 files changed, 27 insertions(+) diff --git a/include/haproxy/http-t.h b/include/haproxy/http-t.h index

[RFC PATCH v2 0/4] Add support for if-none-match for cache responses

2020-08-28 Thread Tim Duesterhus
William, Am 28.08.20 um 13:57 schrieb William Lallemand: >> So basically I would need to simply store the 'if-none-match' of the >> request within the `appctx`, yes? > > That's right, once the object is found in the cache, you can check the > etag from the request action and set a flag in the

[RFC PATCH v2 3/4] MINOR: http: Add `int etag_compare(struct ist, struct ist, int)`

2020-08-28 Thread Tim Duesterhus
/http.c index 937d4d0d0..98ee0e198 100644 --- a/src/http.c +++ b/src/http.c @@ -2,6 +2,7 @@ * HTTP semantics * * Copyright 2000-2018 Willy Tarreau + * Copyright 2020 Tim Duesterhus * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU

[RFC PATCH v2 2/4] MINOR: compression: Make use of http_get_etag_type()

2020-08-28 Thread Tim Duesterhus
This commit makes the compressor use http_get_etag_type to validate the ETag instead of using an ad-hoc condition. --- src/flt_http_comp.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index 87f359d03..0360d94be 100644 ---

[RFC PATCH v2 4/4] MEDIUM: cache: Add support for if-none-match for cache responses

2020-08-28 Thread Tim Duesterhus
atch: W/\"etag\"" + rxresp + expect resp.status == 304 +} -run diff --git a/src/cache.c b/src/cache.c index b42262948..3c9392f8b 100644 --- a/src/cache.c +++ b/src/cache.c @@ -4,6 +4,8 @@ * Copyright 2017 HAProxy Technologies * William Lallemand * + * Copyright 2

[RFC PATCH] MEDIUM: Add support for if-none-match for cache responses

2020-08-18 Thread Tim Duesterhus
che.c @@ -4,6 +4,8 @@ * Copyright 2017 HAProxy Technologies * William Lallemand * + * Copyright 2020 Tim Duesterhus + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the

[PATCH] DOC: cache: Use '' instead of '' in error message

2020-08-18 Thread Tim Duesterhus
When the cache name is left out in 'filter cache' the error message refers to a missing ''. The name of the cache is called 'name' within the docs. Adjust the error message for consistency. The error message was introduced in 99a17a2d91f9044ea20bba6617048488aed80555. This commit first appeared

[PATCH] MEDIUM: cfgparse: Emit hard error on truncated lines

2020-08-18 Thread Tim Duesterhus
As announced within the emitted log message this is going to become a hard error in 2.3. It's 2.3 time now, let's do this. see 2fd5bdb439da29f15381aeb57c51327ba57674fc --- src/cfgparse.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/cfgparse.c

[PATCH] CI: Expand use of GitHub Actions for CI

2020-07-29 Thread Tim Duesterhus
/workflows/vtest.yml diff --git a/.github/workflows/vtest.yml b/.github/workflows/vtest.yml new file mode 100644 index 0..d94322474 --- /dev/null +++ b/.github/workflows/vtest.yml @@ -0,0 +1,175 @@ +# Copyright 2019 Ilya Shipitsin +# Copyright 2020 Tim Duesterhus +# +# This program is free sof

[PATCH v2 15/15] CLEANUP: Add static void hlua_deinit()

2020-07-04 Thread Tim Duesterhus
Compiling HAProxy with USE_LUA=1 and running a configuration check within valgrind with a very simple configuration such as: listen foo bind *:8080 Will report quite a few possible leaks afterwards: ==24048== LEAK SUMMARY: ==24048==definitely lost: 0 bytes in 0 blocks

[PATCH v2 14/15] CLEANUP: Add static void vars_deinit()

2020-07-04 Thread Tim Duesterhus
vars_deinit() frees all var_names during deinit(). --- src/vars.c | 9 + 1 file changed, 9 insertions(+) diff --git a/src/vars.c b/src/vars.c index fd95eed5d..c69a561fa 100644 --- a/src/vars.c +++ b/src/vars.c @@ -857,6 +857,15 @@ static int vars_max_size_check(char **args, int

[PATCH v2 02/15] BUG/MINOR: sample: Fix freeing of conv_exprs in release_sample_expr

2020-07-04 Thread Tim Duesterhus
Instead of just calling release_sample_arg(conv_expr->arg_p) we also must free() the conv_expr itself (after removing it from the list). Given the following example configuration: frontend foo bind *:8080 mode http http-request set-var(txn.foo) str(bar) acl

[PATCH v2 11/15] CLEANUP: haproxy: Free post_deinit_list in deinit()

2020-07-04 Thread Tim Duesterhus
This allocation is technically always reachable and cannot leak, but so are a few others that *are* freed. --- src/haproxy.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/haproxy.c b/src/haproxy.c index 64d7e0eea..70d442c40 100644 --- a/src/haproxy.c +++

[PATCH v2 03/15] BUG/MINOR: haproxy: Free proxy->format_unique_id during deinit

2020-07-04 Thread Tim Duesterhus
Given the following example configuration: frontend foo mode http bind *:8080 unique-id-format x Running a configuration check with valgrind reports: ==30712== 42 (40 direct, 2 indirect) bytes in 1 blocks are definitely lost in loss record 18 of 39 ==30712==

[PATCH v2 00/15] deinit / free stuff

2020-07-04 Thread Tim Duesterhus
Willy, Am 04.07.20 um 11:13 schrieb Willy Tarreau: >> Or you tell me to send it now and apply it to 'next'. > > It's up to you. I personally like to keep my topic branch till the last > moment because that leaves more more freedom to revisit my patches later, > but when I'm certain patches are

[PATCH v2 08/15] BUG/MINOR: sample: Free str.area in smp_check_const_bool

2020-07-04 Thread Tim Duesterhus
Given the following example configuration: listen foo mode http bind *:8080 http-request set-var(txn.leak) bool(1) server x example.com:80 Running a configuration check with valgrind reports: ==24233== 2 bytes in 1 blocks are definitely lost in loss

[PATCH v2 04/15] BUG/MINOR: haproxy: Add missing free of server->(hostname|resolvers_id)

2020-07-04 Thread Tim Duesterhus
Given the following example configuration: resolvers test nameserver test 127.0.0.1:53 listen foo bind *:8080 server foo example.com resolvers test Running a configuration check within valgrind reports: ==21995== 5 bytes in 1 blocks are definitely lost in

[PATCH v2 09/15] BUG/MINOR: sample: Free str.area in smp_check_const_meth

2020-07-04 Thread Tim Duesterhus
Given the following example configuration: listen foo mode http bind *:8080 http-request set-var(txn.leak) meth(GET) server x example.com:80 Running a configuration check with valgrind reports: ==25992== 4 bytes in 1 blocks are definitely lost in loss

[PATCH v2 06/15] BUG/MINOR: haproxy: Free srule->file during deinit

2020-07-04 Thread Tim Duesterhus
Given the following example configuration: backend foo mode http use-server x if { always_true } server x example.com:80 Running a configuration check with valgrind reports: ==18650== 14 bytes in 1 blocks are definitely lost in loss record 3 of 345 ==18650==

[PATCH v2 07/15] BUG/MINOR: haproxy: Free srule->expr during deinit

2020-07-04 Thread Tim Duesterhus
Given the following example configuration: backend foo mode http use-server %[str(x)] if { always_true } server x example.com:80 Running a configuration check with valgrind reports: ==19376== 170 (40 direct, 130 indirect) bytes in 1 blocks are definitely lost in

[PATCH v2 10/15] CLEANUP: haproxy: Free proxy_deinit_list in deinit()

2020-07-04 Thread Tim Duesterhus
This allocation is technically always reachable and cannot leak, but so are a few others that *are* freed. --- src/haproxy.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/haproxy.c b/src/haproxy.c index 53301c0be..64d7e0eea 100644 --- a/src/haproxy.c +++

[PATCH v2 05/15] BUG/MINOR: haproxy: Free proxy->unique_id_header during deinit

2020-07-04 Thread Tim Duesterhus
Given the following example configuration: frontend foo mode http bind *:8080 unique-id-header x Running a configuration check with valgrind reports: ==17621== 2 bytes in 1 blocks are definitely lost in loss record 1 of 341 ==17621==at 0x4C2DB8F: malloc

[PATCH v2 13/15] CLEANUP: haproxy: Free post_server_check_list in deinit()

2020-07-04 Thread Tim Duesterhus
This allocation is technically always reachable and cannot leak, but so are a few others that *are* freed. --- src/haproxy.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/haproxy.c b/src/haproxy.c index 7f05d39a8..489a0ebe8 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2606,6

[PATCH v2 12/15] CLEANUP: haproxy: Free server_deinit_list in deinit()

2020-07-04 Thread Tim Duesterhus
This allocation is technically always reachable and cannot leak, but so are a few others that *are* freed. --- src/haproxy.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/haproxy.c b/src/haproxy.c index 70d442c40..7f05d39a8 100644 --- a/src/haproxy.c +++

[PATCH v2 01/15] BUG/MINOR: acl: Fix freeing of expr->smp in prune_acl_expr

2020-07-04 Thread Tim Duesterhus
Instead of simply calling free() in expr->smp->arg_p in certain cases properly free the sample using release_sample_expr(). Given the following example configuration: frontend foo bind *:8080 mode http http-request set-var(txn.foo) str(bar) acl is_match

[PATCH] BUG/MEDIUM: fetch: Fix hdr_ip misparsing IPv4 addresses due to missing NUL

2020-06-26 Thread Tim Duesterhus
The IPv4 code did not take into account that the header value might not contain the trailing NUL byte, possibly reading stray data after the header value, failing the parse and testing the IPv6 branch. That one adds the missing NUL, but fails to parse IPv4 addresses. Fix this issue by always

[PATCH v3 1/2] BUG/MINOR: cfgparse: Fix argument reference in PARSE_ERR_TOOMANY message

2020-06-23 Thread Tim Duesterhus
The returned `arg` value is the number of arguments found, but in case of the error message it's not a valid argument index. Because we know how many arguments we allowed (MAX_LINE_ARGS) we know what to print in the error message, so do just that. Consider a configuration like this: listen

[PATCH v3 2/2] BUG/MINOR: cfgparse: Fix calculation of position for PARSE_ERR_TOOMANY message

2020-06-23 Thread Tim Duesterhus
The arguments are relative to the outline, not relative to the input line. This patch fixes up commit 9e1758efbd68c8b1d27e17e2abee110f3ebe which is 2.2 only. No backport needed. --- src/cfgparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cfgparse.c

[PATCH v3 0/2] PARSE_ERR_TOOMANY

2020-06-23 Thread Tim Duesterhus
Willy, realized I forgot to update the commit reference in the first patch after the change now is in cfgparse instead of tools, so here is v3. Only the commit message changed compared to v2. Best regards Tim Düsterhus (2): BUG/MINOR: cfgparse: Fix argument reference in PARSE_ERR_TOOMANY

[PATCH v2 0/2] PARSE_ERR_TOOMANY

2020-06-23 Thread Tim Duesterhus
Willy, Am 23.06.20 um 17:37 schrieb Willy Tarreau: > On Tue, Jun 23, 2020 at 05:06:27PM +0200, Tim Duesterhus wrote: >> Otherwise `arg++` will be executed for every argument after the maximum, >> returning a bogus value. > > No, it returns the correct one, as docume

[PATCH v2 1/2] BUG/MINOR: cfgparse: Fix argument reference in PARSE_ERR_TOOMANY message

2020-06-23 Thread Tim Duesterhus
The returned `arg` value is the number of arguments found, but in case of the error message it's not a valid argument index. Because we know how many arguments we allowed (MAX_LINE_ARGS) we know what to print in the error message, so do just that. Consider a configuration like this: listen

[PATCH v2 2/2] BUG/MINOR: cfgparse: Fix calculation of position for PARSE_ERR_TOOMANY message

2020-06-23 Thread Tim Duesterhus
The arguments are relative to the outline, not relative to the input line. This patch fixes up commit 9e1758efbd68c8b1d27e17e2abee110f3ebe which is 2.2 only. No backport needed. --- src/cfgparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cfgparse.c

[PATCH 2/2] BUG/MINOR: cfgparse: Fix calculation of position for PARSE_ERR_TOOMANY

2020-06-23 Thread Tim Duesterhus
The arguments are relative to the outline, not relative to the input line. This patch fixes up commit 9e1758efbd68c8b1d27e17e2abee110f3ebe which is 2.2 only. No backport needed. --- src/cfgparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cfgparse.c

[PATCH 1/2] BUG/MINOR: tools: Leave parse_line after exceeding argsmax

2020-06-23 Thread Tim Duesterhus
Otherwise `arg++` will be executed for every argument after the maximum, returning a bogus value. Consider a configuration like this: listen foo 1 2 3 [...] 64 65 Then running a configuration check within valgrind reports the following: ==18265== Conditional jump or move depends

[PATCH v2 1/2] BUG/MINOR: cfgparse: Support configurations without newline at EOF

2020-06-22 Thread Tim Duesterhus
Fix parsing of configurations if the configuration file does not end with an LF. This patch fixes GitHub issue #704. It's a regression in 9e1758efbd68c8b1d27e17e2abee110f3ebe which is 2.2 specific. No backport needed. --- src/cfgparse.c | 6 -- 1 file changed, 4 insertions(+), 2

[PATCH v2 0/2] Warnings for truncated lines

2020-06-22 Thread Tim Duesterhus
n 2020 at 18:56, Tim Düsterhus wrote: >>>> >>>> Lukas, >>>> >>>> Am 22.06.20 um 18:41 schrieb Lukas Tribus: >>>>> On Mon, 22 Jun 2020 at 18:16, Tim Duesterhus wrote: >>>>>> >>>>>> Fix parsing of configuratio

[PATCH v2 2/2] MINOR: cfgparse: Warn on truncated lines / files

2020-06-22 Thread Tim Duesterhus
As discussed on the list: https://www.mail-archive.com/haproxy@formilux.org/msg37698.html This patch adds warnings to the configuration parser that detect the following situations: - A line being truncated by a null byte in the middle. - A file not ending in a new line (and possibly being

[PATCH] BUG/MINOR: cfgparse: Support configurations without newline at EOF

2020-06-22 Thread Tim Duesterhus
Fix parsing of configurations if the configuration file does not end with an LF. This patch fixes GitHub issue #704. It's a regression in 9e1758efbd68c8b1d27e17e2abee110f3ebe which is 2.2 specific. No backport needed. --- src/cfgparse.c | 11 +-- 1 file changed, 9 insertions(+), 2

[PATCH] BUG/MINOR: cfgparse: Add missing fatal++ in PARSE_ERR_HEX case

2020-06-16 Thread Tim Duesterhus
This fixes up commit 32234e751320b60a3879f274d4a4753d7570e757. This patch should be backported whereever that commit is backported. --- src/cfgparse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cfgparse.c b/src/cfgparse.c index 9f44c7566..fdbf3a406 100644 --- a/src/cfgparse.c +++

[PATCH 1/4] BUG/MINOR: acl: Fix freeing of expr->smp in prune_acl_expr

2020-06-15 Thread Tim Duesterhus
Instead of simply calling free() in expr->smp->arg_p in certain cases properly free the sample using release_sample_expr(). Given the following example configuration: frontend foo bind *:8080 mode http http-request set-var(txn.foo) str(bar) acl is_match

[PATCH 4/4] BUG/MINOR: haproxy: Add missing free of server->(hostname|resolvers_id)

2020-06-15 Thread Tim Duesterhus
Given the following example configuration: resolvers test nameserver test 127.0.0.1:53 listen foo bind *:8080 server foo example.com resolvers test Running a configuration check within valgrind reports: ==21995== 5 bytes in 1 blocks are definitely lost in

[PATCH 3/4] BUG/MINOR: haproxy: Free proxy->format_unique_id during deinit

2020-06-15 Thread Tim Duesterhus
Given the following example configuration: frontend foo mode http bind *:8080 unique-id-format x Running a configuration check with valgrind reports: ==30712== 42 (40 direct, 2 indirect) bytes in 1 blocks are definitely lost in loss record 18 of 39 ==30712==

[PATCH 0/4] Fix more frees

2020-06-15 Thread Tim Duesterhus
Willy, this series fixes up a few more frees. This time I have verified the changes a bit more carefully, running configuration check on a real world configuration of mine within valgrind. It still reports a five leaks (but less than without applying these patches!) and does not report any memory

[PATCH 2/4] BUG/MINOR: sample: Fix freeing of conv_exprs in release_sample_expr

2020-06-15 Thread Tim Duesterhus
Instead of just calling release_sample_arg(conv_expr->arg_p) we also must free() the conv_expr itself (after removing it from the list). Given the following example configuration: frontend foo bind *:8080 mode http http-request set-var(txn.foo) str(bar) acl

<    1   2   3   4   5   >