curl: exit on config file parser errors

Like when trying to import an environment variable that does not exist.

Also fix a bug for reading env variables when there is a default value
set.

Bug: https://curl.se/mail/archive-2024-02/0008.html
Reported-by: Brett Buddin

Add test 462 to verify.

Closes #12862
This commit is contained in:
Daniel Stenberg 2024-02-05 15:04:31 +01:00
parent 1d96828582
commit 0f0edc283c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 58 additions and 8 deletions

View file

@ -73,6 +73,7 @@ test426 test427 test428 test429 test430 test431 test432 test433 test434 \
test435 test436 test437 test438 test439 test440 test441 test442 test443 \
test444 test445 test446 test447 test448 test449 test450 test451 test452 \
test453 test454 test455 test456 test457 test458 test459 test460 test461 \
test462 \
\
test490 test491 test492 test493 test494 test495 test496 test497 test498 \
test499 test500 test501 test502 test503 test504 test505 test506 test507 \

39
tests/data/test462 Normal file
View file

@ -0,0 +1,39 @@
<testcase>
<info>
<keywords>
variables
--config
</keywords>
</info>
#
# Server-side
<reply>
</reply>
#
# Client-side
<client>
<server>
none
</server>
<name>
Missing environment variables in config file
</name>
<file name="%LOGDIR/cmd">
variable %MISSING
expand-data {{MISSING}}
</file>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -K %LOGDIR/cmd
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<errorcode>
26
</errorcode>
</verify>
</testcase>