aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/data/test53663
-rw-r--r--tests/libtest/Makefile.am6
-rw-r--r--tests/libtest/lib536.c82
3 files changed, 150 insertions, 1 deletions
diff --git a/tests/data/test536 b/tests/data/test536
new file mode 100644
index 000000000..eeadf0d77
--- /dev/null
+++ b/tests/data/test536
@@ -0,0 +1,63 @@
+<reply>
+<data mode="text">
+HTTP/1.1 404 Badness
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+ETag: "21025-dc7-39462498"
+Content-Length: 6
+Content-Type: text/html
+Funny-head: yesyes
+
+hejsan
+</data>
+<data1>
+HTTP/1.1 200 Fine
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Content-Length: 13
+Connection: close
+Content-Type: text/html
+
+fine content
+</data1>
+
+<datacheck>
+fine content
+Finished!
+</datacheck>
+
+<servercmd>
+pipe: 1
+</servercmd>
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+# tool is what to use instead of 'curl'
+<tool>
+lib536
+</tool>
+
+ <name>
+HTTP GET multi two files with FAILONERROR and pipelining
+ </name>
+ <command>
+http://%HOSTIP:%HTTPPORT/536 http://%HOSTIP:%HTTPPORT/5360001
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol>
+GET /536 HTTP/1.1
+Host: 127.0.0.1:%HTTPPORT
+Accept: */*
+
+GET /5360001 HTTP/1.1
+Host: 127.0.0.1:%HTTPPORT
+Accept: */*
+
+</protocol>
+</verify>
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index 4b6070b5b..b8f58f331 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -42,7 +42,7 @@ SUPPORTFILES = first.c test.h
noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \
lib507 lib508 lib509 lib510 lib511 lib512 lib513 lib514 lib515 lib516 \
lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 lib527 \
- lib529 lib530 lib532 lib533
+ lib529 lib530 lib532 lib533 lib536
lib500_SOURCES = lib500.c $(SUPPORTFILES)
lib500_LDADD = $(LIBDIR)/libcurl.la
@@ -173,3 +173,7 @@ lib533_SOURCES = lib533.c $(SUPPORTFILES)
lib533_LDADD = $(LIBDIR)/libcurl.la
lib533_DEPENDENCIES = $(LIBDIR)/libcurl.la
+lib536_SOURCES = lib536.c $(SUPPORTFILES)
+lib536_LDADD = $(LIBDIR)/libcurl.la
+lib536_DEPENDENCIES = $(LIBDIR)/libcurl.la
+
diff --git a/tests/libtest/lib536.c b/tests/libtest/lib536.c
new file mode 100644
index 000000000..a1099fe62
--- /dev/null
+++ b/tests/libtest/lib536.c
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * $Id$
+ */
+
+#include "test.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+static CURLMcode perform(CURLM * multi);
+
+static CURLMcode perform(CURLM * multi)
+{
+ int handles, maxfd;
+ CURLMcode code;
+ fd_set fdread, fdwrite, fdexcep;
+
+ for (;;) {
+ code = curl_multi_perform(multi, &handles);
+ if (handles <= 0)
+ return CURLM_OK;
+
+ switch (code) {
+ case CURLM_OK:
+ break;
+ case CURLM_CALL_MULTI_PERFORM:
+ continue;
+ default:
+ return code;
+ }
+
+ FD_ZERO(&fdread);
+ FD_ZERO(&fdwrite);
+ FD_ZERO(&fdexcep);
+ curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
+ if (maxfd < 0)
+ return -1;
+ if (select(maxfd + 1, &fdread, &fdwrite, &fdexcep, 0) == -1)
+ return -1;
+ }
+}
+
+int test(char *URL)
+{
+ CURLM *multi = curl_multi_init();
+ CURL *easy = curl_easy_init();
+
+ curl_multi_setopt(multi, CURLMOPT_PIPELINING, 1);
+
+ curl_easy_setopt(easy, CURLOPT_WRITEFUNCTION, fwrite);
+ curl_easy_setopt(easy, CURLOPT_FAILONERROR, 1);
+ curl_easy_setopt(easy, CURLOPT_URL, URL);
+
+ curl_multi_add_handle(multi, easy);
+ if (perform(multi) != CURLM_OK)
+ printf("retrieve 1 failed\n");
+
+ curl_multi_remove_handle(multi, easy);
+ curl_easy_reset(easy);
+
+ curl_easy_setopt(easy, CURLOPT_FAILONERROR, 1);
+ curl_easy_setopt(easy, CURLOPT_URL, arg2);
+
+ curl_multi_add_handle(multi, easy);
+ if (perform(multi) != CURLM_OK)
+ printf("retrieve 2 failed\n");
+
+ curl_multi_remove_handle(multi, easy);
+ curl_easy_cleanup(easy);
+ curl_multi_cleanup(multi);
+
+ printf("Finished!\n");
+
+ return 0;
+}