xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame^] | 1 | <testcase> |
| 2 | <info> |
| 3 | <keywords> |
| 4 | HTTP |
| 5 | HTTP GET |
| 6 | --write-out |
| 7 | </keywords> |
| 8 | </info> |
| 9 | |
| 10 | # Server-side |
| 11 | <reply> |
| 12 | <data> |
| 13 | HTTP/1.1 404 Not Found
|
| 14 | Content-Length: 0
|
| 15 | Connection: close
|
| 16 |
|
| 17 | </data> |
| 18 | </reply> |
| 19 | |
| 20 | # Client-side |
| 21 | <client> |
| 22 | <server> |
| 23 | http |
| 24 | </server> |
| 25 | <name> |
| 26 | --write-out with %{onerror} and %{urlnum} to stderr |
| 27 | </name> |
| 28 | <command> |
| 29 | -f -s -w '%{onerror}%{stderr}%{urlnum} says %{exitcode} %{errormsg}\n' http://%HOSTIP:%HTTPPORT/we/want/our/%TESTNUMBER http://%HOSTIP:%HTTPPORT/we/want/our/%TESTNUMBER |
| 30 | </command> |
| 31 | </client> |
| 32 | |
| 33 | # Verify data after the test has been "shot" |
| 34 | <verify> |
| 35 | <protocol> |
| 36 | GET /we/want/our/%TESTNUMBER HTTP/1.1
|
| 37 | Host: %HOSTIP:%HTTPPORT
|
| 38 | User-Agent: curl/%VERSION
|
| 39 | Accept: */*
|
| 40 |
|
| 41 | GET /we/want/our/%TESTNUMBER HTTP/1.1
|
| 42 | Host: %HOSTIP:%HTTPPORT
|
| 43 | User-Agent: curl/%VERSION
|
| 44 | Accept: */*
|
| 45 |
|
| 46 | </protocol> |
| 47 | <stderr mode="text"> |
| 48 | 0 says 22 The requested URL returned error: 404 |
| 49 | 1 says 22 The requested URL returned error: 404 |
| 50 | </stderr> |
| 51 | # 22 is CURLE_HTTP_RETURNED_ERROR |
| 52 | <errorcode> |
| 53 | 22 |
| 54 | </errorcode> |
| 55 | </verify> |
| 56 | </testcase> |