--- ../../externals/curl/source/curl-7.20.1/docs/examples/multi-single.c	2010-06-11 10:56:08.000000000 -0400
+++ ./chico.c	2010-07-08 09:52:18.000000000 -0400
@@ -13,8 +13,8 @@
 #include <string.h>
 
 /* somewhat unix-specific */
-#include <sys/time.h>
-#include <unistd.h>
+//#include <sys/time.h>
+//#include <unistd.h>
 
 /* curl stuff */
 #include <curl/curl.h>
@@ -32,7 +32,9 @@
   http_handle = curl_easy_init();
 
   /* set the options (I left out a few, you'll get the point anyway) */
-  curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.haxx.se/");
+  curl_easy_setopt(http_handle, CURLOPT_URL, "http://jpg-melchior.vivisimo.com/");
+
+  curl_easy_setopt(http_handle, CURLOPT_VERBOSE, 1);
 
   /* init a multi stack */
   multi_handle = curl_multi_init();
@@ -52,18 +54,29 @@
     fd_set fdwrite;
     fd_set fdexcep;
     int maxfd;
+    long suggested_timeout;
 
     FD_ZERO(&fdread);
     FD_ZERO(&fdwrite);
     FD_ZERO(&fdexcep);
 
-    /* set a suitable timeout to play around with */
-    timeout.tv_sec = 1;
-    timeout.tv_usec = 0;
-
     /* get file descriptors from the transfers */
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
+    curl_multi_timeout(multi_handle, &suggested_timeout);
+    fprintf(stderr, "suggested timeout is %ld\n", suggested_timeout);
+
+    /* set a suitable timeout to play around with */
+    if (suggested_timeout < 1000 &&
+	suggested_timeout >= 0)
+    {
+      timeout.tv_sec = suggested_timeout / 1000;
+      timeout.tv_usec = (suggested_timeout % 1000) * 1000;
+    } else {
+      timeout.tv_sec = 1;
+      timeout.tv_usec = 0;
+    }
+
     /* In a real-world program you OF COURSE check the return code of the
        function calls, *and* you make sure that maxfd is bigger than -1 so
        that the call to select() below makes sense! */

