summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-09-23 12:46:23 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-09-23 12:46:23 +0000
commitcbc0f65fa33eef98f0a25e8c20564fbb49ecd904 (patch)
tree9a0274c121d2faa3d41ed2187103875bf4584983
parent35089a4289747bb4b15f00cf602d28fa3c913fdf (diff)
downloadgnurl-cbc0f65fa33eef98f0a25e8c20564fbb49ecd904.tar.gz
gnurl-cbc0f65fa33eef98f0a25e8c20564fbb49ecd904.tar.bz2
gnurl-cbc0f65fa33eef98f0a25e8c20564fbb49ecd904.zip
Dolbneff A.V and Spiridonoff A.V made the file:// code work with resumes
in the same style other code does.
-rw-r--r--lib/file.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/file.c b/lib/file.c
index a49085609..1f9b5d116 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -159,6 +159,16 @@ CURLcode Curl_file(struct connectdata *conn)
expected_size = (double)statbuf.st_size;
}
+ /* Added by Dolbneff A.V & Spiridonoff A.V */
+ if (conn->resume_from <= expected_size)
+ expected_size -= conn->resume_from;
+ else
+ /* Is this error code suitable in such situation? */
+ return CURLE_FTP_BAD_DOWNLOAD_RESUME;
+
+ if (expected_size == 0)
+ return CURLE_OK;
+
/* The following is a shortcut implementation of file reading
this is both more efficient than the former call to download() and
it avoids problems with select() and recv() on file descriptors
@@ -166,6 +176,10 @@ CURLcode Curl_file(struct connectdata *conn)
if(expected_size != -1)
Curl_pgrsSetDownloadSize(data, expected_size);
+ if(conn->resume_from)
+ /* Added by Dolbneff A.V & Spiridonoff A.V */
+ lseek(fd, conn->resume_from, SEEK_SET);
+
while (res == CURLE_OK) {
nread = read(fd, buf, BUFSIZE-1);