mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 15:48:49 -05:00
added progress callback stuff, changed the callback typedefs to be public
This commit is contained in:
parent
dd730b09db
commit
4fd4a6888a
13
lib/url.c
13
lib/url.c
@ -96,7 +96,6 @@
|
||||
#endif
|
||||
|
||||
#include "urldata.h"
|
||||
#include <curl/curl.h>
|
||||
#include "netrc.h"
|
||||
|
||||
#include "formdata.h"
|
||||
@ -388,7 +387,7 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
data->bits.ftp_use_port = data->ftpport?1:0;
|
||||
break;
|
||||
case CURLOPT_HTTPHEADER:
|
||||
data->headers = va_arg(param, struct HttpHeader *);
|
||||
data->headers = va_arg(param, struct curl_slist *);
|
||||
break;
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
data->customrequest = va_arg(param, char *);
|
||||
@ -449,6 +448,12 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
case CURLOPT_POSTQUOTE:
|
||||
data->postquote = va_arg(param, struct curl_slist *);
|
||||
break;
|
||||
case CURLOPT_PROGRESSFUNCTION:
|
||||
data->fprogress = va_arg(param, curl_progress_callback);
|
||||
break;
|
||||
case CURLOPT_PROGRESSDATA:
|
||||
data->progress_client = va_arg(param, void *);
|
||||
break;
|
||||
case CURLOPT_PROXYUSERPWD:
|
||||
data->proxyuserpwd = va_arg(param, char *);
|
||||
data->bits.proxy_user_passwd = data->proxyuserpwd?1:0;
|
||||
@ -464,13 +469,13 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
data->err = va_arg(param, FILE *);
|
||||
break;
|
||||
case CURLOPT_WRITEFUNCTION:
|
||||
data->fwrite = va_arg(param, write_callback);
|
||||
data->fwrite = va_arg(param, curl_write_callback);
|
||||
break;
|
||||
case CURLOPT_WRITEINFO:
|
||||
data->writeinfo = va_arg(param, char *);
|
||||
break;
|
||||
case CURLOPT_READFUNCTION:
|
||||
data->fread = va_arg(param, read_callback);
|
||||
data->fread = va_arg(param, curl_read_callback);
|
||||
break;
|
||||
case CURLOPT_SSLCERT:
|
||||
data->cert = va_arg(param, char *);
|
||||
|
@ -92,7 +92,7 @@
|
||||
|
||||
#include "timeval.h"
|
||||
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* Download buffer size, keep it fairly big for speed reasons */
|
||||
#define BUFSIZE (1024*50)
|
||||
@ -263,22 +263,6 @@ struct Configbits {
|
||||
bool verbose;
|
||||
};
|
||||
|
||||
typedef size_t (*progress_callback)(void *clientp,
|
||||
size_t dltotal,
|
||||
size_t dlnow,
|
||||
size_t ultotal,
|
||||
size_t ulnow);
|
||||
|
||||
typedef size_t (*write_callback)(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
FILE *outstream);
|
||||
|
||||
typedef size_t (*read_callback)(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
FILE *instream);
|
||||
|
||||
/* What type of interface that intiated this struct */
|
||||
typedef enum {
|
||||
CURLI_NONE,
|
||||
@ -355,13 +339,13 @@ struct UrlData {
|
||||
char *ftpport; /* port to send with the PORT command */
|
||||
|
||||
/* function that stores the output:*/
|
||||
write_callback fwrite;
|
||||
curl_write_callback fwrite;
|
||||
|
||||
/* function that reads the input:*/
|
||||
read_callback fread;
|
||||
curl_read_callback fread;
|
||||
|
||||
/* function that wants progress information */
|
||||
progress_callback fprogress;
|
||||
curl_progress_callback fprogress;
|
||||
void *progress_client; /* pointer to pass to the progress callback */
|
||||
|
||||
long timeout; /* in seconds, 0 means no timeout */
|
||||
|
Loading…
Reference in New Issue
Block a user