aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib502.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-12-13 13:40:25 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-12-13 13:40:25 +0000
commitd346ba5c3c685ecb58e40b1fdd48c0f6dca332b5 (patch)
tree61c614da957c805f7d6484796332208ec4b18e6b /tests/libtest/lib502.c
parent978541adc20126accef2ec82cbbba3ddc655a172 (diff)
lib502.c for multi interface tests on a single URL without select()
Diffstat (limited to 'tests/libtest/lib502.c')
-rw-r--r--tests/libtest/lib502.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/libtest/lib502.c b/tests/libtest/lib502.c
new file mode 100644
index 000000000..55ca6c5db
--- /dev/null
+++ b/tests/libtest/lib502.c
@@ -0,0 +1,33 @@
+#include "test.h"
+
+/*
+ * Get a single URL without select().
+ */
+
+CURLcode test(char *URL)
+{
+ CURL *c;
+ CURLM *m;
+ CURLMcode res;
+ int running=1;
+
+ curl_global_init(CURL_GLOBAL_ALL);
+ c = curl_easy_init();
+ curl_easy_setopt(c, CURLOPT_URL, URL);
+ m = curl_multi_init();
+
+ res = curl_multi_add_handle(m, c);
+ while (running) {
+ res = curl_multi_perform(m, &running);
+ if (running <= 0) {
+ fprintf(stderr, "nothing left running.\n");
+ break;
+ }
+ }
+ curl_multi_remove_handle(m, c);
+ curl_easy_cleanup(c);
+ curl_multi_cleanup(m);
+
+ return 0;
+}
+