update wget to 1.21.3

This commit is contained in:
xingwei 2023-02-03 08:23:51 +00:00
parent f82071d2fd
commit 0887af0fe9
7 changed files with 390 additions and 65 deletions

View File

@ -0,0 +1,172 @@
diff --git a/NEWS b/NEWS
index d23ae95..aa3247f 100644
--- a/NEWS
+++ b/NEWS
@@ -935,7 +935,7 @@ distributed with Wget.
** Compiles on pre-ANSI compilers.
-** Global wgetrc now goes to /usr/local/etc (i.e. $sysconfdir).
+** Global wgetrc now goes to /etc (i.e. $sysconfdir).
** Lots of bugfixes.
@@ -998,7 +998,7 @@ Emacs, standalone info, or converted to HTML, dvi or postscript.
** Fixed a long-standing bug, so that Wget now works over SLIP
connections.
-** You can have a system-wide wgetrc (/usr/local/lib/wgetrc by
+** You can have a system-wide wgetrc (/etc/wgetrc by
default). Settings in $HOME/.wgetrc override the global ones, of
course :-)
diff --git a/README b/README
index 692e1c6..38231c9 100644
--- a/README
+++ b/README
@@ -33,7 +33,7 @@ for socks.
Most of the features are configurable, either through command-line
options, or via initialization file .wgetrc. Wget allows you to
-install a global startup file (/usr/local/etc/wgetrc by default) for
+install a global startup file (/etc/wgetrc by default) for
site settings.
Wget works under almost all Unix variants in use today and, unlike
diff --git a/doc/sample.wgetrc b/doc/sample.wgetrc
index c0d0779..9a73ada 100644
--- a/doc/sample.wgetrc
+++ b/doc/sample.wgetrc
@@ -10,7 +10,7 @@
## Or online here:
## https://www.gnu.org/software/wget/manual/wget.html#Startup-File
##
-## Wget initialization file can reside in /usr/local/etc/wgetrc
+## Wget initialization file can reside in /etc/wgetrc
## (global, for all users) or $HOME/.wgetrc (for a single user).
##
## To use the settings in this file, you will have to uncomment them,
@@ -22,7 +22,7 @@
##
-## Global settings (useful for setting up in /usr/local/etc/wgetrc).
+## Global settings (useful for setting up in /etc/wgetrc).
## Think well before you change them, since they may reduce wget's
## functionality, and make it behave contrary to the documentation:
##
diff --git a/doc/sample.wgetrc.munged_for_texi_inclusion b/doc/sample.wgetrc.munged_for_texi_inclusion
index 3c7f2f4..521ef16 100644
--- a/doc/sample.wgetrc.munged_for_texi_inclusion
+++ b/doc/sample.wgetrc.munged_for_texi_inclusion
@@ -10,7 +10,7 @@
## Or online here:
## https://www.gnu.org/software/wget/manual/wget.html#Startup-File
##
-## Wget initialization file can reside in /usr/local/etc/wgetrc
+## Wget initialization file can reside in /etc/wgetrc
## (global, for all users) or $HOME/.wgetrc (for a single user).
##
## To use the settings in this file, you will have to uncomment them,
@@ -22,7 +22,7 @@
##
-## Global settings (useful for setting up in /usr/local/etc/wgetrc).
+## Global settings (useful for setting up in /etc/wgetrc).
## Think well before you change them, since they may reduce wget's
## functionality, and make it behave contrary to the documentation:
##
diff --git a/doc/wget.info b/doc/wget.info
index 40ce0d4..89c6652 100644
--- a/doc/wget.info
+++ b/doc/wget.info
@@ -109,7 +109,7 @@ retrieval through HTTP proxies.
• Most of the features are fully configurable, either through command
line options, or via the initialization file .wgetrc (*note
Startup File::). Wget allows you to define “global” startup files
- (/usr/local/etc/wgetrc by default) for site settings. You can
+ (/etc/wgetrc by default) for site settings. You can
also specify the location of a startup file with the config
option. To disable the reading of config files, use no-config.
If both config and no-config are given, no-config is ignored.
@@ -2825,8 +2825,8 @@ File: wget.info, Node: Wgetrc Location, Next: Wgetrc Syntax, Prev: Startup Fi
===================
When initializing, Wget will look for a “global” startup file,
-/usr/local/etc/wgetrc by default (or some prefix other than
-/usr/local, if Wget was not installed there) and read commands from
+/etc/wgetrc by default (or some prefix other than
+/etc, if Wget was not installed there) and read commands from
there, if it exists.
Then it will look for the users file. If the environmental variable
@@ -2837,7 +2837,7 @@ further attempts will be made.
The fact that users settings are loaded after the system-wide ones
means that in case of collision users wgetrc _overrides_ the
-system-wide wgetrc (in /usr/local/etc/wgetrc by default). Fascist
+system-wide wgetrc (in /etc/wgetrc by default). Fascist
admins, away!

