1
0
mirror of https://github.com/moparisthebest/curl synced 2025-03-11 07:39:50 -04:00

Adjusted to use the new Transfer() instead of the old Download()

This commit is contained in:
Daniel Stenberg 2000-02-01 23:52:11 +00:00
parent d2af77e60c
commit 15755b3fd8
3 changed files with 26 additions and 23 deletions

View File

@ -162,7 +162,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount)
word word
); );
result = Download(data, data->firstsocket, -1, FALSE, bytecount); result = Transfer(data, data->firstsocket, -1, FALSE, bytecount,
-1, NULL); /* no upload */
if(result) if(result)
return result; return result;
@ -209,7 +210,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount)
word word
); );
result = Download(data, data->firstsocket, -1, FALSE, bytecount); result = Transfer(data, data->firstsocket, -1, FALSE, bytecount,
-1, NULL); /* no upload */
if(result) if(result)
return result; return result;
@ -232,7 +234,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount)
"QUIT\n", "QUIT\n",
ppath); ppath);
result = Download(data, data->firstsocket, -1, FALSE, bytecount); result = Transfer(data, data->firstsocket, -1, FALSE, bytecount,
-1, NULL);
if(result) if(result)
return result; return result;

View File

@ -754,7 +754,8 @@ UrgError _ftp(struct UrlData *data,
size prior to the actual upload. */ size prior to the actual upload. */
ProgressInit(data, data->infilesize); ProgressInit(data, data->infilesize);
result = Upload(data, data->secondarysocket, bytecountp); result = Transfer(data, -1, -1, FALSE, NULL, /* no download */
data->secondarysocket, bytecountp);
if(result) if(result)
return result; return result;
@ -977,8 +978,9 @@ UrgError _ftp(struct UrlData *data,
infof(data, "Getting file with size: %d\n", size); infof(data, "Getting file with size: %d\n", size);
/* FTP download: */ /* FTP download: */
result=Download(data, data->secondarysocket, size, FALSE, result=Transfer(data, data->secondarysocket, size, FALSE,
bytecountp); bytecountp,
-1, NULL); /* no upload here */
if(result) if(result)
return result; return result;

View File

@ -127,6 +127,8 @@ UrgError http(struct UrlData *data, char *ppath, char *host, long *bytecount)
struct Cookie *co = NULL; struct Cookie *co = NULL;
char *p_pragma = NULL; char *p_pragma = NULL;
char *p_accept = NULL; char *p_accept = NULL;
long readbytecount;
long writebytecount;
buf = data->buffer; /* this is our buffer */ buf = data->buffer; /* this is our buffer */
@ -144,7 +146,7 @@ UrgError http(struct UrlData *data, char *ppath, char *host, long *bytecount)
/* The User-Agent string has been built in url.c already, because it might /* The User-Agent string has been built in url.c already, because it might
have been used in the proxy connect, but if we have got a header with have been used in the proxy connect, but if we have got a header with
the user-agent string specified, we erase the previosly made string the user-agent string specified, we erase the previously made string
here. */ here. */
if(checkheaders(data, "User-Agent:") && data->ptr_uagent) { if(checkheaders(data, "User-Agent:") && data->ptr_uagent) {
free(data->ptr_uagent); free(data->ptr_uagent);
@ -315,16 +317,14 @@ UrgError http(struct UrlData *data, char *ppath, char *host, long *bytecount)
"Content-Length: %d\r\n", "Content-Length: %d\r\n",
postsize-2); postsize-2);
conf = data->conf;
data->conf &= ~CONF_NOPROGRESS; /* enable progress meter */
ProgressInit(data, postsize); ProgressInit(data, postsize);
result = Upload(data, data->firstsocket, bytecount); result = Transfer(data, data->firstsocket, -1, TRUE, &readbytecount,
data->firstsocket, writebytecount);
*bytecount = readbytecount + writebytecount;
FormFree(sendit); /* Now free that whole lot */ FormFree(sendit); /* Now free that whole lot */
data->conf = conf; /* restore conf values for the download */
if(result) if(result)
return result; return result;
@ -348,27 +348,25 @@ UrgError http(struct UrlData *data, char *ppath, char *host, long *bytecount)
sendf(data->firstsocket, data, sendf(data->firstsocket, data,
"\015\012"); "\015\012");
conf = data->conf;
data->conf &= ~CONF_NOPROGRESS; /* enable progress meter */
ProgressInit(data, data->infilesize); ProgressInit(data, data->infilesize);
result = Upload(data, data->firstsocket, bytecount); result = Transfer(data, data->firstsocket, -1, TRUE, &readbytecount,
data->firstsocket, &writebytecount);
data->conf = conf; *bytecount = readbytecount + writebytecount;
if(result) if(result)
return result; return result;
/* reset the byte counter */
*bytecount=0;
} }
else { else {
sendf(data->firstsocket, data, "\r\n"); sendf(data->firstsocket, data, "\r\n");
} }
if(0 == *bytecount) {
/* HTTP GET/HEAD download: */ /* HTTP GET/HEAD download: */
result = Download(data, data->firstsocket, -1, TRUE, bytecount); result = Transfer(data, data->firstsocket, -1, TRUE, bytecount,
-1, NULL); /* nothing to upload */
}
if(result) if(result)
return result; return result;