Implemented only the parts of Patrick Monnerat's OS/400 patch that renamed

some few internal identifiers to avoid conflicts, which could be useful on
other platforms.
This commit is contained in:
Dan Fandrich 2007-07-23 18:51:22 +00:00
parent cc44fb1dc8
commit 5ecd56d964
11 changed files with 45 additions and 47 deletions

View File

@ -6,6 +6,11 @@
Changelog Changelog
Dan F (23 July 2007)
- Implemented only the parts of Patrick Monnerat's OS/400 patch that renamed
some few internal identifiers to avoid conflicts, which could be useful on
other platforms.
Daniel S (22 July 2007) Daniel S (22 July 2007)
- HTTP Digest bug fix by Chris Flerackers: - HTTP Digest bug fix by Chris Flerackers:

View File

@ -48,6 +48,6 @@ advice from friends like these:
Dan Fandrich, Song Ma, Daniel Black, Giancarlo Formicuccia, Shmulik Regev, Dan Fandrich, Song Ma, Daniel Black, Giancarlo Formicuccia, Shmulik Regev,
Daniel Cater, Colin Hogben, Jofell Gallardo, Daniel Johnson, Daniel Cater, Colin Hogben, Jofell Gallardo, Daniel Johnson,
Ralf S. Engelschall, James Housley, Chris Flerackers Ralf S. Engelschall, James Housley, Chris Flerackers, Patrick Monnerat
Thanks! (and sorry if I forgot to mention someone) Thanks! (and sorry if I forgot to mention someone)

View File

@ -696,10 +696,10 @@ void curl_easy_reset(CURL *curl)
data->set.err = stderr; /* default stderr to stderr */ data->set.err = stderr; /* default stderr to stderr */
/* use fwrite as default function to store output */ /* use fwrite as default function to store output */
data->set.fwrite = (curl_write_callback)fwrite; data->set.fwrite_func = (curl_write_callback)fwrite;
/* use fread as default function to read input */ /* use fread as default function to read input */
data->set.fread = (curl_read_callback)fread; data->set.fread_func = (curl_read_callback)fread;
data->set.infilesize = -1; /* we don't know any size */ data->set.infilesize = -1; /* we don't know any size */
data->set.postfieldsize = -1; data->set.postfieldsize = -1;

View File

@ -205,7 +205,7 @@ static CURLcode file_upload(struct connectdata *conn)
* Since FILE: doesn't do the full init, we need to provide some extra * Since FILE: doesn't do the full init, we need to provide some extra
* assignments here. * assignments here.
*/ */
conn->fread = data->set.fread; conn->fread_func = data->set.fread_func;
conn->fread_in = data->set.in; conn->fread_in = data->set.in;
conn->data->reqdata.upload_fromhere = buf; conn->data->reqdata.upload_fromhere = buf;

View File

@ -1477,7 +1477,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
readthisamountnow = BUFSIZE; readthisamountnow = BUFSIZE;
actuallyread = (curl_off_t) actuallyread = (curl_off_t)
conn->fread(data->state.buffer, 1, (size_t)readthisamountnow, conn->fread_func(data->state.buffer, 1, (size_t)readthisamountnow,
conn->fread_in); conn->fread_in);
passed += actuallyread; passed += actuallyread;

View File

