test: verify new --write-out variables

Extended test 1029 and added 1188
This commit is contained in:
Daniel Stenberg 2020-12-20 23:00:13 +01:00
parent f7a65979f3
commit 58c4b8d636
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 51 additions and 2 deletions

View File

@ -139,6 +139,8 @@ test1160 test1161 test1162 test1163 test1164 test1165 test1166 test1167 \
test1168 test1170 test1171 test1172 test1173 test1174 test1175 \
test1176 test1177 test1178 test1179 \
\
test1188 \
\
test1190 test1191 test1192 test1193 test1194 test1195 test1196 test1197 \
test1198 test1199 \
test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \

View File

@ -30,7 +30,7 @@ http
HTTP Location: and 'redirect_url' check
</name>
<command>
http://%HOSTIP:%HTTPPORT/we/want/our/1029 -w '%{redirect_url}\n'
http://%HOSTIP:%HTTPPORT/we/want/our/1029 -w '%{redirect_url} %{url} %{exitcode} %{errormsg}\n'
</command>
</client>
@ -50,7 +50,7 @@ Content-Length: 62
Connection: close
This server reply is for testing a simple Location: following
http://%HOSTIP:%HTTPPORT/we/want/our/data/10290002.txt?coolsite=yes
http://%HOSTIP:%HTTPPORT/we/want/our/data/10290002.txt?coolsite=yes http://%HOSTIP:%HTTPPORT/we/want/our/1029 0 No error
</stdout>
</verify>
</testcase>

47
tests/data/test1188 Normal file
View File

@ -0,0 +1,47 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
--write-out
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Content-Length: 3
Connection: close
hi
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
--write-out with %{onerror} and %{urlnum} to stderr
</name>
<command>
http://%HOSTIP:%NOLISTENPORT/we/want/our/1188 http://%HOSTIP:%HTTPPORT/we/want/our/1188 -w '%{onerror}%{stderr}%{urlnum} says %{exitcode} %{errormsg}\n' -s
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /we/want/our/1188 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
<stderr mode="text">
0 says 7 Failed to connect to %HOSTIP port %NOLISTENPORT: Connection refused
</stderr>
</verify>
</testcase>