Index: docs/curl.1
===================================================================
RCS file: /cvsroot/curl/curl/docs/curl.1,v
retrieving revision 1.157
diff -u -r1.157 curl.1
--- docs/curl.1	12 Aug 2005 20:56:12 -0000	1.157
+++ docs/curl.1	23 Aug 2005 20:59:20 -0000
@@ -429,6 +429,11 @@
 See also the \fI-A/--user-agent\fP and \fI-e/--referer\fP options.
 
 This option can be used multiple times to add/replace/remove multiple headers.
+.IP "--ignore-content-length"
+(HTTP)
+Ignore the Content-Length header. This is particularly useful for servers
+running Apache 1.x, which will report incorrect Content-Length for files
+larger than 2 gigabytes.
 .IP "-i/--include"
 (HTTP)
 Include the HTTP-header in the output. The HTTP-header includes things
Index: docs/libcurl/curl_easy_setopt.3
===================================================================
RCS file: /cvsroot/curl/curl/docs/libcurl/curl_easy_setopt.3,v
retrieving revision 1.122
diff -u -r1.122 curl_easy_setopt.3
--- docs/libcurl/curl_easy_setopt.3	19 Aug 2005 21:38:44 -0000	1.122
+++ docs/libcurl/curl_easy_setopt.3	23 Aug 2005 20:59:20 -0000
@@ -687,6 +687,11 @@
 Enforce HTTP 1.0 requests.
 .IP CURL_HTTP_VERSION_1_1
 Enforce HTTP 1.1 requests.
+.IP CURLOPT_IGNORE_CONTENT_LENGTH
+Ignore the Content-Length header. This is useful for Apache 1.x which will
+report incorrect content length for files over 2 gigabytes. If this option
+is used, curl will not be able to accurately report progress, and will
+simply stop the download when the server ends the connection.
 .RE
 .SH FTP OPTIONS
 .IP CURLOPT_FTPPORT
Index: include/curl/curl.h
===================================================================
RCS file: /cvsroot/curl/curl/include/curl/curl.h,v
retrieving revision 1.283
diff -u -r1.283 curl.h
--- include/curl/curl.h	17 Aug 2005 09:12:08 -0000	1.283
+++ include/curl/curl.h	23 Aug 2005 20:59:20 -0000
@@ -893,6 +893,9 @@
   /* feed cookies into cookie engine */
   CINIT(COOKIELIST, OBJECTPOINT, 135),
 
+  /* ignore Content-Length */
+  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
+
   CURLOPT_LASTENTRY /* the last unused */
 } CURLoption;
 
Index: lib/transfer.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/transfer.c,v
retrieving revision 1.283
diff -u -r1.283 transfer.c
--- lib/transfer.c	17 Aug 2005 08:55:43 -0000	1.283
+++ lib/transfer.c	23 Aug 2005 20:59:20 -0000
@@ -718,7 +718,7 @@
                the header completely if we get a 416 response as then we're
                resuming a document that we don't get, and this header contains
                info about the true size of the document we didn't get now. */
-            if (!k->ignorecl &&
+            if (!k->ignorecl && !data->set.ignorecl &&
                 checkprefix("Content-Length:", k->p)) {
               contentlength = curlx_strtoofft(k->p+15, NULL, 10);
               if (data->set.max_filesize &&
Index: lib/url.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/url.c,v
retrieving revision 1.474
diff -u -r1.474 url.c
--- lib/url.c	17 Aug 2005 08:55:43 -0000	1.474
+++ lib/url.c	23 Aug 2005 20:59:21 -0000
@@ -1443,6 +1443,10 @@
     data->set.ftp_account = va_arg(param, char *);
     break;
 
+  case CURLOPT_IGNORE_CONTENT_LENGTH:
+    data->set.ignorecl = va_arg(param, long)?TRUE:FALSE;
+    break;
+
   default:
     /* unknown tag and its companion, just ignore: */
     result = CURLE_FAILED_INIT; /* correct this */
Index: lib/urldata.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/urldata.h,v
retrieving revision 1.268
diff -u -r1.268 urldata.h
--- lib/urldata.h	12 Jul 2005 18:15:34 -0000	1.268
+++ lib/urldata.h	23 Aug 2005 20:59:21 -0000
@@ -1068,6 +1068,7 @@
   bool global_dns_cache; /* subject for future removal */
   bool tcp_nodelay;      /* whether to enable TCP_NODELAY or not */
 
+  bool ignorecl;         /* ignore content length */
 };
 
 /*
Index: src/main.c
===================================================================
RCS file: /cvsroot/curl/curl/src/main.c,v
retrieving revision 1.328
diff -u -r1.328 main.c
--- src/main.c	16 Aug 2005 07:32:50 -0000	1.328
+++ src/main.c	23 Aug 2005 20:59:22 -0000
@@ -356,6 +356,8 @@
   struct curl_slist *tp_postquote;
   struct curl_slist *tp_prequote;
   char *ftp_account; /* for ACCT */
+
+  bool ignorecl; /* --ignore-content-length */
 };
 
 #define WARN_PREFIX "Warning: "
@@ -514,6 +516,7 @@
     " -G/--get           Send the -d data with a HTTP GET (H)",
     " -h/--help          This help text",
     " -H/--header <line> Custom header to pass to server (H)",
+    "    --ignore-content-length  Ignore the HTTP Content-Length header",
     " -i/--include       Include protocol headers in the output (H/F)",
     " -I/--head          Show document info only",
     " -j/--junk-session-cookies Ignore session cookies read from file (H)",
@@ -1309,6 +1312,7 @@
     {"$m", "ftp-account", TRUE},
     {"$n", "proxy-anyauth", FALSE},
     {"$o", "trace-time", FALSE},
+    {"$p", "ignore-content-length", FALSE},
 
     {"0", "http1.0",     FALSE},
     {"1", "tlsv1",       FALSE},
@@ -1702,6 +1706,9 @@
       case 'o': /* --trace-time */
         config->tracetime ^= TRUE;
         break;
+      case 'p': /* --ignore-content-length */
+        config->ignorecl ^= TRUE;
+        break;
       }
       break;
     case '#': /* --progress-bar */
@@ -3896,6 +3903,8 @@
         curl_easy_setopt(curl, CURLOPT_SOURCE_QUOTE, config->tp_quote);
         curl_easy_setopt(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
 
+        curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, config->ignorecl);
+
         retry_numretries = config->req_retry;
 
         retrystart = curlx_tvnow();