@ -790,7 +790,7 @@ static size_t readmoredata(char *buffer,
/* move backup data into focus and continue on that */ /* move backup data into focus and continue on that */
http->postdata = http->backup.postdata; http->postdata = http->backup.postdata;
http->postsize = http->backup.postsize; http->postsize = http->backup.postsize;
conn->fread = http->backup.fread; conn->fread_func = http->backup.fread_func;
conn->fread_in = http->backup.fread_in; conn->fread_in = http->backup.fread_in;
http->sending++; /* move one step up */ http->sending++; /* move one step up */
@ -940,13 +940,13 @@ CURLcode add_buffer_send(send_buffer *in,
ptr = in->buffer + amount; ptr = in->buffer + amount;
/* backup the currently set pointers */ /* backup the currently set pointers */
http->backup.fread = conn->fread; http->backup.fread_func = conn->fread_func;
http->backup.fread_in = conn->fread_in; http->backup.fread_in = conn->fread_in;
http->backup.postdata = http->postdata; http->backup.postdata = http->postdata;
http->backup.postsize = http->postsize; http->backup.postsize = http->postsize;
/* set the new pointers for the request-sending */ /* set the new pointers for the request-sending */
conn->fread = (curl_read_callback)readmoredata; conn->fread_func = (curl_read_callback)readmoredata;
conn->fread_in = (void *)conn; conn->fread_in = (void *)conn;
http->postdata = ptr; http->postdata = ptr;
http->postsize = (curl_off_t)size; http->postsize = (curl_off_t)size;
@ -1606,7 +1606,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
(void)premature; /* not used */ (void)premature; /* not used */
/* set the proper values (possibly modified on POST) */ /* set the proper values (possibly modified on POST) */
conn->fread = data->set.fread; /* restore */ conn->fread_func = data->set.fread_func; /* restore */
conn->fread_in = data->set.in; /* restore */ conn->fread_in = data->set.in; /* restore */
if (http == NULL) if (http == NULL)
@ -1991,7 +1991,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
readthisamountnow = BUFSIZE; readthisamountnow = BUFSIZE;
actuallyread = actuallyread =
data->set.fread(data->state.buffer, 1, (size_t)readthisamountnow, data->set.fread_func(data->state.buffer, 1, (size_t)readthisamountnow,
data->set.in); data->set.in);
passed += actuallyread; passed += actuallyread;
@ -2246,7 +2246,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
} }
/* set the read function to read from the generated form data */ /* set the read function to read from the generated form data */
conn->fread = (curl_read_callback)Curl_FormReader; conn->fread_func = (curl_read_callback)Curl_FormReader;
conn->fread_in = &http->form; conn->fread_in = &http->form;
http->sending = HTTPSEND_BODY; http->sending = HTTPSEND_BODY;
@ -2446,7 +2446,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
http->sending = HTTPSEND_BODY; http->sending = HTTPSEND_BODY;
conn->fread = (curl_read_callback)readmoredata; conn->fread_func = (curl_read_callback)readmoredata;
conn->fread_in = (void *)conn; conn->fread_in = (void *)conn;
/* set the upload size to the progress meter */ /* set the upload size to the progress meter */

View File

