lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | <testcase> |
| 2 | <info> |
| 3 | <keywords> |
| 4 | FTP |
| 5 | --proto-default |
| 6 | </keywords> |
| 7 | </info> |
| 8 | |
| 9 | |
| 10 | # |
| 11 | # Server-side |
| 12 | <reply> |
| 13 | <!-- |
| 14 | The purpose of this test is to make sure the --proto-default option works |
| 15 | properly. We specify a default protocol of FTP and if the option works properly |
| 16 | curl will use the FTP protocol. If the option is broken however curl will use |
| 17 | the HTTP protocol. |
| 18 | In the broken scenario curl would use HTTP to talk to our FTP server. We handle |
| 19 | that by replying with something that both protocols can understand. Our FTP |
| 20 | server allows a custom welcome message, so we use that feature to make an HTTP |
| 21 | reply that contains an FTP reply (think polyglot). In the case of FTP we expect |
| 22 | curl will return CURLE_WEIRD_SERVER_REPLY so we test for that return code. |
| 23 | --> |
| 24 | <servercmd> |
| 25 | REPLY welcome HTTP/1.1 200 OK\r\nContent-Length: 21\r\n\r\n500 Weird FTP Reply |
| 26 | </servercmd> |
| 27 | </reply> |
| 28 | |
| 29 | # |
| 30 | # Client-side |
| 31 | <client> |
| 32 | <features> |
| 33 | none |
| 34 | </features> |
| 35 | <server> |
| 36 | ftp |
| 37 | </server> |
| 38 | <name> |
| 39 | Set the default protocol to ftp for a schemeless URL |
| 40 | </name> |
| 41 | <command> |
| 42 | -H "User-Agent:" -H "Host:" -H "Accept:" --proto-default ftp %HOSTIP:%FTPPORT |
| 43 | </command> |
| 44 | </client> |
| 45 | |
| 46 | # |
| 47 | # Verify data after the test has been "shot" |
| 48 | <verify> |
| 49 | # CURLE_WEIRD_SERVER_REPLY is error code 8 |
| 50 | <errorcode> |
| 51 | 8 |
| 52 | </errorcode> |
| 53 | </verify> |
| 54 | </testcase> |