Backed out updated libcurl.

This commit is contained in:
Asher Baker
2013-03-18 00:55:59 +00:00
parent 9b65900df0
commit e84f6e4afd
1511 changed files with 161513 additions and 213368 deletions
@@ -1,25 +1,15 @@
/***************************************************************************
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <[email protected]>, et al.
* $Id: multi-debugcallback.c,v 1.4 2008-05-22 21:20:09 danf Exp $
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* This is an example showing the multi interface and the debug callback. */
* This is a very simple example using the multi interface and the debug
* callback.
*/
#include <stdio.h>
#include <string.h>
@@ -48,12 +38,11 @@ void dump(const char *text,
/* without the hex output, we can fit more on screen */
width = 0x40;
fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n",
text, (long)size, (long)size);
fprintf(stream, "%s, %zd bytes (0x%zx)\n", text, size, size);
for(i=0; i<size; i+= width) {
fprintf(stream, "%4.4lx: ", (long)i);
fprintf(stream, "%04zx: ", i);
if(!nohex) {
/* hex not disabled, show it */
@@ -85,12 +74,11 @@ void dump(const char *text,
static
int my_trace(CURL *handle, curl_infotype type,
unsigned char *data, size_t size,
char *data, size_t size,
void *userp)
{
const char *text;
(void)userp;
(void)handle; /* prevent compiler warning */
switch (type) {
@@ -120,7 +108,7 @@ int my_trace(CURL *handle, curl_infotype type,
/*
* Simply download a HTTP file.
*/
int main(void)
int main(int argc, char **argv)
{
CURL *http_handle;
CURLM *multi_handle;
@@ -130,7 +118,7 @@ int main(void)
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.example.com/");
curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.haxx.se/");
curl_easy_setopt(http_handle, CURLOPT_DEBUGFUNCTION, my_trace);
curl_easy_setopt(http_handle, CURLOPT_VERBOSE, 1L);
@@ -142,18 +130,17 @@ int main(void)
curl_multi_add_handle(multi_handle, http_handle);
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
while(CURLM_CALL_MULTI_PERFORM ==
curl_multi_perform(multi_handle, &still_running));
do {
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
fd_set fdread;
fd_set fdwrite;
fd_set fdexcep;
int maxfd = -1;
long curl_timeo = -1;
int maxfd;
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
@@ -163,23 +150,12 @@ int main(void)
timeout.tv_sec = 1;
timeout.tv_usec = 0;
curl_multi_timeout(multi_handle, &curl_timeo);
if(curl_timeo >= 0) {
timeout.tv_sec = curl_timeo / 1000;
if(timeout.tv_sec > 1)
timeout.tv_sec = 1;
else
timeout.tv_usec = (curl_timeo % 1000) * 1000;
}
/* get file descriptors from the transfers */
curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
/* In a real-world program you OF COURSE check the return code of the
function calls. On success, the value of maxfd is guaranteed to be
greater or equal than -1. We call select(maxfd + 1, ...), specially in
case of (maxfd == -1), we call select(0, ...), which is basically equal
to sleep. */
function calls, *and* you make sure that maxfd is bigger than -1
so that the call to select() below makes sense! */
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
@@ -192,10 +168,11 @@ int main(void)
case 0:
default:
/* timeout or readable/writable sockets */
curl_multi_perform(multi_handle, &still_running);
while(CURLM_CALL_MULTI_PERFORM ==
curl_multi_perform(multi_handle, &still_running));
break;
}
} while(still_running);
}
curl_multi_cleanup(multi_handle);