@@ -3380,7 +3380,7 @@ its line.
## Or online here:
## https://www.gnu.org/software/wget/manual/wget.html#Startup-File
##
- ## Wget initialization file can reside in /usr/local/etc/wgetrc
+ ## Wget initialization file can reside in /etc/wgetrc
## (global, for all users) or $HOME/.wgetrc (for a single user).
##
## To use the settings in this file, you will have to uncomment them,
@@ -3392,7 +3392,7 @@ its line.
##
- ## Global settings (useful for setting up in /usr/local/etc/wgetrc).
+ ## Global settings (useful for setting up in /etc/wgetrc).
## Think well before you change them, since they may reduce wget's
## functionality, and make it behave contrary to the documentation:
##
diff --git a/doc/wget.texi b/doc/wget.texi
index eaf6b38..608d008 100644
--- a/doc/wget.texi
+++ b/doc/wget.texi
@@ -190,7 +190,7 @@ gauge can be customized to your preferences.
Most of the features are fully configurable, either through command line
options, or via the initialization file @file{.wgetrc} (@pxref{Startup
File}). Wget allows you to define @dfn{global} startup files
-(@file{/usr/local/etc/wgetrc} by default) for site settings. You can also
+(@file{/etc/wgetrc} by default) for site settings. You can also
specify the location of a startup file with the --config option.
To disable the reading of config files, use --no-config.
If both --config and --no-config are given, --no-config is ignored.
@@ -199,7 +199,7 @@ If both --config and --no-config are given, --no-config is ignored.
@ignore
@c man begin FILES
@table @samp
-@item /usr/local/etc/wgetrc
+@item /etc/wgetrc
Default location of the @dfn{global} startup file.
@item .wgetrc
@@ -3154,8 +3154,8 @@ commands.
@cindex location of wgetrc
When initializing, Wget will look for a @dfn{global} startup file,
-@file{/usr/local/etc/wgetrc} by default (or some prefix other than
-@file{/usr/local}, if Wget was not installed there) and read commands
+@file{/etc/wgetrc} by default (or some prefix other than
+@file{/etc}, if Wget was not installed there) and read commands
from there, if it exists.
Then it will look for the user's file. If the environmental variable
@@ -3166,7 +3166,7 @@ If @code{WGETRC} is not set, Wget will try to load @file{$HOME/.wgetrc}.
The fact that user's settings are loaded after the system-wide ones
means that in case of collision user's wgetrc @emph{overrides} the
-system-wide wgetrc (in @file{/usr/local/etc/wgetrc} by default).
+system-wide wgetrc (in @file{/etc/wgetrc} by default).
Fascist admins, away!
@node Wgetrc Syntax, Wgetrc Commands, Wgetrc Location, Startup File

View File

