Merge branch 'tmp-736' into 'master'

Fix calculation of avg_auth_time acros sec-mod instances

Closes #736

See merge request openconnect/ocserv!560
This commit is contained in:
Nikos Mavrogiannopoulos
2026-05-24 16:09:20 +02:00
committed by Dimitri Papadopoulos
6 changed files with 455 additions and 244 deletions
+2
View File
@@ -27,6 +27,8 @@
* /ca.pem
* /ca.cer
- Fix incorrect local address when using PROXY protocol with IPv6 (#711).
- Fix calculation of avg_auth_time across sec-mod instances (#736)
- The bundled llhttp was updated to 9.4.1.
* Version 1.4.2 (released 2026-04-16)
+8
View File
@@ -316,6 +316,14 @@ void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled) {
}
}
void llhttp_set_lenient_header_value_relaxed(llhttp_t* parser, int enabled) {
if (enabled) {
parser->lenient_flags |= LENIENT_HEADER_VALUE_RELAXED;
} else {
parser->lenient_flags &= ~LENIENT_HEADER_VALUE_RELAXED;
}
}
/* Callbacks */
+17
View File
@@ -353,6 +353,23 @@ void llhttp_set_lenient_optional_crlf_after_chunk(llhttp_t* parser, int enabled)
LLHTTP_EXPORT
void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled);
/* Enables/disables relaxed handling of unusual characters in header values.
*
* RFC 9110 describes NULL, CR and LF as 'dangerous' and says they MUST be
* rejected, while other control characters are merely 'invalid' and discouraged,
* and are explicitly allowed by other standards (e.g. WHATWG Fetch) and
* in surprisingly common use on the web.
*
* This flag enables these 'invalid but common' characters, aiming to
* maximize compatibility without enabling any potentially dangerous scenarios.
*
* Unlike `llhttp_set_lenient_headers()`, this does NOT enable any other
* potentially unsafe behaviors (like accepting whitespace before colons
* or after the start line).
*/
LLHTTP_EXPORT
void llhttp_set_lenient_header_value_relaxed(llhttp_t* parser, int enabled);
#ifdef __cplusplus
} /* extern "C" */
#endif
+407 -241
View File
File diff suppressed because it is too large Load Diff
+20 -2
View File
@@ -3,7 +3,7 @@
#define INCLUDE_LLHTTP_H_
#define LLHTTP_VERSION_MAJOR 9
#define LLHTTP_VERSION_MINOR 3
#define LLHTTP_VERSION_MINOR 4
#define LLHTTP_VERSION_PATCH 1
#ifndef INCLUDE_LLHTTP_ITSELF_H_
@@ -118,7 +118,8 @@ enum llhttp_lenient_flags {
LENIENT_OPTIONAL_LF_AFTER_CR = 0x40,
LENIENT_OPTIONAL_CRLF_AFTER_CHUNK = 0x80,
LENIENT_OPTIONAL_CR_BEFORE_LF = 0x100,
LENIENT_SPACES_AFTER_CHUNK_SIZE = 0x200
LENIENT_SPACES_AFTER_CHUNK_SIZE = 0x200,
LENIENT_HEADER_VALUE_RELAXED = 0x400
};
typedef enum llhttp_lenient_flags llhttp_lenient_flags_t;
@@ -898,6 +899,23 @@ void llhttp_set_lenient_optional_crlf_after_chunk(llhttp_t* parser, int enabled)
LLHTTP_EXPORT
void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled);
/* Enables/disables relaxed handling of unusual characters in header values.
*
* RFC 9110 describes NULL, CR and LF as 'dangerous' and says they MUST be
* rejected, while other control characters are merely 'invalid' and discouraged,
* and are explicitly allowed by other standards (e.g. WHATWG Fetch) and
* in surprisingly common use on the web.
*
* This flag enables these 'invalid but common' characters, aiming to
* maximize compatibility without enabling any potentially dangerous scenarios.
*
* Unlike `llhttp_set_lenient_headers()`, this does NOT enable any other
* potentially unsafe behaviors (like accepting whitespace before colons
* or after the start line).
*/
LLHTTP_EXPORT
void llhttp_set_lenient_header_value_relaxed(llhttp_t* parser, int enabled);
#ifdef __cplusplus
} /* extern "C" */
#endif
+1 -1
View File
@@ -227,7 +227,7 @@ static void method_status(method_ctx *ctx, int cfd, uint8_t *msg,
rep.max_auth_time =
MAX(rep.max_auth_time,
ctx->s->sec_mod_instances[i].max_auth_time);
rep.avg_auth_time = ctx->s->sec_mod_instances[i].avg_auth_time;
rep.avg_auth_time += ctx->s->sec_mod_instances[i].avg_auth_time;
}
if (ctx->s->sec_mod_instance_count != 0) {
rep.avg_auth_time /= ctx->s->sec_mod_instance_count;