aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-02-01 23:52:11 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-02-01 23:52:11 +0000
commit15755b3fd8744e1ff7d2cda5f2db9477a84e5c88 (patch)
tree10e12f5c8ab0262dcb1e32a94d533c96888e77c6 /lib
parentd2af77e60c321431e6673bc1cad2f71e7d5feb64 (diff)
Adjusted to use the new Transfer() instead of the old Download()
Diffstat (limited to 'lib')
-rw-r--r--lib/dict.c9
-rw-r--r--lib/ftp.c8
-rw-r--r--lib/http.c32
3 files changed, 26 insertions, 23 deletions
diff --git a/lib/dict.c b/lib/dict.c
index e26437022..99abf49f6 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -162,7 +162,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount)
word
);
- result = Download(data, data->firstsocket, -1, FALSE, bytecount);
+ result = Transfer(data, data->firstsocket, -1, FALSE, bytecount,
+ -1, NULL); /* no upload */
if(result)
return result;
@@ -209,7 +210,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount)
word
);
- result = Download(data, data->firstsocket, -1, FALSE, bytecount);
+ result = Transfer(data, data->firstsocket, -1, FALSE, bytecount,
+ -1, NULL); /* no upload */
if(result)
return result;
@@ -232,7 +234,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount)
"QUIT\n",
ppath);
- result = Download(data, data->firstsocket, -1, FALSE, bytecount);
+ result = Transfer(data, data->firstsocket, -1, FALSE, bytecount,
+ -1, NULL);
if(result)
return result;
diff --git a/lib/ftp.c b/lib/ftp.c
index fb753f213..e85cc9833 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -754,7 +754,8 @@ UrgError _ftp(struct UrlData *data,
size prior to the actual upload. */
ProgressInit(data, data->infilesize);
- result = Upload(data, data->secondarysocket, bytecountp);
+ result = Transfer(data, -1, -1, FALSE, NULL, /* no download */
+ data->secondarysocket, bytecountp);
if(result)
return result;
@@ -977,8 +978,9 @@ UrgError _ftp(struct UrlData *data,
infof(data, "Getting file with size: %d\n", size);
/* FTP download: */
- result=Download(data, data->secondarysocket, size, FALSE,
- bytecountp);
+ result=Transfer(data, data->secondarysocket, size, FALSE,
+ bytecountp,
+ -1, NULL); /* no upload here */
if(result)
return result;
diff --git a/lib/http.c b/lib/http.c
index 2dd41c0fa..49d47b3a5 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -127,6 +127,8 @@ UrgError http(struct UrlData *data, char *ppath, char *host, long *bytecount)
struct Cookie *co = NULL;
char *p_pragma = NULL;
char *p_accept = NULL;
+ long readbytecount;
+ long writebytecount;
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
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. */
if(checkheaders(data, "User-Agent:") && 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",
postsize-2);
- conf = data->conf;
- data->conf &= ~CONF_NOPROGRESS; /* enable progress meter */
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 */
- data->conf = conf; /* restore conf values for the download */
-
if(result)
return result;
@@ -348,27 +348,25 @@ UrgError http(struct UrlData *data, char *ppath, char *host, long *bytecount)
sendf(data->firstsocket, data,
"\015\012");
- conf = data->conf;
- data->conf &= ~CONF_NOPROGRESS; /* enable progress meter */
-
ProgressInit(data, data->infilesize);
- result = Upload(data, data->firstsocket, bytecount);
-
- data->conf = conf;
+ result = Transfer(data, data->firstsocket, -1, TRUE, &readbytecount,
+ data->firstsocket, &writebytecount);
+
+ *bytecount = readbytecount + writebytecount;
if(result)
return result;
- /* reset the byte counter */
- *bytecount=0;
}
else {
sendf(data->firstsocket, data, "\r\n");
}
- /* HTTP GET/HEAD download: */
- result = Download(data, data->firstsocket, -1, TRUE, bytecount);
-
+ if(0 == *bytecount) {
+ /* HTTP GET/HEAD download: */
+ result = Transfer(data, data->firstsocket, -1, TRUE, bytecount,
+ -1, NULL); /* nothing to upload */
+ }
if(result)
return result;