aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-12-04 23:10:12 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-12-04 23:10:12 +0100
commit5971d401d4fd184aedd3b439251a898ecdacb96e (patch)
tree51d88fb51ab7438ecc75f56378266409018c5801
parent62d3652b43124cb1d9b962acba05b41cd61f9343 (diff)
test: verify the opensocket callback for FTP
test 595: for passive FTP test 596: for active FTP
-rw-r--r--tests/data/Makefile.am2
-rw-r--r--tests/data/test59557
-rw-r--r--tests/data/test59657
-rw-r--r--tests/libtest/lib500.c3
4 files changed, 118 insertions, 1 deletions
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 75b3781aa..23e2a7ddd 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -48,7 +48,7 @@ test551 test552 test553 test554 test555 test556 test557 test560 test561 \
test562 test563 test564 test565 test566 test567 test568 test569 test570 \
test571 test572 test573 test574 test575 test576 test578 test579 test580 \
test581 test582 test583 test584 test585 test586 test587 test588 test590 \
-test591 test592 test593 test594 \
+test591 test592 test593 test594 test595 test596 \
test600 test601 test602 test603 test604 \
test605 test606 test607 test608 test609 test610 test611 test612 test613 \
test614 test615 test616 test617 test618 test619 test620 test621 test622 \
diff --git a/tests/data/test595 b/tests/data/test595
new file mode 100644
index 000000000..28ff9c1a1
--- /dev/null
+++ b/tests/data/test595
@@ -0,0 +1,57 @@
+#
+# This test is like 585 but uses passive FTP instead of HTTP
+#
+<testcase>
+<info>
+<keywords>
+FTP
+</keywords>
+</info>
+#
+# Server-side
+<reply>
+<data>
+moo
+</data>
+<datacheck>
+[OPEN] counter: 1
+[OPEN] counter: 2
+moo
+[CLOSE] counter: 2
+[CLOSE] counter: 1
+</datacheck>
+</reply>
+
+# Client-side
+<client>
+<server>
+ftp
+</server>
+# tool is what to use instead of 'curl'
+<tool>
+lib585
+</tool>
+
+ <name>
+verify close callbacks with passive FTP
+ </name>
+ <command>
+ftp://%HOSTIP:%FTPPORT/595 log/ip595
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol>
+USER anonymous
+PASS ftp@example.com
+PWD
+EPSV
+TYPE I
+SIZE 595
+RETR 595
+QUIT
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/data/test596 b/tests/data/test596
new file mode 100644
index 000000000..9703f0471
--- /dev/null
+++ b/tests/data/test596
@@ -0,0 +1,57 @@
+#
+# This test is like 585 but uses active FTP instead of HTTP
+#
+<testcase>
+<info>
+<keywords>
+FTP
+</keywords>
+</info>
+#
+# Server-side
+<reply>
+<data>
+moo
+</data>
+<datacheck>
+[OPEN] counter: 1
+[OPEN] counter: 2
+moo
+[CLOSE] counter: 2
+[CLOSE] counter: 1
+</datacheck>
+</reply>
+
+# Client-side
+<client>
+<server>
+ftp
+</server>
+# tool is what to use instead of 'curl'
+<tool>
+lib585
+</tool>
+
+ <name>
+verify close callbacks with active FTP
+ </name>
+ <command>
+ftp://%HOSTIP:%FTPPORT/596 log/ip596 activeftp
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol>
+USER anonymous
+PASS ftp@example.com
+PWD
+EPSV
+TYPE I
+SIZE 596
+RETR 596
+QUIT
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c
index 51680fc31..812fb0dd5 100644
--- a/tests/libtest/lib500.c
+++ b/tests/libtest/lib500.c
@@ -76,6 +76,9 @@ int test(char *URL)
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_HEADER, 1L);
+ if(libtest_arg3 && !strcmp(libtest_arg3, "activeftp"))
+ test_setopt(curl, CURLOPT_FTPPORT, "-");
+
setupcallbacks(curl);
res = curl_easy_perform(curl);