aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-08-19 09:37:28 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-08-19 09:37:28 +0000
commitd412724598dbff1e779534cf30a241ec38b0d280 (patch)
tree4a3635c430957a01b4de9b2d635aa499a294b04b
parentf95de76789b9db8754033b61159fbf7f0c502532 (diff)
test507 for multi with bad host name
-rw-r--r--tests/libtest/Makefile.am5
-rw-r--r--tests/libtest/lib507.c50
2 files changed, 54 insertions, 1 deletions
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index b901c545d..99d7d8cf5 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -11,7 +11,7 @@ LIBDIR = ../../lib
SUPPORTFILES = first.c test.h
# here are all tools used for running libcurl tests
-noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506
+noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 lib507
lib500_SOURCES = lib500.c $(SUPPORTFILES)
lib500_LDADD = $(LIBDIR)/libcurl.la
@@ -41,3 +41,6 @@ lib506_SOURCES = lib506.c $(SUPPORTFILES)
lib506_LDADD = $(LIBDIR)/libcurl.la
lib506_DEPENDENCIES = $(LIBDIR)/libcurl.la
+lib507_SOURCES = lib507.c $(SUPPORTFILES)
+lib507_LDADD = $(LIBDIR)/libcurl.la
+lib507_DEPENDENCIES = $(LIBDIR)/libcurl.la
diff --git a/tests/libtest/lib507.c b/tests/libtest/lib507.c
new file mode 100644
index 000000000..14004f3d9
--- /dev/null
+++ b/tests/libtest/lib507.c
@@ -0,0 +1,50 @@
+#include "test.h"
+
+CURLcode test(char *URL)
+{
+ CURL* curls;
+ CURLM* multi;
+ int still_running;
+ int i;
+ CURLMsg *msg;
+
+ multi = curl_multi_init();
+
+ curls=curl_easy_init();
+ curl_easy_setopt(curls, CURLOPT_URL, URL);
+ curl_multi_add_handle(multi, curls);
+
+ while ( CURLM_CALL_MULTI_PERFORM == curl_multi_perform(multi, &still_running) );
+ while(still_running) {
+ struct timeval timeout;
+ int rc;
+ fd_set fdread;
+ fd_set fdwrite;
+ fd_set fdexcep;
+ int maxfd;
+ FD_ZERO(&fdread);
+ FD_ZERO(&fdwrite);
+ FD_ZERO(&fdexcep);
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+ curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
+ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ switch(rc) {
+ case -1:
+ break;
+ case 0:
+ default:
+ while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(multi, &still_running));
+ break;
+ }
+ }
+ msg = curl_multi_info_read(multi, &still_running);
+ /* this should now contain a result code from the easy handle,
+ get it */
+ i = msg->data.result;
+
+ curl_multi_cleanup(multi);
+ curl_easy_cleanup(curls);
+
+ return i; /* return the final return code */
+}