diff -rupN wget-1.18/src/ftp.c wget-1.18-limitsize/src/ftp.c
--- wget-1.18/src/ftp.c	2016-06-09 19:10:14.000000000 +0300
+++ wget-1.18-limitsize/src/ftp.c	2017-11-28 14:14:21.880031373 +0200
@@ -2209,6 +2209,14 @@ ftp_retrieve_list (struct url *u, struct
       err = RETROK;
 
       dlthis = true;
+
+      if ((f->type == FT_PLAINFILE) && opt.limit_size && (f->size > opt.limit_size))
+      {
+          logprintf (LOG_VERBOSE, _("%s -- remote file size (%s) "), quote (con->target), human_readable(f->size, 10, 1));
+          logprintf (LOG_VERBOSE, _("is bigger than limit-size (%s) option -- not retrieving.\n"), human_readable(opt.limit_size, 10, 1));
+          dlthis = false;
+      }
+
       if (opt.timestamping && f->type == FT_PLAINFILE)
         {
           struct_stat st;
diff -rupN wget-1.18/src/http.c wget-1.18-limitsize/src/http.c
--- wget-1.18/src/http.c	2016-06-09 19:10:14.000000000 +0300
+++ wget-1.18-limitsize/src/http.c	2017-11-28 14:14:06.691864183 +0200
@@ -3622,6 +3622,14 @@ gethttp (struct url *u, struct http_stat
         }
     }
 
+  if (opt.limit_size && (contlen != -1) && (contlen > opt.limit_size))
+  {
+      logprintf (LOG_VERBOSE, _("%s -- remote file size (%s) "), quote (u->path), human_readable(contlen, 10, 1));
+      logprintf (LOG_VERBOSE, _("is bigger than limit-size (%s) option -- not retrieving.\n"), human_readable(opt.limit_size, 10, 1));
+      goto mylabel;
+  };
+
+
   if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE
       || (!opt.timestamping && hs->restval > 0 && statcode == HTTP_STATUS_OK
           && contrange == 0 && contlen >= 0 && hs->restval >= contlen))
@@ -3632,6 +3640,7 @@ gethttp (struct url *u, struct http_stat
          (or 200 with a <= Content-Length.  */
       logputs (LOG_VERBOSE, _("\
 \n    The file is already fully retrieved; nothing to do.\n\n"));
+mylabel:
       /* In case the caller inspects. */
       hs->len = contlen;
       hs->res = 0;
diff -rupN wget-1.18/src/init.c wget-1.18-limitsize/src/init.c
--- wget-1.18/src/init.c	2016-06-03 14:55:13.000000000 +0300
+++ wget-1.18-limitsize/src/init.c	2017-11-28 14:14:37.092198588 +0200
@@ -239,6 +239,7 @@ static const struct {
   { "iri",              &opt.enable_iri,        cmd_boolean },
   { "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
   { "limitrate",        &opt.limit_rate,        cmd_bytes },
+  { "limitsize",        &opt.limit_size,        cmd_bytes },
   { "loadcookies",      &opt.cookies_input,     cmd_file },
   { "localencoding",    &opt.locale,            cmd_string },
   { "logfile",          &opt.lfilename,         cmd_file },
diff -rupN wget-1.18/src/main.c wget-1.18-limitsize/src/main.c
--- wget-1.18/src/main.c	2016-06-06 18:36:04.000000000 +0300
+++ wget-1.18-limitsize/src/main.c	2017-11-28 14:15:13.748600583 +0200
@@ -346,6 +346,7 @@ static struct cmdline_option option_data
     { "keep-session-cookies", 0, OPT_BOOLEAN, "keepsessioncookies", -1 },
     { "level", 'l', OPT_VALUE, "reclevel", -1 },
     { "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
+    { "limit-size", 0, OPT_VALUE, "limitsize", -1 },
     { "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
     { "local-encoding", 0, OPT_VALUE, "localencoding", -1 },
     { "rejected-log", 0, OPT_VALUE, "rejectedlog", -1 },
@@ -670,6 +671,8 @@ Download:\n"),
     N_("\
        --limit-rate=RATE           limit download rate to RATE\n"),
     N_("\
+       --limit-size=SIZE           limit download file size to SIZE.\n"),
+    N_("\
        --no-dns-cache              disable caching DNS lookups\n"),
     N_("\
        --restrict-file-names=OS    restrict chars in file names to ones OS allows\n"),
diff -rupN wget-1.18/src/options.h wget-1.18-limitsize/src/options.h
--- wget-1.18/src/options.h	2016-06-03 14:55:13.000000000 +0300
+++ wget-1.18-limitsize/src/options.h	2017-11-28 14:15:29.140769003 +0200
@@ -166,6 +166,9 @@ struct options
 
   wgint limit_rate;             /* Limit the download rate to this
                                    many bps. */
+
+  wgint limit_size;		/* Limit the download file size. */
+
   SUM_SIZE_INT quota;           /* Maximum file size to download and
 
