diff -rupN wget-1.21.3/src/ftp.c wget-1.21.3-limitsize/src/ftp.c
--- wget-1.21.3/src/ftp.c	2022-02-26 17:11:26.000000000 +0200
+++ wget-1.21.3-limitsize/src/ftp.c	2022-10-23 11:56:14.210204618 +0300
@@ -2259,6 +2259,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.21.3/src/http.c wget-1.21.3-limitsize/src/http.c
--- wget-1.21.3/src/http.c	2022-02-26 16:47:42.000000000 +0200
+++ wget-1.21.3-limitsize/src/http.c	2022-10-23 12:06:37.901444548 +0300
@@ -4027,6 +4027,13 @@ gethttp (const struct url *u, struct url
         }
     }
 
+  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))
@@ -4037,6 +4044,7 @@ gethttp (const struct url *u, struct url
          (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.21.3/src/init.c wget-1.21.3-limitsize/src/init.c
--- wget-1.21.3/src/init.c	2022-02-26 16:47:42.000000000 +0200
+++ wget-1.21.3-limitsize/src/init.c	2022-10-23 11:57:06.910853471 +0300
@@ -250,6 +250,7 @@ static const struct {
   { "keepbadhash",      &opt.keep_badhash,      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.21.3/src/main.c wget-1.21.3-limitsize/src/main.c
--- wget-1.21.3/src/main.c	2022-02-26 16:56:09.000000000 +0200
+++ wget-1.21.3-limitsize/src/main.c	2022-10-23 11:57:48.584082724 +0300
@@ -362,6 +362,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 },
@@ -710,6 +711,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.21.3/src/options.h wget-1.21.3-limitsize/src/options.h
--- wget-1.21.3/src/options.h	2022-02-26 16:47:42.000000000 +0200
+++ wget-1.21.3-limitsize/src/options.h	2022-10-23 11:58:08.812719455 +0300
@@ -171,6 +171,9 @@ struct options
 
   wgint limit_rate;             /* Limit the download rate to this
                                    many bps. */
+
+  wgint limit_size;             /* Limit the download file size. */
+
   wgint quota;                  /* Maximum file size to download and
                                    store. */
 