@ -1,39 +0,0 @@
From aecf5fbf1bf05e91c4900a814a12dc91a50dc788 Mon Sep 17 00:00:00 2001
From: Darshit Shah <darnir@gnu.org>
Date: Fri, 8 Oct 2021 20:34:46 +0200
Subject: [PATCH] * ftp.c (ftp_loop_internal): Fix computation of
total_downloaded_bytes
When continuing a FTP download, or not starting one because the file is
already fully retrieved, don't include the size of the file in the
total_downloaded_bytes. Only the actual amount of data retrieved over
the network should be considered there.
Fixes: #61277
Reported-By: Michal Ruprich <formaiko>
---
src/ftp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ftp.c b/src/ftp.c
index a1fcaa50..e821b0f3 100644
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -2083,7 +2083,7 @@ ftp_loop_internal (struct url *u, struct url *original_url, struct fileinfo *f,
/* --dont-remove-listing was specified, so do count this towards the
number of bytes and files downloaded. */
{
- total_downloaded_bytes += qtyread;
+ total_downloaded_bytes += (qtyread - restval);
numurls++;
}
@@ -2098,7 +2098,7 @@ ftp_loop_internal (struct url *u, struct url *original_url, struct fileinfo *f,
downloaded if they're going to be deleted. People seeding proxies,
for instance, may want to know how many bytes and files they've
downloaded through it. */
- total_downloaded_bytes += qtyread;
+ total_downloaded_bytes += (qtyread - restval);
numurls++;
if (opt.delete_after && !input_file_url (opt.input_filename))

View File

@ -1,21 +0,0 @@
diff --git a/src/gnutls.c b/src/gnutls.c
index 0ecf2c81..81fe9518 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -99,7 +99,6 @@ static gnutls_certificate_credentials_t credentials;
bool
ssl_init (void)
{
- fprintf(stderr,"SSL_INIT\n");
/* Becomes true if GnuTLS is initialized. */
const char *ca_directory;
DIR *dir;
@@ -237,8 +236,6 @@ cert to be of the same type.\n"));
void
ssl_cleanup (void)
{
- fprintf(stderr,"SSL_CLEANUP\n");
-
if (!ssl_initialized)
return;

View File

@ -0,0 +1,207 @@
diff --git a/src/hsts.c b/src/hsts.c
index 0a014401..72c5e936 100644
--- a/src/hsts.c
+++ b/src/hsts.c
@@ -61,8 +61,8 @@ struct hsts_kh {
};
struct hsts_kh_info {
- time_t created;
- time_t max_age;
+ int64_t created;
+ int64_t max_age;
bool include_subdomains;
};
@@ -166,7 +166,7 @@ end:
static bool
hsts_new_entry_internal (hsts_store_t store,
const char *host, int port,
- time_t created, time_t max_age,
+ int64_t created, int64_t max_age,
bool include_subdomains,
bool check_validity,
bool check_expired,
@@ -216,21 +216,21 @@ bail:
static bool
hsts_add_entry (hsts_store_t store,
const char *host, int port,
- time_t max_age, bool include_subdomains)
+ int64_t max_age, bool include_subdomains)
{
- time_t t = time (NULL);
+ int64_t t = (int64_t) time (NULL);
/* It might happen time() returned -1 */
- return (t == (time_t)(-1) ?
+ return (t == -1) ?
false :
- hsts_new_entry_internal (store, host, port, t, max_age, include_subdomains, false, true, false));
+ hsts_new_entry_internal (store, host, port, t, max_age, include_subdomains, false, true, false);
}
/* Creates a new entry, unless an identical one already exists. */
static bool
hsts_new_entry (hsts_store_t store,
const char *host, int port,
- time_t created, time_t max_age,
+ int64_t created, int64_t max_age,
bool include_subdomains)
{
return hsts_new_entry_internal (store, host, port, created, max_age, include_subdomains, true, true, true);
@@ -245,7 +245,7 @@ hsts_remove_entry (hsts_store_t store, struct hsts_kh *kh)
static bool
hsts_store_merge (hsts_store_t store,
const char *host, int port,
- time_t created, time_t max_age,
+ int64_t created, int64_t max_age,
bool include_subdomains)
{
enum hsts_kh_match match_type = NO_MATCH;
@@ -276,11 +276,11 @@ hsts_read_database (hsts_store_t store, FILE *fp, bool merge_with_existing_entri
size_t len = 0;
int items_read;
bool result = false;
- bool (*func)(hsts_store_t, const char *, int, time_t, time_t, bool);
+ bool (*func)(hsts_store_t, const char *, int, int64_t, int64_t, bool);
char host[256];
int port;
- time_t created, max_age;
+ int64_t created, max_age;
int include_subdomains;
func = (merge_with_existing_entries ? hsts_store_merge : hsts_new_entry);
@@ -326,10 +326,9 @@ hsts_store_dump (hsts_store_t store, FILE *fp)
struct hsts_kh *kh = (struct hsts_kh *) it.key;
struct hsts_kh_info *khi = (struct hsts_kh_info *) it.value;
- if (fprintf (fp, "%s\t%d\t%d\t%lu\t%lu\n",
+ if (fprintf (fp, "%s\t%d\t%d\t%" PRId64 "\t%" PRId64 "\n",
kh->host, kh->explicit_port, khi->include_subdomains,
- (unsigned long) khi->created,
- (unsigned long) khi->max_age) < 0)
+ khi->created, khi->max_age) < 0)
{
logprintf (LOG_ALWAYS, "Could not write the HSTS database correctly.\n");
break;
@@ -439,7 +438,7 @@ hsts_match (hsts_store_t store, struct url *u)
bool
hsts_store_entry (hsts_store_t store,
enum url_scheme scheme, const char *host, int port,
- time_t max_age, bool include_subdomains)
+ int64_t max_age, bool include_subdomains)
{
bool result = false;
enum hsts_kh_match match = NO_MATCH;
@@ -464,9 +463,9 @@ hsts_store_entry (hsts_store_t store,
* 'created' field too. The RFC also states that we have to
* update the entry each time we see HSTS header.
* See also Section 11.2. */
- time_t t = time (NULL);
+ int64_t t = (int64_t) time (NULL);
- if (t != (time_t)(-1) && t != entry->created)
+ if (t != -1 && t != entry->created)
{
entry->created = t;
entry->max_age = max_age;
@@ -792,7 +791,7 @@ test_hsts_read_database (void)
hsts_store_t table;
char *file = NULL;
FILE *fp = NULL;
- time_t created = time(NULL) - 10;
+ int64_t created = time(NULL) - 10;
if (opt.homedir)
{
@@ -801,9 +800,9 @@ test_hsts_read_database (void)
if (fp)
{
fputs ("# dummy comment\n", fp);
- fprintf (fp, "foo.example.com\t0\t1\t%lu\t123\n",(unsigned long) created);
- fprintf (fp, "bar.example.com\t0\t0\t%lu\t456\n", (unsigned long) created);
- fprintf (fp, "test.example.com\t8080\t0\t%lu\t789\n", (unsigned long) created);
+ fprintf (fp, "foo.example.com\t0\t1\t%" PRId64 "\t123\n", created);
+ fprintf (fp, "bar.example.com\t0\t0\t%" PRId64 "\t456\n", created);
+ fprintf (fp, "test.example.com\t8080\t0\t%" PRId64 "\t789\n", created);
fclose (fp);
table = hsts_store_open (file);
diff --git a/src/hsts.h b/src/hsts.h
index 6ecd5060..be048944 100644
--- a/src/hsts.h
+++ b/src/hsts.h
@@ -46,7 +46,7 @@ bool hsts_store_has_changed (hsts_store_t);
bool hsts_store_entry (hsts_store_t,
enum url_scheme, const char *, int,
- time_t, bool);
+ int64_t, bool);
bool hsts_match (hsts_store_t, struct url *);
#endif /* HAVE_HSTS */
diff --git a/src/http.c b/src/http.c
index 2ecc11c9..6ccfc3a0 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1300,7 +1300,7 @@ parse_content_disposition (const char *hdr, char **filename)
#ifdef HAVE_HSTS
static bool
-parse_strict_transport_security (const char *header, time_t *max_age, bool *include_subdomains)
+parse_strict_transport_security (const char *header, int64_t *max_age, bool *include_subdomains)
{
param_token name, value;
const char *c_max_age = NULL;
@@ -1330,7 +1330,7 @@ parse_strict_transport_security (const char *header, time_t *max_age, bool *incl
* Also, time_t is normally defined as a long, so this should not break.
*/
if (max_age)
- *max_age = (time_t) strtol (c_max_age, NULL, 10);
+ *max_age = (int64_t) strtoll (c_max_age, NULL, 10);
if (include_subdomains)
*include_subdomains = is;
@@ -3184,9 +3184,6 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
#else
extern hsts_store_t hsts_store;
#endif
- const char *hsts_params;
- time_t max_age;
- bool include_subdomains;
#endif
int sock = -1;
@@ -3674,21 +3671,24 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
#ifdef HAVE_HSTS
if (opt.hsts && hsts_store)
{
- hsts_params = resp_header_strdup (resp, "Strict-Transport-Security");
+ int64_t max_age;
+ const char *hsts_params = resp_header_strdup (resp, "Strict-Transport-Security");
+ bool include_subdomains;
+
if (parse_strict_transport_security (hsts_params, &max_age, &include_subdomains))
{
/* process strict transport security */
if (hsts_store_entry (hsts_store, u->scheme, u->host, u->port, max_age, include_subdomains))
- DEBUGP(("Added new HSTS host: %s:%u (max-age: %lu, includeSubdomains: %s)\n",
+ DEBUGP(("Added new HSTS host: %s:%" PRIu32 " (max-age: %" PRId64 ", includeSubdomains: %s)\n",
u->host,
- (unsigned) u->port,
- (unsigned long) max_age,
+ (uint32_t) u->port,
+ max_age,
(include_subdomains ? "true" : "false")));
else
- DEBUGP(("Updated HSTS host: %s:%u (max-age: %lu, includeSubdomains: %s)\n",
+ DEBUGP(("Updated HSTS host: %s:%" PRIu32 " (max-age: %" PRId64 ", includeSubdomains: %s)\n",
u->host,
- (unsigned) u->port,
- (unsigned long) max_age,
+ (uint32_t) u->port,
+ max_age,
(include_subdomains ? "true" : "false")));
}
xfree (hsts_params);

Binary file not shown.

BIN
wget-1.21.3.tar.gz Normal file

Binary file not shown.

View File

@ -1,16 +1,16 @@
Name: wget Name: wget
Version: 1.21.2 Version: 1.21.3
Release: 2 Release: 1
Summary: A package for retrieving files using HTTP, HTTPS, FTP and FTPS the most widely-used Internet protocols. Summary: A package for retrieving files using HTTP, HTTPS, FTP and FTPS the most widely-used Internet protocols.
License: GPLv3+ License: GPLv3+
Url: http://www.gnu.org/software/wget/ Url: http://www.gnu.org/software/wget/
Source: https://ftp.gnu.org/gnu/wget/wget-%{version}.tar.gz Source: https://ftp.gnu.org/gnu/wget/wget-%{version}.tar.gz
Patch0: backport-wget-1.21-ssl-init-output.patch Patch0: backport-wget-1.17-path.patch
Patch1: backport-wget-1.21-segfault.patch Patch1: backport-wget-1.21.3-hsts-32bit.patch
Provides: webclient bundled(gnulib) Provides: webclient bundled(gnulib)
BuildRequires: perl-HTTP-Daemon python3 libuuid-devel perl-podlators libpsl-devel libmetalink-devel BuildRequires: make perl-HTTP-Daemon python3 libuuid-devel perl-podlators libpsl-devel libmetalink-devel
BuildRequires: gnutls-devel pkgconfig texinfo gettext autoconf libidn2-devel gpgme-devel zlib-devel BuildRequires: gnutls-devel pkgconfig texinfo gettext autoconf libidn2-devel gpgme-devel zlib-devel
BuildRequires: gcc BuildRequires: gcc
@ -55,6 +55,12 @@ make check
%{_infodir}/* %{_infodir}/*
%changelog %changelog
* Fri Feb 03 2023 xingwei <xingwei14@h-partners.com> - 1.21.3-1
- Type:requirements
- ID:NA
- SUG:NA
- DESC:update wget to 1.21.3
* Sat Oct 22 2022 gaihuiying <eaglegai@163.com> - 1.21.2-2 * Sat Oct 22 2022 gaihuiying <eaglegai@163.com> - 1.21.2-2
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA