xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 1 | <testcase> |
| 2 | <info> |
| 3 | <keywords> |
| 4 | HTTP |
| 5 | HTTP PUT |
| 6 | HTTP Basic auth |
| 7 | --anyauth |
| 8 | </keywords> |
| 9 | </info> |
| 10 | |
| 11 | # Server-side |
| 12 | <reply> |
| 13 | # The test server provides no way to respond differently to a subsequent |
| 14 | # Basic authenticated request (we really want to respond with 200 for |
| 15 | # the second), so just respond with 401 for both and let curl deal with it. |
| 16 | <data> |
| 17 | HTTP/1.1 401 Authorization Required
|
| 18 | Server: testcurl
|
| 19 | WWW-Authenticate: Blackmagic realm="gimme all yer s3cr3ts"
|
| 20 | WWW-Authenticate: Basic realm="gimme all yer s3cr3ts"
|
| 21 | WWW-Authenticate: X-bogus-auth realm="gimme all yer s3cr3ts"
|
| 22 | Content-Type: text/plain
|
| 23 | Content-Length: 0
|
| 24 |
|
| 25 | </data> |
| 26 | <datacheck> |
| 27 | HTTP/1.1 401 Authorization Required
|
| 28 | Server: testcurl
|
| 29 | WWW-Authenticate: Blackmagic realm="gimme all yer s3cr3ts"
|
| 30 | WWW-Authenticate: Basic realm="gimme all yer s3cr3ts"
|
| 31 | WWW-Authenticate: X-bogus-auth realm="gimme all yer s3cr3ts"
|
| 32 | Content-Type: text/plain
|
| 33 | Content-Length: 0
|
| 34 |
|
| 35 | HTTP/1.1 401 Authorization Required
|
| 36 | Server: testcurl
|
| 37 | WWW-Authenticate: Blackmagic realm="gimme all yer s3cr3ts"
|
| 38 | WWW-Authenticate: Basic realm="gimme all yer s3cr3ts"
|
| 39 | WWW-Authenticate: X-bogus-auth realm="gimme all yer s3cr3ts"
|
| 40 | Content-Type: text/plain
|
| 41 | Content-Length: 0
|
| 42 |
|
| 43 | </datacheck> |
| 44 | </reply> |
| 45 | |
| 46 | # Client-side |
| 47 | <client> |
| 48 | <server> |
| 49 | http |
| 50 | </server> |
| 51 | <name> |
| 52 | HTTP PUT with --anyauth authorization (picking Basic) |
| 53 | </name> |
| 54 | <command> |
| 55 | http://%HOSTIP:%HTTPPORT/%TESTNUMBER -T log/put%TESTNUMBER -u testuser:testpass --anyauth |
| 56 | </command> |
| 57 | <file name="log/put%TESTNUMBER"> |
| 58 | This is data we upload with PUT |
| 59 | a second line |
| 60 | line three |
| 61 | four is the number of lines |
| 62 | </file> |
| 63 | </client> |
| 64 | |
| 65 | # Verify data after the test has been "shot" |
| 66 | <verify> |
| 67 | <protocol> |
| 68 | PUT /%TESTNUMBER HTTP/1.1
|
| 69 | Host: %HOSTIP:%HTTPPORT
|
| 70 | User-Agent: curl/%VERSION
|
| 71 | Accept: */*
|
| 72 | Content-Length: 85
|
| 73 | Expect: 100-continue
|
| 74 |
|
| 75 | This is data we upload with PUT |
| 76 | a second line |
| 77 | line three |
| 78 | four is the number of lines |
| 79 | PUT /%TESTNUMBER HTTP/1.1
|
| 80 | Host: %HOSTIP:%HTTPPORT
|
| 81 | Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=
|
| 82 | User-Agent: curl/%VERSION
|
| 83 | Accept: */*
|
| 84 | Content-Length: 85
|
| 85 | Expect: 100-continue
|
| 86 |
|
| 87 | This is data we upload with PUT |
| 88 | a second line |
| 89 | line three |
| 90 | four is the number of lines |
| 91 | </protocol> |
| 92 | </verify> |
| 93 | </testcase> |