• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<testcase>
2<info>
3<keywords>
4FTP
5--proto-default
6</keywords>
7</info>
8
9
10#
11# Server-side
12<reply>
13<!--
14The purpose of this test is to make sure the --proto-default option works
15properly. We specify a default protocol of FTP and if the option works properly
16curl will use the FTP protocol. If the option is broken however curl will use
17the HTTP protocol.
18In the broken scenario curl would use HTTP to talk to our FTP server. We handle
19that by replying with something that both protocols can understand. Our FTP
20server allows a custom welcome message, so we use that feature to make an HTTP
21reply that contains an FTP reply (think polyglot). In the case of FTP we expect
22curl will return CURLE_WEIRD_SERVER_REPLY so we test for that return code.
23-->
24<servercmd>
25REPLY 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>
33none
34</features>
35<server>
36ftp
37</server>
38<name>
39Set 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>
518
52</errorcode>
53</verify>
54</testcase>
55