netrc: return code cleanup, fix missing file error

Made the netrc parser return a more consistent set of error codes and
error messages, and also return error properly if the .netrc file is
missing.

Add test 697 to verify error on missing netrc file.

Fixes #16163
Reported-by: arlt on github
Closes #16165
This commit is contained in:
Daniel Stenberg 2025-02-04 11:25:18 +01:00
parent abca1f23a9
commit 943de21619
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 126 additions and 48 deletions

View file

@ -101,7 +101,7 @@ test652 test653 test654 test655 test656 test658 test659 test660 test661 \
test662 test663 test664 test665 test666 test667 test668 test669 test670 \
test671 test672 test673 test674 test675 test676 test677 test678 test679 \
test680 test681 test682 test683 test684 test685 test686 test687 test688 \
test689 test690 test691 test692 test693 test694 test695 test696 \
test689 test690 test691 test692 test693 test694 test695 test696 test697 \
\
test700 test701 test702 test703 test704 test705 test706 test707 test708 \
test709 test710 test711 test712 test713 test714 test715 test716 test717 \

37
tests/data/test697 Normal file
View file

@ -0,0 +1,37 @@
<testcase>
<info>
<keywords>
HTTP
netrc
</keywords>
</info>
#
# Server-side
<reply>
</reply>
#
# Client-side
<client>
<server>
none
</server>
<features>
http
</features>
<name>
netrc with missing netrc file
</name>
<command>
--netrc --netrc-file %LOGDIR/netrc%TESTNUMBER http://user1@http.example/
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<errorcode>
26
</errorcode>
</verify>
</testcase>