BUG/MINOR: mux-h1: Properly resolve file path for 'h1-case-adjust-file'

The file specified by 'h1-case-adjust-file' directive is only loaded during
post-parsing. However when a relative path is used, the corresponding
absoulte path was not resolve during parsing. So the file could be loaded
relatively from the wrong location leading to a configuration error. It may
happen if several configuration files are used or if several
"default-config" are used. The last "default" location was always used.

To fix the issue, the absolute path of the file is now resolved when the
directive is parsed.

This patch should fix the issue #3415. It must be backported to all
versions.
This commit is contained in:
Christopher Faulet 2026-06-15 07:29:23 +02:00
parent 292b07270c
commit 82a16a2927

View file

@ -5986,7 +5986,24 @@ static int cfg_parse_h1_headers_case_adjust_file(char **args, int section_type,
return -1;
}
free(hdrs_map.name);
hdrs_map.name = strdup(args[1]);
if (args[1][0] != '/') {
char *curpath;
char *fullpath = NULL;
/* filename is provided using relative path, store the absolute path
* to take current chdir into account for other threads file load
* which occur later
*/
curpath = getcwd(trash.area, trash.size);
if (!curpath) {
memprintf(err, "failed to retrieve cur path");
return -1;
}
hdrs_map.name = memprintf(&fullpath, "%s/%s", curpath, args[1]);
}
else
hdrs_map.name = strdup(args[1]);
if (!hdrs_map.name) {
memprintf(err, "'%s %s' : out of memory", args[0], args[1]);
return -1;