xref: /third_party/curl/tests/data/test2045 (revision 13498266)
113498266Sopenharmony_ci<testcase>
213498266Sopenharmony_ci<info>
313498266Sopenharmony_ci<keywords>
413498266Sopenharmony_ciFTP
513498266Sopenharmony_ci--proto-default
613498266Sopenharmony_ci</keywords>
713498266Sopenharmony_ci</info>
813498266Sopenharmony_ci
913498266Sopenharmony_ci
1013498266Sopenharmony_ci#
1113498266Sopenharmony_ci# Server-side
1213498266Sopenharmony_ci<reply>
1313498266Sopenharmony_ci<!--
1413498266Sopenharmony_ciThe purpose of this test is to make sure the --proto-default option works
1513498266Sopenharmony_ciproperly. We specify a default protocol of FTP and if the option works properly
1613498266Sopenharmony_cicurl will use the FTP protocol. If the option is broken however curl will use
1713498266Sopenharmony_cithe HTTP protocol.
1813498266Sopenharmony_ciIn the broken scenario curl would use HTTP to talk to our FTP server. We handle
1913498266Sopenharmony_cithat by replying with something that both protocols can understand. Our FTP
2013498266Sopenharmony_ciserver allows a custom welcome message, so we use that feature to make an HTTP
2113498266Sopenharmony_cireply that contains an FTP reply (think polyglot). In the case of FTP we expect
2213498266Sopenharmony_cicurl will return CURLE_WEIRD_SERVER_REPLY so we test for that return code.
2313498266Sopenharmony_ci-->
2413498266Sopenharmony_ci<servercmd>
2513498266Sopenharmony_ciREPLY welcome HTTP/1.1 200 OK\r\nContent-Length: 21\r\n\r\n500 Weird FTP Reply
2613498266Sopenharmony_ci</servercmd>
2713498266Sopenharmony_ci</reply>
2813498266Sopenharmony_ci
2913498266Sopenharmony_ci#
3013498266Sopenharmony_ci# Client-side
3113498266Sopenharmony_ci<client>
3213498266Sopenharmony_ci<features>
3313498266Sopenharmony_cinone
3413498266Sopenharmony_ci</features>
3513498266Sopenharmony_ci<server>
3613498266Sopenharmony_ciftp
3713498266Sopenharmony_ci</server>
3813498266Sopenharmony_ci<name>
3913498266Sopenharmony_ciSet the default protocol to ftp for a schemeless URL
4013498266Sopenharmony_ci</name>
4113498266Sopenharmony_ci<command>
4213498266Sopenharmony_ci-H "User-Agent:" -H "Host:" -H "Accept:" --proto-default ftp %HOSTIP:%FTPPORT
4313498266Sopenharmony_ci</command>
4413498266Sopenharmony_ci</client>
4513498266Sopenharmony_ci
4613498266Sopenharmony_ci#
4713498266Sopenharmony_ci# Verify data after the test has been "shot"
4813498266Sopenharmony_ci<verify>
4913498266Sopenharmony_ci# CURLE_WEIRD_SERVER_REPLY is error code 8
5013498266Sopenharmony_ci<errorcode>
5113498266Sopenharmony_ci8
5213498266Sopenharmony_ci</errorcode>
5313498266Sopenharmony_ci</verify>
5413498266Sopenharmony_ci</testcase>
55