Merge pull request #2552 from drwetter/fix_2466

Trailing space after value in header is fine
This commit is contained in:
Dirk Wetter 2024-09-03 20:51:18 +02:00 committed by GitHub
commit a20fd796e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2741,6 +2741,8 @@ run_hsts() {
# strict parsing now as suggested in #2381 # strict parsing now as suggested in #2381
hsts_age_sec="${HEADERVALUE#*=}" hsts_age_sec="${HEADERVALUE#*=}"
hsts_age_sec=${hsts_age_sec%%;*} hsts_age_sec=${hsts_age_sec%%;*}
# see #2466
hsts_age_sec=$(strip_trailing_space "$hsts_age_sec")
if [[ $hsts_age_sec =~ \" ]]; then if [[ $hsts_age_sec =~ \" ]]; then
# remove first an last " in $hsts_age_sec (borrowed from strip_trailing_space/strip_leading_space): # remove first an last " in $hsts_age_sec (borrowed from strip_trailing_space/strip_leading_space):
hsts_age_sec=$(printf "%s" "${hsts_age_sec#"${hsts_age_sec%%[!\"]*}"}") hsts_age_sec=$(printf "%s" "${hsts_age_sec#"${hsts_age_sec%%[!\"]*}"}")