summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2010-06-03 07:39:54 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2010-06-03 07:39:54 +0000
commit343ee3d372ef45f148829e02280895c643543dd3 (patch)
treec6091cedc9bb97dc887448c3423d0ba39fdafb94
parent9af3029471fac17983fbe3b1d3df020fcdc0e398 (diff)
When attempting to resume a download, against an HTTP server that
doesn't support resume, we restart the download from the beginning, like all other browsers. Diagnosed by sthen and halex, comment from sthen OK sthen@, halex@
-rw-r--r--usr.bin/ftp/fetch.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c
index 1be8f86cf95..5b26ee063a9 100644
--- a/usr.bin/ftp/fetch.c
+++ b/usr.bin/ftp/fetch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fetch.c,v 1.97 2009/10/16 12:28:04 martynas Exp $ */
+/* $OpenBSD: fetch.c,v 1.98 2010/06/03 07:39:53 phessler Exp $ */
/* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */
/*-
@@ -671,6 +671,17 @@ again:
switch (status) {
case 200: /* OK */
#ifndef SMALL
+ /*
+ * When we request a partial file, and we receive an HTTP 200
+ * it is a good indication that the server doesn't support
+ * range requests, and is about to send us the entire file.
+ * If the restart_point == 0, then we are not actually
+ * requesting a partial file, and an HTTP 200 is appropriate.
+ */
+ if (resume && restart_point != 0) {
+ warnx("Server does not support resume.");
+ restart_point = resume = 0;
+ }
case 206: /* Partial Content */
#endif /* !SMALL */
break;