@ -416,7 +416,7 @@ CURLcode Curl_client_write(struct connectdata *conn,
/* If the previous block of data ended with CR and this block of data is /* If the previous block of data ended with CR and this block of data is
just a NL, then the length might be zero */ just a NL, then the length might be zero */
if (len) { if (len) {
wrote = data->set.fwrite(ptr, 1, len, data->set.out); wrote = data->set.fwrite_func(ptr, 1, len, data->set.out);
} }
else { else {
wrote = len; wrote = len;
@ -435,7 +435,7 @@ CURLcode Curl_client_write(struct connectdata *conn,
* header callback function (added after version 7.7.1). * header callback function (added after version 7.7.1).
*/ */
curl_write_callback writeit= curl_write_callback writeit=
data->set.fwrite_header?data->set.fwrite_header:data->set.fwrite; data->set.fwrite_header?data->set.fwrite_header:data->set.fwrite_func;
/* Note: The header is in the host encoding /* Note: The header is in the host encoding
regardless of the ftp transfer mode (ASCII/Image) */ regardless of the ftp transfer mode (ASCII/Image) */

View File

@ -127,7 +127,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
/* this function returns a size_t, so we typecast to int to prevent warnings /* this function returns a size_t, so we typecast to int to prevent warnings
with picky compilers */ with picky compilers */
nread = (int)conn->fread(data->reqdata.upload_fromhere, 1, nread = (int)conn->fread_func(data->reqdata.upload_fromhere, 1,
buffersize, conn->fread_in); buffersize, conn->fread_in);
if(nread == CURL_READFUNC_ABORT) { if(nread == CURL_READFUNC_ABORT) {
@ -237,10 +237,10 @@ CURLcode Curl_readrewind(struct connectdata *conn)
(data->set.httpreq == HTTPREQ_POST_FORM)) (data->set.httpreq == HTTPREQ_POST_FORM))
; /* do nothing */ ; /* do nothing */
else { else {
if(data->set.ioctl) { if(data->set.ioctl_func) {
curlioerr err; curlioerr err;
err = (data->set.ioctl) (data, CURLIOCMD_RESTARTREAD, err = (data->set.ioctl_func) (data, CURLIOCMD_RESTARTREAD,
data->set.ioctl_client); data->set.ioctl_client);
infof(data, "the ioctl callback returned %d\n", (int)err); infof(data, "the ioctl callback returned %d\n", (int)err);
@ -254,7 +254,7 @@ CURLcode Curl_readrewind(struct connectdata *conn)
/* If no CURLOPT_READFUNCTION is used, we know that we operate on a /* If no CURLOPT_READFUNCTION is used, we know that we operate on a
given FILE * stream and we can actually attempt to rewind that given FILE * stream and we can actually attempt to rewind that
ourself with fseek() */ ourself with fseek() */
if(data->set.fread == (curl_read_callback)fread) { if(data->set.fread_func == (curl_read_callback)fread) {
if(-1 != fseek(data->set.in, 0, SEEK_SET)) if(-1 != fseek(data->set.in, 0, SEEK_SET))
/* successful rewind */ /* successful rewind */
return CURLE_OK; return CURLE_OK;

View File

@ -546,10 +546,10 @@ CURLcode Curl_open(struct SessionHandle **curl)
data->set.err = stderr; /* default stderr to stderr */ data->set.err = stderr; /* default stderr to stderr */
/* use fwrite as default function to store output */ /* use fwrite as default function to store output */
data->set.fwrite = (curl_write_callback)fwrite; data->set.fwrite_func = (curl_write_callback)fwrite;
/* use fread as default function to read input */ /* use fread as default function to read input */
data->set.fread = (curl_read_callback)fread; data->set.fread_func = (curl_read_callback)fread;
/* conversion callbacks for non-ASCII hosts */ /* conversion callbacks for non-ASCII hosts */
data->set.convfromnetwork = (curl_conv_callback)ZERO_NULL; data->set.convfromnetwork = (curl_conv_callback)ZERO_NULL;
@ -1380,19 +1380,19 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* Set data write callback * Set data write callback
*/ */
data->set.fwrite = va_arg(param, curl_write_callback); data->set.fwrite_func = va_arg(param, curl_write_callback);
if(!data->set.fwrite) if(!data->set.fwrite_func)
/* When set to NULL, reset to our internal default function */ /* When set to NULL, reset to our internal default function */
data->set.fwrite = (curl_write_callback)fwrite; data->set.fwrite_func = (curl_write_callback)fwrite;
break; break;
case CURLOPT_READFUNCTION: case CURLOPT_READFUNCTION:
/* /*
* Read data callback * Read data callback
*/ */
data->set.fread = va_arg(param, curl_read_callback); data->set.fread_func = va_arg(param, curl_read_callback);
if(!data->set.fread) if(!data->set.fread_func)
/* When set to NULL, reset to our internal default function */ /* When set to NULL, reset to our internal default function */
data->set.fread = (curl_read_callback)fread; data->set.fread_func = (curl_read_callback)fread;
break; break;
case CURLOPT_CONV_FROM_NETWORK_FUNCTION: case CURLOPT_CONV_FROM_NETWORK_FUNCTION:
/* /*
@ -1416,7 +1416,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* I/O control callback. Might be NULL. * I/O control callback. Might be NULL.
*/ */
data->set.ioctl = va_arg(param, curl_ioctl_callback); data->set.ioctl_func = va_arg(param, curl_ioctl_callback);
break; break;
case CURLOPT_IOCTLDATA: case CURLOPT_IOCTLDATA:
/* /*
@ -3865,7 +3865,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
* *
* Inherit the proper values from the urldata struct AFTER we have arranged * Inherit the proper values from the urldata struct AFTER we have arranged
* the persistent connection stuff */ * the persistent connection stuff */
conn->fread = data->set.fread; conn->fread_func = data->set.fread_func;
conn->fread_in = data->set.in; conn->fread_in = data->set.in;
if ((conn->protocol&PROT_HTTP) && if ((conn->protocol&PROT_HTTP) &&

View File

@ -288,7 +288,7 @@ struct HTTP {
struct Curl_chunker chunk; struct Curl_chunker chunk;
struct back { struct back {
curl_read_callback fread; /* backup storage for fread pointer */ curl_read_callback fread_func; /* backup storage for fread pointer */
void *fread_in; /* backup storage for fread_in pointer */ void *fread_in; /* backup storage for fread_in pointer */
char *postdata; char *postdata;
curl_off_t postsize; curl_off_t postsize;
@ -965,7 +965,7 @@ struct connectdata {
/*************** Request - specific items ************/ /*************** Request - specific items ************/
/* previously this was in the urldata struct */ /* previously this was in the urldata struct */
curl_read_callback fread; /* function that reads the input */ curl_read_callback fread_func; /* function that reads the input */
void *fread_in; /* pointer to pass to the fread() above */ void *fread_in; /* pointer to pass to the fread() above */
struct ntlmdata ntlm; /* NTLM differs from other authentication schemes struct ntlmdata ntlm; /* NTLM differs from other authentication schemes
@ -1268,12 +1268,12 @@ struct UserDefined {
unsigned short localport; /* local port number to bind to */ unsigned short localport; /* local port number to bind to */
int localportrange; /* number of additional port numbers to test in case the int localportrange; /* number of additional port numbers to test in case the
'localport' one can't be bind()ed */ 'localport' one can't be bind()ed */
curl_write_callback fwrite; /* function that stores the output */ curl_write_callback fwrite_func; /* function that stores the output */
curl_write_callback fwrite_header; /* function that stores headers */ curl_write_callback fwrite_header; /* function that stores headers */
curl_read_callback fread; /* function that reads the input */ curl_read_callback fread_func; /* function that reads the input */
curl_progress_callback fprogress; /* function for progress information */ curl_progress_callback fprogress; /* function for progress information */
curl_debug_callback fdebug; /* function that write informational data */ curl_debug_callback fdebug; /* function that write informational data */
curl_ioctl_callback ioctl; /* function for I/O control */ curl_ioctl_callback ioctl_func; /* function for I/O control */
curl_sockopt_callback fsockopt; /* function for setting socket options */ curl_sockopt_callback fsockopt; /* function for setting socket options */
void *sockopt_client; /* pointer to pass to the socket options callback */ void *sockopt_client; /* pointer to pass to the socket options callback */

View File

@ -19,13 +19,6 @@ const char *HOSTHEADER = "Host: www.host.foo.com";
const char *JAR = "log/jar506"; const char *JAR = "log/jar506";
#define THREADS 2 #define THREADS 2
void lock(CURL *handle, curl_lock_data data, curl_lock_access access,
void *useptr );
void unlock(CURL *handle, curl_lock_data data, void *useptr );
struct curl_slist *sethost(struct curl_slist *headers);
void *fire(void *ptr);
char *suburl(const char *base, int i);
/* struct containing data of a thread */ /* struct containing data of a thread */
struct Tdata { struct Tdata {
CURLSH *share; CURLSH *share;
@ -38,7 +31,7 @@ struct userdata {
}; };
/* lock callback */ /* lock callback */
void lock(CURL *handle, curl_lock_data data, curl_lock_access access, static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access access,
void *useptr ) void *useptr )
{ {
const char *what; const char *what;
@ -66,7 +59,7 @@ void lock(CURL *handle, curl_lock_data data, curl_lock_access access,
} }
/* unlock callback */ /* unlock callback */
void unlock(CURL *handle, curl_lock_data data, void *useptr ) static void my_unlock(CURL *handle, curl_lock_data data, void *useptr )
{ {
const char *what; const char *what;
struct userdata *user = (struct userdata *)useptr; struct userdata *user = (struct userdata *)useptr;
@ -91,7 +84,7 @@ void unlock(CURL *handle, curl_lock_data data, void *useptr )
/* build host entry */ /* build host entry */
struct curl_slist *sethost(struct curl_slist *headers) static struct curl_slist *sethost(struct curl_slist *headers)
{ {
(void)headers; (void)headers;
return curl_slist_append(NULL, HOSTHEADER ); return curl_slist_append(NULL, HOSTHEADER );
@ -99,7 +92,7 @@ struct curl_slist *sethost(struct curl_slist *headers)
/* the dummy thread function */ /* the dummy thread function */
void *fire(void *ptr) static void *fire(void *ptr)
{ {
CURLcode code; CURLcode code;
struct curl_slist *headers; struct curl_slist *headers;
@ -135,7 +128,7 @@ void *fire(void *ptr)
/* build request url */ /* build request url */
char *suburl(const char *base, int i) static char *suburl(const char *base, int i)
{ {
return curl_maprintf("%s000%c", base, 48+i); return curl_maprintf("%s000%c", base, 48+i);
} }
@ -173,11 +166,11 @@ int test(char *URL)
if ( CURLSHE_OK == scode ) { if ( CURLSHE_OK == scode ) {
printf( "CURLSHOPT_LOCKFUNC\n" ); printf( "CURLSHOPT_LOCKFUNC\n" );
scode = curl_share_setopt( share, CURLSHOPT_LOCKFUNC, lock); scode = curl_share_setopt( share, CURLSHOPT_LOCKFUNC, my_lock);
} }
if ( CURLSHE_OK == scode ) { if ( CURLSHE_OK == scode ) {
printf( "CURLSHOPT_UNLOCKFUNC\n" ); printf( "CURLSHOPT_UNLOCKFUNC\n" );
scode = curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, unlock); scode = curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, my_unlock);
} }
if ( CURLSHE_OK == scode ) { if ( CURLSHE_OK == scode ) {
printf( "CURLSHOPT_USERDATA\n" ); printf( "CURLSHOPT_USERDATA\n" );