Group health coverage? Haproxy Technologies LLC
Hi, Are you overpaying on health insurance? I'm asking since my agency Wtwine offers low out-of-pocket health insurance. We work with small businesses nationally like Haproxy Technologies LLC Does a easy health coverage quote sound alright? Reply back and let me know the best # to briefly get in touch. Talk soon, Trina Foster, Wtwine
[PATCH] MINOR: support for http-request set-timeout client
Added set-timeout for frontend side of session, so it can be used to set custom per-client timeouts if needed. Added cur_client_timeout to fetch client timeout samples. --- doc/configuration.txt | 17 +--- include/haproxy/action-t.h | 1 + include/haproxy/action.h | 3 +- reg-tests/http-set-timeout/set_timeout.vtc | 46 +- src/action.c | 27 ++--- src/http_act.c | 8 +--- src/stream.c | 16 7 files changed, 99 insertions(+), 19 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index d49d359a2..db6ed866a 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -7010,7 +7010,7 @@ http-request [options...] [ { if | unless } ] - set-query - set-src - set-src-port -- set-timeout { server | tunnel } { | } +- set-timeout { client | server | tunnel } { | } - set-tos - set-uri - set-var([,...]) @@ -7925,10 +7925,10 @@ http-request set-src-port [ { if | unless } ] the address family supports a port, otherwise it forces the source address to IPv4 "0.0.0.0" before rewriting the port. -http-request set-timeout { server | tunnel } { | } +http-request set-timeout { client | server | tunnel } { | } [ { if | unless } ] - This action overrides the specified "server" or "tunnel" timeout for the + This action overrides the specified "client", "server" or "tunnel" timeout for the current stream only. The timeout can be specified in millisecond or with any other unit if the number is suffixed by the unit as explained at the top of this document. It is also possible to write an expression which must returns @@ -7936,8 +7936,8 @@ http-request set-timeout { server | tunnel } { | } Note that the server/tunnel timeouts are only relevant on the backend side and thus this rule is only available for the proxies with backend - capabilities. Also the timeout value must be non-null to obtain the expected - results. + capabilities. As well as client timeout is only relevant for frontend side. + Also the timeout value must be non-null to obtain the expected results. Example: http-request set-timeout tunnel 5s @@ -20084,6 +20084,11 @@ cur_tunnel_timeout : integer In the default case, this will be equal to be_tunnel_timeout unless a "set-timeout" rule has been applied. See also "be_tunnel_timeout". +cur_client_timeout : integer + Returns the currently applied client timeout in millisecond for the stream. + In the default case, this will be equal to fe_client_timeout unless a + "set-timeout" rule has been applied. See also "fe_client_timeout". + dst : ip This is the destination IP address of the connection on the client side, which is the address the client connected to. Any tcp/http rules may alter @@ -20339,7 +20344,7 @@ fe_name : string fe_client_timeout : integer Returns the configuration value in millisecond for the client timeout of the - current frontend. + current frontend. This timeout can be overwritten by a "set-timeout" rule. res.timer.data : integer this is the total transfer time of the response payload till the last byte diff --git a/include/haproxy/action-t.h b/include/haproxy/action-t.h index 7fafd612a..f77bdce5f 100644 --- a/include/haproxy/action-t.h +++ b/include/haproxy/action-t.h @@ -99,6 +99,7 @@ enum act_name { enum act_timeout_name { ACT_TIMEOUT_SERVER, ACT_TIMEOUT_TUNNEL, + ACT_TIMEOUT_CLIENT, }; enum act_normalize_uri { diff --git a/include/haproxy/action.h b/include/haproxy/action.h index 8a35664f4..73d0fdd2b 100644 --- a/include/haproxy/action.h +++ b/include/haproxy/action.h @@ -105,7 +105,8 @@ int check_capture(struct act_rule *rule, struct proxy *px, char **err); int cfg_parse_rule_set_timeout(const char **args, int idx, int *out_timeout, enum act_timeout_name *name, struct sample_expr **expr, char **err, - const char *file, int line, struct arg_list *al); + const char *file, int line, struct arg_list *al, + char *px_id, char *px_cap); static inline void release_timeout_action(struct act_rule *rule) { diff --git a/reg-tests/http-set-timeout/set_timeout.vtc b/reg-tests/http-set-timeout/set_timeout.vtc index ebaa6a3b4..6fa0a35f1 100644 --- a/reg-tests/http-set-timeout/set_timeout.vtc +++ b/reg-tests/http-set-timeout/set_timeout.vtc @@ -4,7 +4,7 @@ feature ignore_unknown_macro #REQUIRE_VERSION=2.4 -server srv_h1 -repeat 3 { +server srv_h1 -repeat 5 { rxreq txresp } -start @@ -24,6 +24,16 @@ syslog Slog3 -level info { expect ~ "^.*timeout: 5000 3000.*$" } -start +syslog Slog4 -level info {
Re: [PATCH] MINOR: support for http-request set-timeout client
Thanks for your comments and help! Everything seems to be clear for me, so sending you fresh changes as one rebased/squashed commit. -- Vladimir Vdovin > 25 сент. 2023 г., в 11:20, Christopher Faulet > написал(а): > > Le 16/09/2023 à 06:19, Vladimir Vdovin a écrit : >> Added set-timeout for frontend side of session, so it can be used to set >> dynamically per-client timeouts if needed. > > > Thanks ! It looks good. However I have few comments. First it could be good > to add a sample fetch to retrieve the current timeout, just like other custom > timeouts. To be consistant, it could be good to add "cur_client_timeout" > sample fetch in stream.c. It could be done in a separate commit if that makes > your life easier. > > Then, about the parsing, there is an issue. With your change, timeouts can > only be customized for proxies with the frontend and the backend > capabilities. It could be good to test the timeout type to restrict the > action to a specific kind of proxy. By calling cfg_parse_rule_set_timeout() > first, you can then test the proxy capabilities in conjunction with the > timeout type. > > Finally, could you update "reg-tests/http-set-timeout/set_timeout.vtc" script > to add a test about the client timeout. > > Of course, if you need some help or if you have any question, ask for it. > > -- > Christopher Faulet >
RE: RE: RE: [PATCH] Added support for Arrays in sample_conv_json_query in sample.c
Method now returns the content of Json Arrays, if it is specified in Json Path as String. The start and end character is a square bracket. Any complex object in the array is returned as Json, so that you might get Arrays of Array or objects. Only recommended for Arrays of simple types (e.g., String or int) which will be returned as CSV String. Also updated documentation and fixed issue with parenthesis and other changes from comments. --- doc/configuration.txt | 14 +++--- src/sample.c | 9 - 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index d49d359a2..785cbb77c 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -18356,10 +18356,18 @@ json([]) {"ip":"127.0.0.1","user-agent":"Very \"Ugly\" UA 1\/2"} json_query(,[]) - The json_query converter supports the JSON types string, boolean and - number. Floating point numbers will be returned as a string. By + The json_query converter supports the JSON types string, boolean, number + and array. Floating point numbers will be returned as a string. By specifying the output_type 'int' the value will be converted to an - Integer. If conversion is not possible the json_query converter fails. + Integer. Arrays will be returned as string, starting and ending with a + square brackets. The content is a CSV. Depending on the data type, the + array values might be quoted. If the array values are complex types, + the string contains the complete json representation of each value + separated by a comma. Example result for a roles query to a JWT: + + ["manage-account","manage-account-links","view-profile"] + + If conversion is not possible the json_query converter fails. must be a valid JSON Path string as defined in https://datatracker.ietf.org/doc/draft-ietf-jsonpath-base/ diff --git a/src/sample.c b/src/sample.c index 07c881dcf..a937d5283 100644 --- a/src/sample.c +++ b/src/sample.c @@ -4159,8 +4159,15 @@ static int sample_conv_json_query(const struct arg *args, struct sample *smp, vo return 1; } + case MJSON_TOK_ARRAY: { + // We copy the complete array, including square brackets into the return buffer + // result looks like: ["manage-account","manage-account-links","view-profile"] + trash->data = b_putblk(trash, token, token_size); + smp->data.u.str = *trash; + smp->data.type = SMP_T_STR; + return 1; + } case MJSON_TOK_NULL: - case MJSON_TOK_ARRAY: case MJSON_TOK_OBJECT: /* We cannot handle these. */ return 0; -- 2.39.3 [X] An Elisa camLine Holding GmbH company - www.camline.com camLine GmbH - Fraunhoferring 9, 85238 Petershausen, Germany Amtsgericht München HRB 88821 Managing Directors: Frank Bölstler, Evelyn Tag, Bernhard Völker The content of this message is CAMLINE CONFIDENTIAL. If you are not the intended recipient, please notify me, delete this email and do not use or distribute this email.
Re: RE: RE: [PATCH] Added support for Arrays in sample_conv_json_query in sample.c
Hello, On 25/09/2023 13:55, Jens Popp wrote: Method now returns the content of Json Arrays, if it is specified in Json Path as String. The start and end character is a square bracket. Any complex object in the array is returned as Json, so that you might get Arrays of Array or objects. Only recommended for Arrays of simple types (e.g., String or int) which will be returned as CSV String. Also updated documentation and fixed issue with parenthesis --- doc/configuration.txt | 14 +++--- src/sample.c | 11 ++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index d49d359a2..785cbb77c 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -18356,10 +18356,18 @@ json([]) {"ip":"127.0.0.1","user-agent":"Very \"Ugly\" UA 1\/2"} json_query(,[]) - The json_query converter supports the JSON types string, boolean and - number. Floating point numbers will be returned as a string. By + The json_query converter supports the JSON types string, boolean, number + and array. Floating point numbers will be returned as a string. By specifying the output_type 'int' the value will be converted to an - Integer. If conversion is not possible the json_query converter fails. + Integer. Arrays will be returned as string, starting and ending with a + square brackets. The content is a CSV. Depending on the data type, the + array values might be quoted. If the array values are complex types, + the string contains the complete json representation of each value + separated by a comma. Example result for a roles query to a JWT: + + ["manage-account","manage-account-links","view-profile"] + + If conversion is not possible the json_query converter fails. must be a valid JSON Path string as defined in https://datatracker.ietf.org/doc/draft-ietf-jsonpath-base/ diff --git a/src/sample.c b/src/sample.c index 07c881dcf..2751ad3a0 100644 --- a/src/sample.c +++ b/src/sample.c @@ -4159,8 +4159,17 @@ static int sample_conv_json_query(const struct arg *args, struct sample *smp, vo return 1; } + case MJSON_TOK_ARRAY: { + // We copy the complete array, including square brackets into the return buffer + // result looks like: ["manage-account","manage-account-links","view-profile"] + int len; + len = b_putblk(trash, token, token_size); + trash->data = len; + smp->data.u.str = *trash; + smp->data.type = SMP_T_STR; + return 1; + } case MJSON_TOK_NULL: - case MJSON_TOK_ARRAY: case MJSON_TOK_OBJECT: /* We cannot handle these. */ return 0; -- 2.39.3 You don't need the intermediary 'len' variable (which is not of the same type as what b_putblk returns). You can simply replace it by trash->data directly. Apart from that the patch looks good to me. Rémi LB
RE: RE: [PATCH] Added support for Arrays in sample_conv_json_query in sample.c
Method now returns the content of Json Arrays, if it is specified in Json Path as String. The start and end character is a square bracket. Any complex object in the array is returned as Json, so that you might get Arrays of Array or objects. Only recommended for Arrays of simple types (e.g., String or int) which will be returned as CSV String. Also updated documentation and fixed issue with parenthesis --- doc/configuration.txt | 14 +++--- src/sample.c | 11 ++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index d49d359a2..785cbb77c 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -18356,10 +18356,18 @@ json([]) {"ip":"127.0.0.1","user-agent":"Very \"Ugly\" UA 1\/2"} json_query(,[]) - The json_query converter supports the JSON types string, boolean and - number. Floating point numbers will be returned as a string. By + The json_query converter supports the JSON types string, boolean, number + and array. Floating point numbers will be returned as a string. By specifying the output_type 'int' the value will be converted to an - Integer. If conversion is not possible the json_query converter fails. + Integer. Arrays will be returned as string, starting and ending with a + square brackets. The content is a CSV. Depending on the data type, the + array values might be quoted. If the array values are complex types, + the string contains the complete json representation of each value + separated by a comma. Example result for a roles query to a JWT: + + ["manage-account","manage-account-links","view-profile"] + + If conversion is not possible the json_query converter fails. must be a valid JSON Path string as defined in https://datatracker.ietf.org/doc/draft-ietf-jsonpath-base/ diff --git a/src/sample.c b/src/sample.c index 07c881dcf..2751ad3a0 100644 --- a/src/sample.c +++ b/src/sample.c @@ -4159,8 +4159,17 @@ static int sample_conv_json_query(const struct arg *args, struct sample *smp, vo return 1; } + case MJSON_TOK_ARRAY: { + // We copy the complete array, including square brackets into the return buffer + // result looks like: ["manage-account","manage-account-links","view-profile"] + int len; + len = b_putblk(trash, token, token_size); + trash->data = len; + smp->data.u.str = *trash; + smp->data.type = SMP_T_STR; + return 1; + } case MJSON_TOK_NULL: - case MJSON_TOK_ARRAY: case MJSON_TOK_OBJECT: /* We cannot handle these. */ return 0; -- 2.39.3 [X] An Elisa camLine Holding GmbH company - www.camline.com camLine GmbH - Fraunhoferring 9, 85238 Petershausen, Germany Amtsgericht München HRB 88821 Managing Directors: Frank Bölstler, Evelyn Tag, Bernhard Völker The content of this message is CAMLINE CONFIDENTIAL. If you are not the intended recipient, please notify me, delete this email and do not use or distribute this email.
RE: [PATCH] Added support for Arrays in sample_conv_json_query in sample.c
Method now returns the content of Json Arrays, if it is specified in Json Path as String. The start and end character is a square bracket. Any complex object in the array is returned as Json, so that you might get Arrays of Array or objects. Only recommended for Arrays of simple types (e.g., String or int) which will be returned as CSV String. Also updated documentation --- doc/configuration.txt | 14 +++--- src/sample.c | 10 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index d49d359a2..785cbb77c 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -18356,10 +18356,18 @@ json([]) {"ip":"127.0.0.1","user-agent":"Very \"Ugly\" UA 1\/2"} json_query(,[]) - The json_query converter supports the JSON types string, boolean and - number. Floating point numbers will be returned as a string. By + The json_query converter supports the JSON types string, boolean, number + and array. Floating point numbers will be returned as a string. By specifying the output_type 'int' the value will be converted to an - Integer. If conversion is not possible the json_query converter fails. + Integer. Arrays will be returned as string, starting and ending with a + square brackets. The content is a CSV. Depending on the data type, the + array values might be quoted. If the array values are complex types, + the string contains the complete json representation of each value + separated by a comma. Example result for a roles query to a JWT: + + ["manage-account","manage-account-links","view-profile"] + + If conversion is not possible the json_query converter fails. must be a valid JSON Path string as defined in https://datatracker.ietf.org/doc/draft-ietf-jsonpath-base/ diff --git a/src/sample.c b/src/sample.c index 07c881dcf..c6a89bc90 100644 --- a/src/sample.c +++ b/src/sample.c @@ -4159,8 +4159,16 @@ static int sample_conv_json_query(const struct arg *args, struct sample *smp, vo return 1; } - case MJSON_TOK_NULL: case MJSON_TOK_ARRAY: + // We copy the complete array, including square brackets into the return buffer + // result looks like: ["manage-account","manage-account-links","view-profile"] + int len; + len = b_putblk(trash, token, token_size); + trash->data = len; + smp->data.u.str = *trash; + smp->data.type = SMP_T_STR; + return 1; + case MJSON_TOK_NULL: case MJSON_TOK_OBJECT: /* We cannot handle these. */ return 0; -- 2.39.3 [X] An Elisa camLine Holding GmbH company - www.camline.com camLine GmbH - Fraunhoferring 9, 85238 Petershausen, Germany Amtsgericht München HRB 88821 Managing Directors: Frank Bölstler, Evelyn Tag, Bernhard Völker The content of this message is CAMLINE CONFIDENTIAL. If you are not the intended recipient, please notify me, delete this email and do not use or distribute this email.
Re: [PATCH] MINOR: support for http-request set-timeout client
Le 16/09/2023 à 06:19, Vladimir Vdovin a écrit : Added set-timeout for frontend side of session, so it can be used to set dynamically per-client timeouts if needed. Thanks ! It looks good. However I have few comments. First it could be good to add a sample fetch to retrieve the current timeout, just like other custom timeouts. To be consistant, it could be good to add "cur_client_timeout" sample fetch in stream.c. It could be done in a separate commit if that makes your life easier. Then, about the parsing, there is an issue. With your change, timeouts can only be customized for proxies with the frontend and the backend capabilities. It could be good to test the timeout type to restrict the action to a specific kind of proxy. By calling cfg_parse_rule_set_timeout() first, you can then test the proxy capabilities in conjunction with the timeout type. Finally, could you update "reg-tests/http-set-timeout/set_timeout.vtc" script to add a test about the client timeout. Of course, if you need some help or if you have any question, ask for it. -- Christopher Faulet
Re: [PATCH] MINOR: support for http-request set-timeout client
Le 23/09/2023 à 13:07, Willy Tarreau a écrit : On Sat, Sep 16, 2023 at 07:19:46AM +0300, Vladimir Vdovin wrote: Added set-timeout for frontend side of session, so it can be used to set dynamically per-client timeouts if needed. I'm figuring we didn't respond to this one. Christopher, could you please review it next week so that we don't forget it ? Rahh sorry, I saw it and forgotten to review it. I'll do it today of course ! -- Christopher Faulet