Sync from SUSE:SLFO:Main wget revision d408879d0a57d03267ff70421f1ede64

This commit is contained in:
Adrian Schröter 2024-05-04 01:53:05 +02:00
commit 89a661ef1c
13 changed files with 3094 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,10 @@
Index: wget-1.21.4/util/rmold.pl
===================================================================
--- wget-1.21.4.orig/util/rmold.pl
+++ wget-1.21.4/util/rmold.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/bin/perl -w
# Copyright (C) 1995-1997, 2007-2011, 2015, 2018-2023 Free Software
# Foundation, Inc.

View File

@ -0,0 +1,13 @@
--- src/openssl.c.orig
+++ src/openssl.c
@@ -241,7 +241,9 @@
/* The OpenSSL library can handle renegotiations automatically, so
tell it to do so. */
SSL_CTX_set_mode (ssl_ctx, SSL_MODE_AUTO_RETRY);
-
+#ifdef SSL_OP_NO_COMPRESSION
+ SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_COMPRESSION);
+#endif
return true;
error:

BIN
wget-1.21.4.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

17
wget-1.21.4.tar.gz.sig Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJDBAABCAAtFiEEa5j2N9h5xSNuJ3xcZP+QqujHCvkFAmRcPzMPHGdwZ0BkYXJu
aXIubmV0AAoJEGT/kKroxwr5NhIP/1cuX5RmolNwO3wdsO+uLsAKiYW9FbIf7JuT
wPuBAgtzSazyUrx/S4apRBYERuMhEVLefQvY8xKhZgnqsw+puD7VLjsjFkqr78BU
3M0AMDu/QIWzv5mLazmIlZc9ArimqCEyAlKRpoiF1kud+9moE62/uxcwishcpIe1
CvUfqy1R6o7QsHmmKoIU1p8LTzqP/wg28VI+Yw2hRKCD5aIpPHL1bkv13Ec7jFsi
J2y2ntUVQiTNO+ssfYPu3jMb+jNIP6wqG8zGKtBCEjJ/MuLNvSNbXg5Sthwd88id
jRUqaw1ui1pPJWHEkk/Aqm6WeqzPy6u88frWHDCQVtFEo+2rPdtpSdfCc1myIpa7
D1FxWr+DKGXakUtlQdmkpBfmJkNsX2GjZBzOg6qRbr/wRbYWgc4pQHgrFZxWM8ZB
THl4+1IBA4mTq3HRFwKtH43BEIGQLBjHN+RE6F25YesB9og7uhjxj17WkHRyD+Sr
L7CO9O3AP0oM22qFNwdQGHDr1XIIktYln2Jp/EaZwEtjBDO6Fn9B+6T2UpjfeRU9
bK6TaH6R4ws6uK87HThwdQBxpXi+Ueio49GwQzqWxGtm/nHdekTSBgJGStpOTMJI
9yD+NlH+Cc/VHGloEzO0PFtDpBq7bB9cRkuru9bMz80aSBfVaUdX2fdGONYbbj1a
D93jyajc
=zquD
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,118 @@
Index: wget-1.21.1/src/http.c
===================================================================
--- wget-1.21.1.orig/src/http.c
+++ wget-1.21.1/src/http.c
@@ -3155,6 +3155,33 @@ fail:
}
#endif /* HAVE_METALINK */
+/*
+ * Check if the corresponding header line should not
+ * be sent after a redirect
+ */
+static inline int
+unredirectable_headerline(char *line)
+{
+ static struct {
+ size_t len;
+ char *name;
+ } field_name[] = {
+ { 14, "Authorization:" },
+ { 7, "Cookie:" },
+ { 0, NULL }
+ };
+ int i;
+
+ /*
+ * Note: According to RFC 2616, Field names are case-insensitive.
+ */
+ for (i = 0; field_name[i].name != NULL; i++)
+ if (strncasecmp(line, field_name[i].name, field_name[i].len) == 0)
+ return 1;
+
+ return 0;
+}
+
/* Retrieve a document through HTTP protocol. It recognizes status
code, and correctly handles redirections. It closes the network
socket. If it receives an error from the functions below it, it
@@ -3167,7 +3194,7 @@ fail:
server, and u->url will be requested. */
static uerr_t
gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
- int *dt, struct url *proxy, struct iri *iri, int count)
+ int *dt, struct url *proxy, struct iri *iri, int count, int location_changed)
{
struct request *req = NULL;
@@ -3314,7 +3341,16 @@ gethttp (const struct url *u, struct url
{
int i;
for (i = 0; opt.user_headers[i]; i++)
- request_set_user_header (req, opt.user_headers[i]);
+ {
+ /*
+ * IF we have been redirected
+ * AND the user-supplied header line should NOT be sent to the new host
+ * DO NOT append that header line
+ */
+ if (location_changed && unredirectable_headerline(opt.user_headers[i]))
+ continue;
+ request_set_user_header (req, opt.user_headers[i]);
+ }
}
proxyauth = NULL;
@@ -4232,7 +4268,7 @@ check_retry_on_http_error (const int sta
uerr_t
http_loop (const struct url *u, struct url *original_url, char **newloc,
char **local_file, const char *referer, int *dt, struct url *proxy,
- struct iri *iri)
+ struct iri *iri, int location_changed)
{
int count;
bool got_head = false; /* used for time-stamping and filename detection */
@@ -4424,7 +4460,7 @@ http_loop (const struct url *u, struct u
*dt &= ~SEND_NOCACHE;
/* Try fetching the document, or at least its head. */
- err = gethttp (u, original_url, &hstat, dt, proxy, iri, count);
+ err = gethttp (u, original_url, &hstat, dt, proxy, iri, count, location_changed);
/* Time? */
tms = datetime_str (time (NULL));
Index: wget-1.21.1/src/http.h
===================================================================
--- wget-1.21.1.orig/src/http.h
+++ wget-1.21.1/src/http.h
@@ -36,7 +36,7 @@ as that of the covered work. */
struct url;
uerr_t http_loop (const struct url *, struct url *, char **, char **, const char *,
- int *, struct url *, struct iri *);
+ int *, struct url *, struct iri *, int);
void save_cookies (void);
void http_cleanup (void);
time_t http_atotm (const char *);
Index: wget-1.21.1/src/retr.c
===================================================================
--- wget-1.21.1.orig/src/retr.c
+++ wget-1.21.1/src/retr.c
@@ -886,7 +886,7 @@ retrieve_url (struct url * orig_parsed,
{
uerr_t result;
char *url;
- bool location_changed;
+ bool location_changed = 0;
bool iri_fallbacked = 0;
int dummy;
char *mynewloc, *proxy;
@@ -985,7 +985,7 @@ retrieve_url (struct url * orig_parsed,
}
#endif
result = http_loop (u, orig_parsed, &mynewloc, &local_file, refurl, dt,
- proxy_url, iri);
+ proxy_url, iri, location_changed);
}
else if (u->scheme == SCHEME_FTP
#ifdef HAVE_SSL

30
wget-errno-clobber.patch Normal file
View File

@ -0,0 +1,30 @@
Index: wget-1.19.2/src/http.c
===================================================================
--- wget-1.19.2.orig/src/http.c 2017-10-26 17:30:08.000000000 +0200
+++ wget-1.19.2/src/http.c 2017-10-27 17:59:48.659093393 +0200
@@ -1524,6 +1524,7 @@ persistent_available_p (const char *host
active, registered connection". */
#define CLOSE_FINISH(fd) do { \
+ int errno_sav = errno; \
if (!keep_alive) \
{ \
if (pconn_active && (fd) == pconn.socket) \
@@ -1532,14 +1533,17 @@ persistent_available_p (const char *host
fd_close (fd); \
fd = -1; \
} \
+ errno = errno_sav; \
} while (0)
#define CLOSE_INVALIDATE(fd) do { \
+ int errno_sav = errno; \
if (pconn_active && (fd) == pconn.socket) \
invalidate_persistent (); \
else \
fd_close (fd); \
fd = -1; \
+ errno = errno_sav; \
} while (0)
typedef enum

17
wget-fix-pod-syntax.diff Normal file
View File

@ -0,0 +1,17 @@
---
doc/texi2pod.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: wget-1.15/doc/texi2pod.pl
===================================================================
--- wget-1.15.orig/doc/texi2pod.pl 2014-01-19 21:41:04.000000000 +0000
+++ wget-1.15/doc/texi2pod.pl 2014-01-19 21:41:31.000000000 +0000
@@ -294,7 +294,7 @@ while(<$inf>) {
$_ = "\n=item C<$thing>\n";
} else {
# Entity escapes prevent munging by the <> processing below.
- $_ = "\n=item $ic\&LT;$thing\&GT;\n";
+ $_ = "\n=item Z<>$ic\&LT;$thing\&GT;\n";
}
} else {
$_ = "\n=item $ic\n";

113
wget-libproxy.patch Normal file
View File

@ -0,0 +1,113 @@
Index: wget-1.21.4/configure.ac
===================================================================
--- wget-1.21.4.orig/configure.ac
+++ wget-1.21.4/configure.ac
@@ -655,6 +655,22 @@ then
fi
fi
+dnl
+dnl libproxy support
+dnl
+AC_ARG_ENABLE(libproxy,
+ [ --enable-libproxy libproxy support for system wide proxy configuration])
+if test "${enable_libproxy}" != "no"
+then
+ PKG_CHECK_MODULES([libproxy], [libproxy-1.0], [enable_libproxy=yes], [enable_libproxy=no])
+fi
+if test "${enable_libproxy}" = "yes"
+then
+ AC_SUBST(libproxy_CFLAGS)
+ AC_SUBST(libproxy_LIBS)
+ AC_DEFINE([HAVE_LIBPROXY], 1, [Define when using libproxy])
+fi
+
dnl **********************************************************************
dnl Checks for IPv6
dnl **********************************************************************
Index: wget-1.21.4/src/Makefile.am
===================================================================
--- wget-1.21.4.orig/src/Makefile.am
+++ wget-1.21.4/src/Makefile.am
@@ -85,11 +85,11 @@ endif
nodist_wget_SOURCES = version.c
EXTRA_wget_SOURCES = iri.c metalink.c xattr.c
LDADD = $(CODE_COVERAGE_LIBS) $(LIBOBJS) ../lib/libgnu.a $(GETADDRINFO_LIB) $(HOSTENT_LIB)\
- $(INET_NTOP_LIB) $(LIBSOCKET) $(LIB_CLOCK_GETTIME) $(LIB_CRYPTO)\
+ $(INET_NTOP_LIB) $(LIBSOCKET) $(libproxy_LIBS) $(LIB_CLOCK_GETTIME) $(LIB_CRYPTO)\
$(LIB_NANOSLEEP) $(LIB_POSIX_SPAWN) $(LIB_SELECT) $(LIBICONV) $(LIBINTL)\
$(LIBTHREAD) $(LIBUNISTRING) $(SERVENT_LIB)
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib $(CODE_COVERAGE_CPPFLAGS)
-AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS) $(CODE_COVERAGE_CFLAGS)
+AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS) $(CODE_COVERAGE_CFLAGS) $(libproxy_CFLAGS)
../lib/libgnu.a:
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
Index: wget-1.21.4/src/retr.c
===================================================================
--- wget-1.21.4.orig/src/retr.c
+++ wget-1.21.4/src/retr.c
@@ -60,6 +60,10 @@ as that of the covered work. */
#include "iri.h"
#include "hsts.h"
+#ifdef HAVE_LIBPROXY
+#include "proxy.h"
+#endif
+
/* Total size of downloaded files. Used to enforce quota. */
wgint total_downloaded_bytes;
@@ -1489,7 +1493,40 @@ getproxy (struct url *u)
break;
}
if (!proxy || !*proxy)
+#ifdef HAVE_LIBPROXY
+ {
+ pxProxyFactory *pf = px_proxy_factory_new();
+ if (!pf)
+ {
+ debug_logprintf (_("Allocating memory for libproxy failed"));
+ return NULL;
+ }
+ int i;
+ char direct[] = "direct://";
+
+ debug_logprintf (_("asking libproxy about url '%s'\n"), u->url);
+ char **proxies = px_proxy_factory_get_proxies(pf, u->url);
+ if (proxies[0])
+ {
+ char *check = NULL;
+ asprintf(&check , "%s", proxies[0]);
+ debug_logprintf (_("libproxy suggest to use '%s'\n"), check);
+ if(strcmp(check ,direct) != 0)
+ {
+ asprintf(&proxy , "%s", proxies[0]);
+ debug_logprintf (_("case 2: libproxy setting to use '%s'\n"), proxy);
+ }
+ }
+ for(i=0;proxies[i];i++) free(proxies[i]);
+ free(proxies);
+ px_proxy_factory_free(pf);
+
+ if (!proxy || !*proxy)
+ return NULL;
+ }
+#else
return NULL;
+#endif
/* Handle shorthands. `rewritten_storage' is a kludge to allow
getproxy() to return static storage. */
Index: wget-1.21.4/tests/Makefile.am
===================================================================
--- wget-1.21.4.orig/tests/Makefile.am
+++ wget-1.21.4/tests/Makefile.am
@@ -31,6 +31,7 @@
#
# Version: @VERSION@
#
++LIBS += $(libproxy_LIBS)
../src/wget$(EXEEXT):
cd ../src && $(MAKE) $(AM_MAKEFLAGS)

1056
wget.changes Normal file

File diff suppressed because it is too large Load Diff

1575
wget.keyring Normal file

File diff suppressed because it is too large Load Diff

105
wget.spec Normal file
View File

@ -0,0 +1,105 @@
#
# spec file for package wget
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_with regression_tests
Name: wget
Version: 1.21.4
Release: 0
Summary: A Tool for Mirroring FTP and HTTP Servers
License: GPL-3.0-or-later
Group: Productivity/Networking/Web/Utilities
URL: https://www.gnu.org/software/wget/
Source: https://ftp.gnu.org/gnu/wget/%{name}-%{version}.tar.gz
Source1: https://ftp.gnu.org/gnu/wget/%{name}-%{version}.tar.gz.sig
Source2: https://savannah.gnu.org/people/viewgpg.php?user_id=90497#/%{name}.keyring
Patch0: wgetrc.patch
Patch1: wget-libproxy.patch
Patch6: wget-1.14-no-ssl-comp.patch
# PATCH-FIX-OPENSUSE fix pod syntax for perl 5.18 coolo@suse.de
Patch7: wget-fix-pod-syntax.diff
Patch8: wget-errno-clobber.patch
Patch9: remove-env-from-shebang.patch
Patch10: wget-do-not-propagate-credentials.patch
# for AX_CODE_COVERAGE
BuildRequires: autoconf-archive >= 2015.02.04
BuildRequires: automake
BuildRequires: gpgme-devel >= 0.4.2
BuildRequires: libcares-devel
BuildRequires: libidn2-devel
BuildRequires: libpng-devel
BuildRequires: makeinfo
BuildRequires: openssl-devel
BuildRequires: pkgconfig >= 0.9.0
BuildRequires: pkgconfig(libmetalink)
BuildRequires: pkgconfig(libpcre2-8)
BuildRequires: pkgconfig(libproxy-1.0)
BuildRequires: pkgconfig(libpsl)
BuildRequires: pkgconfig(uuid)
%if %{with regression_tests}
# For the Testsuite
BuildRequires: perl-HTTP-Daemon
BuildRequires: perl-IO-Socket-SSL
%endif
%description
Wget enables you to retrieve WWW documents or FTP files from a server.
This can be done in script files or via the command line.
%lang_package
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch6
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
# wget-libproxy.patch
autoreconf --force
%configure \
--with-ssl=openssl \
--with-cares \
--with-metalink
%make_build
sed -i 's/\/usr\/bin\/env perl -w/\/usr\/bin\/perl -w/' util/rmold.pl
%check
%if %{with regression_tests}
%make_build -C tests/ check
%endif
%install
%make_install
%find_lang %{name} --all-name %{?no_lang_C}
%files
%license COPYING
%doc AUTHORS NEWS README MAILING-LIST
%doc doc/sample.wgetrc util/rmold.pl
%{_mandir}/*/wget*
%{_infodir}/wget*
%config(noreplace) %{_sysconfdir}/wgetrc
%{_bindir}/*
%files lang -f %{name}.lang
%changelog

14
wgetrc.patch Normal file
View File

@ -0,0 +1,14 @@
Index: wget-1.20/doc/sample.wgetrc
===================================================================
--- wget-1.20.orig/doc/sample.wgetrc
+++ wget-1.20/doc/sample.wgetrc
@@ -120,6 +120,9 @@
# To try ipv6 addresses first:
#prefer-family = IPv6
+#
+# Let the DNS resolver decide whether to prefer IPv4 or IPv6
+prefer-family = none
# Set default IRI support state
#iri = off