37 #ifndef CURLPIPE_MULTIPLEX 41 #define CURLPIPE_MULTIPLEX 0 44 #define NUM_HANDLES 1000 62 void dump(
const char *text,
int num,
unsigned char *
ptr,
size_t size,
68 unsigned int width = 0x10;
74 fprintf(stderr,
"%d %s, %ld bytes (0x%lx)\n",
75 num, text, (
long)size, (
long)size);
79 fprintf(stderr,
"%4.4lx: ", (
long)i);
83 for(c = 0; c <
width; c++)
85 fprintf(stderr,
"%02x ", ptr[i + c]);
90 for(c = 0; (c <
width) && (i + c < size); c++) {
92 if(nohex && (i + c + 1 < size) && ptr[i + c] == 0x0D &&
93 ptr[i + c + 1] == 0x0A) {
98 (ptr[i + c] >= 0x20) && (ptr[i + c]<0x80)?ptr[i + c]:
'.');
100 if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
101 ptr[i + c + 2] == 0x0A) {
102 i += (c + 3 -
width);
121 fprintf(stderr,
"== %d Info: %s", num, data);
127 text =
"=> Send header";
130 text =
"=> Send data";
133 text =
"=> Send SSL data";
136 text =
"<= Recv header";
139 text =
"<= Recv data";
142 text =
"<= Recv SSL data";
146 dump(text, num, (
unsigned char *)data, size, 1);
155 snprintf(filename, 128,
"dl-%d", num);
157 out = fopen(filename,
"wb");
176 #if (CURLPIPE_MULTIPLEX > 0) 187 int main(
int argc,
char **argv)
228 long curl_timeo = -1;
239 if(curl_timeo >= 0) {
240 timeout.
tv_sec = curl_timeo / 1000;
244 timeout.
tv_usec = (curl_timeo % 1000) * 1000;
251 fprintf(stderr,
"curl_multi_fdset() failed, code %d.\n", mc);
267 struct timeval wait = { 0, 100 * 1000 };
268 rc = select(0, NULL, NULL, NULL, &wait);
274 rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
287 }
while(still_running);
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *exc_fd_set, int *max_fd)
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *curl_handle)
static int hnd2num(CURL *hnd)
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, long *milliseconds)
UNITTEST_START char * ptr
int main(int argc, char **argv)
#define curl_easy_setopt(handle, option, value)
CURL_EXTERN CURLM * curl_multi_init(void)
static int my_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp)
static CURLM * multi_handle
#define curl_multi_setopt(handle, opt, param)
CURL_EXTERN CURL * curl_easy_init(void)
CURL_EXTERN void curl_easy_cleanup(CURL *curl)
#define CURLPIPE_MULTIPLEX
static void setup(CURL *hnd, int num)
static void * curl_hnd[NUM_HANDLES]
static void dump(const char *text, int num, unsigned char *ptr, size_t size, char nohex)
static CURL * easy[MAX_EASY_HANDLES]
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle)