diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76c7c4331..c764e2dbf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,9 +69,6 @@ Build-Tarball: - make -j$(nproc) syntax-check - make -j$(nproc) dist - mv wget-*.gz .. - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget artifacts: @@ -100,9 +97,6 @@ Valgrind: - cd wget-*/ - ./configure $CONFIGURE_BASE_FLAGS --cache-file ../cache/config.cache - make check-valgrind - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget dependencies: @@ -131,9 +125,6 @@ Minimal: --disable-iri --disable-ntlm --disable-pcre --without-libpsl --without-libuuid --without-libintl-prefix - make -j$(nproc) check-valgrind - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget dependencies: @@ -160,9 +151,6 @@ Debian-OldStable: - ./configure $CONFIGURE_BASE_FLAGS --cache-file ../cache/config.cache - make - make -j$(nproc) check - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget dependencies: @@ -188,9 +176,6 @@ Debian-Stable: - cd wget-*/ - ./configure $CONFIGURE_BASE_FLAGS --cache-file ../cache/config.cache - make -j$(nproc) check - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget dependencies: @@ -217,9 +202,6 @@ CentOS-OldLTS: - ./configure $CONFIGURE_BASE_FLAGS --cache-file ../cache/config.cache - make -j$(nproc) - make -j$(nproc) check - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget dependencies: @@ -250,9 +232,6 @@ TLS/OpenSSL: - ./configure $CONFIGURE_BASE_FLAGS --cache-file ../cache/config.cache --with-ssl=openssl - make -j$(nproc) - make -j$(nproc) check-valgrind - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget dependencies: @@ -281,9 +260,6 @@ TLS/GnuTLS: - ./configure $CONFIGURE_BASE_FLAGS --cache-file ../cache/config.cache --with-ssl=gnutls - make -j$(nproc) - make -j$(nproc) check-valgrind - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget dependencies: @@ -316,9 +292,6 @@ Sanitizers: - ./configure $CONFIGURE_BASE_FLAGS --cache-file ../cache/config.cache --enable-fsanitize-asan --enable-fsanitize-ubsan - make -j$(nproc) check - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget dependencies: @@ -346,9 +319,6 @@ Scan-Build: - make -C lib -j$(nproc) - make -C src css_.o - scan-build -v -enable-checker nullability --keep-empty --status-bugs -o ../scan-build make -j$(nproc) - tags: - - shared - - linux except: - tags - coverity-scan@gnuwget/wget @@ -379,9 +349,6 @@ CoverageReports: - make -j$(nproc) fuzz-coverage - mv lcov ../fuzz-coverage - make dist - tags: - - shared - - linux dependencies: - Build-Tarball needs: ["Build-Tarball"] @@ -390,8 +357,8 @@ CoverageReports: paths: - test-coverage/ - fuzz-coverage/ - only: - - master +# only: +# - master MinGW64: stage: test-from-tarball @@ -413,9 +380,6 @@ MinGW64: - make -j$(nproc) - cp -p src/wget.exe src/wget - make check -j$(nproc) LOG_COMPILER=wine - tags: - - shared - - linux except: - tags - coverity-scan@gnuwget/wget @@ -446,9 +410,6 @@ ArchLinux: - ./configure $CONFIGURE_BASE_FLAGS - make -j$(nproc) - make check -j$(nproc) - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget needs: [] @@ -472,9 +433,6 @@ Fedora: - touch .manywarnings - ./configure $CONFIGURE_BASE_FLAGS - make -j$(nproc) check - tags: - - shared - - linux except: - coverity-scan@gnuwget/wget needs: [] diff --git a/.prev-version b/.prev-version index 6521720b4..ad2191947 100644 --- a/.prev-version +++ b/.prev-version @@ -1 +1 @@ -1.24.5 +1.25.0 diff --git a/Makefile.am b/Makefile.am index 96b6acf5b..977cbde97 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ # Makefile for `Wget' utility -# Copyright (C) 1995-1997, 2006-2024 Free Software Foundation, Inc. +# Copyright (C) 1995-1997, 2006-2024, 2026 Free Software Foundation, +# Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -89,11 +90,11 @@ clean-lcov: check-coverage: clean clean-lcov $(MAKE) CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage" - lcov --capture --initial --directory src/ --output-file $(LCOV_INFO) + lcov --capture --initial --ignore-errors source,range --directory src/ --output-file $(LCOV_INFO) $(MAKE) CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage" VALGRIND_TESTS=0 check - lcov --capture --directory src/ --output-file $(LCOV_INFO) - lcov --remove $(LCOV_INFO) --ignore-errors unused '/usr/include/*' '*/lib/*' -o $(LCOV_INFO) - genhtml --prefix . --ignore-errors source --ignore-errors unmapped $(LCOV_INFO) --legend --title "Wget" --output-directory=lcov + lcov --capture --ignore-errors source,range --directory src/ --output-file $(LCOV_INFO) + lcov --remove $(LCOV_INFO) --ignore-errors source,range,unused '/usr/include/*' '*/lib/*' '*/src/css.l' -o $(LCOV_INFO) + genhtml --prefix . --ignore-errors source,range,unmapped $(LCOV_INFO) --legend --title "Wget" --output-directory=lcov @echo @echo "You can now view the coverage report with 'xdg-open lcov/index.html'" @@ -101,9 +102,9 @@ fuzz-coverage: clean clean-lcov $(MAKE) -C lib $(MAKE) -C src CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage" $(MAKE) -C fuzz check CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage" - lcov --capture --initial --directory fuzz --directory src --output-file $(LCOV_INFO) - lcov --capture --directory fuzz --directory src --output-file $(LCOV_INFO) - lcov --remove $(LCOV_INFO) '/usr/include/*' '*/lib/*' -o $(LCOV_INFO) - genhtml --prefix . --ignore-errors source $(LCOV_INFO) --legend --title "Wget-fuzz" --output-directory=lcov + lcov --capture --initial --ignore-errors source,range --directory fuzz --directory src --output-file $(LCOV_INFO) + lcov --capture --ignore-errors source,range --directory fuzz --directory src --output-file $(LCOV_INFO) + lcov --remove $(LCOV_INFO) --ignore-errors source,range '/usr/include/*' '*/lib/*' '*/src/css.l' -o $(LCOV_INFO) + genhtml --prefix . --ignore-errors source,range $(LCOV_INFO) --legend --title "Wget-fuzz" --output-directory=lcov @echo @echo "You can now view the coverage report with 'xdg-open lcov/index.html'" diff --git a/NEWS b/NEWS index 98ce7759a..094ace7e8 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,22 @@ GNU Wget NEWS -- history of user-visible changes. * Noteworthy changes in release ?.? (????-??-??) [?] +** Add --ftp-recurse-symlink-dirs option to descend into FTP directory + symlinks during recursive retrieval. Cycle detection prevents + infinite loops from circular symlinks. + + +* Noteworthy changes in release 1.25.0 (2024-11-10) [stable] + +** [Breaking change] Drop support for shorthand FTP URLs (CVE-2024-10524) + +** [Breaking change] Switch to continuous reading from stdin pipes + +** Reimplement user-info parsing based on RFC 2396 + +** Fix a build issue with libproxy and --disable-debug + + * Noteworthy changes in release 1.24.5 (2024-03-10) [stable] @@ -1218,7 +1234,7 @@ geturl -vo log http://fly.cc.fer.hr/ ---------------------------------------------------------------------- Copyright information: -Copyright (C) 1997-2024 Free Software Foundation, Inc. +Copyright (C) 1997-2024, 2026 Free Software Foundation, Inc. Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that diff --git a/README b/README index 301d51fdc..19feee890 100644 --- a/README +++ b/README @@ -63,7 +63,7 @@ the file AUTHORS for a list of major contributors, and the ChangeLogs for a detailed listing of all contributions. -Copyright (C) 1995-2024 Free Software Foundation, Inc. +Copyright (C) 1995-2024, 2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,10 +75,10 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 -USA. +A copy of the GNU General Public License can be found in the file LICENSE +in the top directory of the official source distribution. The license is +also available in several formats through the World Wide Web, or +via http://www.gnu.org/licenses/licenses.html#GPL . Additional permission under GNU GPL version 3 section 7 diff --git a/README.checkout b/README.checkout index e16f92af0..83fa6c3e9 100644 --- a/README.checkout +++ b/README.checkout @@ -161,7 +161,7 @@ Testing and development that bug, which might be tedious. Tests should only be run through GDB for that purpose. - Copyright (C) 2008, 2010, 2014-2015, 2018-2024 Free Software + Copyright (C) 2008, 2010, 2014-2015, 2018-2024, 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . diff --git a/bootstrap b/bootstrap index 3173829da..19f9424bb 100755 --- a/bootstrap +++ b/bootstrap @@ -3,9 +3,9 @@ # Bootstrap this package from checked-out sources. -scriptversion=2023-12-10.18; # UTC +scriptversion=2025-06-10.02; # UTC -# Copyright (C) 2003-2024 Free Software Foundation, Inc. +# Copyright (C) 2003-2026 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -37,9 +37,9 @@ medir=`dirname "$me"` # A library of shell functions for autopull.sh, autogen.sh, and bootstrap. -scriptlibversion=2023-12-10.18; # UTC +scriptlibversion=2025-12-04.19; # UTC -# Copyright (C) 2003-2024 Free Software Foundation, Inc. +# Copyright (C) 2003-2026 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -72,7 +72,7 @@ export LC_ALL # Honor $PERL, but work even if there is none. PERL="${PERL-perl}" -default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git +default_gnulib_url=https://https.git.savannah.gnu.org/git/gnulib.git # Copyright year, for the --version output. copyright_year=`echo "$scriptlibversion" | sed -e 's/[^0-9].*//'` @@ -152,7 +152,8 @@ po_download_command_format=\ "wget --mirror --level=1 -nd -nv -A.po -P '%s' \ https://translationproject.org/latest/%s/" -# Prefer a non-empty tarname (4th argument of AC_INIT if given), else +# When extracting the package name from an AC_INIT invocation, +# prefer a non-empty tarname (4th argument of AC_INIT if given), else # fall back to the package name (1st argument with munging). extract_package_name=' /^AC_INIT(\[*/{ @@ -164,17 +165,20 @@ extract_package_name=' q } s/[],)].*// - s/^GNU // - y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ - s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g p } ' -package=$(${AUTOCONF:-autoconf} --trace AC_INIT:\$4 configure.ac 2>/dev/null) +normalize_package_name=' + s/^GNU // + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g +' +package=$(${AUTOCONF:-autoconf} --trace 'AC_INIT:$4' configure.ac 2>/dev/null) if test -z "$package"; then package=$(sed -n "$extract_package_name" configure.ac) \ || die 'cannot find package name in configure.ac' fi +package=$(echo "$package" | sed "$normalize_package_name") gnulib_name=lib$package build_aux=build-aux @@ -478,10 +482,9 @@ find_tool () # --------------------- Preparing GNULIB_SRCDIR for use. --------------------- # This is part of autopull.sh, but bootstrap needs it too, for self-upgrading. +# cleanup_gnulib fails, removing the directory $gnulib_path first. cleanup_gnulib() { status=$? - # XXX It's a bad idea to erase the submodule directory if it contains local - # modifications. rm -fr "$gnulib_path" exit $status } @@ -499,93 +502,155 @@ prepare_GNULIB_SRCDIR () test -f "$GNULIB_SRCDIR/gnulib-tool" \ || die "Error: --gnulib-srcdir or \$GNULIB_SRCDIR is specified," \ "but does not contain gnulib-tool" - elif $use_git; then + if test -n "$GNULIB_REVISION" && $use_git; then + # The 'git checkout "$GNULIB_REVISION"' command succeeds if the + # GNULIB_REVISION is a commit hash that exists locally, or if it is + # branch name that can be fetched from origin. It fails, however, + # if the GNULIB_REVISION is a commit hash that only exists in + # origin. In this case, we need a 'git fetch' and then retry + # 'git checkout "$GNULIB_REVISION"'. + git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION" 2>/dev/null \ + || { git -C "$GNULIB_SRCDIR" fetch origin \ + && git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION"; } \ + || exit $? + fi + else + if ! $use_git; then + die "Error: --no-git is specified," \ + "but neither --gnulib-srcdir nor \$GNULIB_SRCDIR is specified" + fi + if git submodule -h | grep -- --reference > /dev/null; then + : + else + die "git version is too old, git >= 1.6.4 is required" + fi gnulib_path=$(git_modules_config submodule.gnulib.path) - test -z "$gnulib_path" && gnulib_path=gnulib - - # Get gnulib files. Populate $gnulib_path, possibly updating a - # submodule, for use in the rest of the script. - - if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git \ - && git_modules_config submodule.gnulib.url >/dev/null; then - # Use GNULIB_REFDIR as a reference. - echo "$0: getting gnulib files..." - if git submodule -h|grep -- --reference > /dev/null; then - # Prefer the one-liner available in git 1.6.4 or newer. - git submodule update --init --reference "$GNULIB_REFDIR" \ - "$gnulib_path" || exit $? + if test -n "$gnulib_path"; then + # A submodule 'gnulib' is configured. + # Get gnulib files. Populate $gnulib_path, updating the submodule. + if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git; then + # Use GNULIB_REFDIR as a reference. + echo "$0: getting gnulib files..." + git submodule update --init --reference "$GNULIB_REFDIR" "$gnulib_path"\ + || exit $? else - # This fallback allows at least git 1.5.5. - if test -f "$gnulib_path"/gnulib-tool; then - # Since file already exists, assume submodule init already complete. + # GNULIB_REFDIR is not set or not usable. Ignore it. + if git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + git submodule init -- "$gnulib_path" || exit $? git submodule update -- "$gnulib_path" || exit $? else - # Older git can't clone into an empty directory. - rmdir "$gnulib_path" 2>/dev/null - git clone --reference "$GNULIB_REFDIR" \ - "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ - && git submodule init -- "$gnulib_path" \ - && git submodule update -- "$gnulib_path" \ - || exit $? + die "Error: submodule 'gnulib' has no configured url" fi fi else - # GNULIB_REFDIR is not set or not usable. Ignore it. - if git_modules_config submodule.gnulib.url >/dev/null; then - echo "$0: getting gnulib files..." - git submodule init -- "$gnulib_path" || exit $? - git submodule update -- "$gnulib_path" || exit $? - - elif [ ! -d "$gnulib_path" ]; then + gnulib_path='gnulib' + if test ! -d "$gnulib_path"; then + # The subdirectory 'gnulib' does not yet exist. Clone into it. echo "$0: getting gnulib files..." - trap cleanup_gnulib HUP INT PIPE TERM - - shallow= - if test -z "$GNULIB_REVISION"; then - if git clone -h 2>&1 | grep -- --depth > /dev/null; then - shallow='--depth 2' - fi - git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ - || cleanup_gnulib + gnulib_url=${GNULIB_URL:-$default_gnulib_url} + if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git; then + # Use GNULIB_REFDIR as a reference. + git clone "$GNULIB_REFDIR" "$gnulib_path" \ + && git -C "$gnulib_path" remote set-url origin "$gnulib_url" \ + && if test -z "$GNULIB_REVISION"; then + git -C "$gnulib_path" pull origin \ + && { + # We want the default branch of "$gnulib_url" (since that's + # the behaviour if GNULIB_REFDIR is not specified), not the + # current branch of "$GNULIB_REFDIR". + default_branch=`LC_ALL=C git -C "$gnulib_path" \ + remote show origin \ + | sed -n -e 's/^ *HEAD branch: //p'` + test -n "$default_branch" || default_branch='master' + git -C "$gnulib_path" checkout "$default_branch" + } + else + # The 'git checkout "$GNULIB_REVISION"' command succeeds if the + # GNULIB_REVISION is a commit hash that exists locally, or if it + # is a branch name that can be fetched from origin. It fails, + # however, if the GNULIB_REVISION is a commit hash that only + # exists in origin. In this case, we need a 'git fetch' and then + # retry 'git checkout "$GNULIB_REVISION"'. + git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \ + || { git -C "$gnulib_path" fetch origin \ + && git -C "$gnulib_path" checkout "$GNULIB_REVISION"; } + fi \ + || cleanup_gnulib else - if git fetch -h 2>&1 | grep -- --depth > /dev/null; then - shallow='--depth 2' + # GNULIB_REFDIR is not set or not usable. Ignore it. + shallow='--depth 2' + if test -z "$GNULIB_REVISION"; then + git clone $shallow "$gnulib_url" "$gnulib_path" \ + || cleanup_gnulib + else + # Only want a shallow checkout of $GNULIB_REVISION, but git does not + # support cloning by commit hash. So attempt a shallow fetch by + # commit hash to minimize the amount of data downloaded and changes + # needed to be processed, which can drastically reduce download and + # processing time for checkout. If the fetch by commit fails, a + # shallow fetch cannot be performed because we do not know what the + # depth of the commit is without fetching all commits. So fall back + # to fetching all commits. + # $GNULIB_REVISION can be a commit id, a tag name, or a branch name. + mkdir -p "$gnulib_path" + # Use a -c option to silence an annoying message + # "hint: Using 'master' as the name for the initial branch." + # (cf. ). + git -C "$gnulib_path" -c init.defaultBranch=master init + git -C "$gnulib_path" remote add origin "$gnulib_url" + if git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" + then + # "git fetch" of the specific commit succeeded. + git -C "$gnulib_path" reset --hard FETCH_HEAD \ + || cleanup_gnulib + # "git fetch" does not fetch tags (at least in git version 2.43). + # If $GNULIB_REVISION is a tag (not a commit id or branch name), + # add the tag explicitly. + revision=`git -C "$gnulib_path" log -1 --pretty=format:%H` + branch=`LC_ALL=C git -C "$gnulib_path" remote show origin \ + | sed -n -e 's/^ \([^ ]*\) * tracked$/\1/p'` + test "$revision" = "$GNULIB_REVISION" \ + || test "$branch" = "$GNULIB_REVISION" \ + || git -C "$gnulib_path" tag "$GNULIB_REVISION" + else + # Fetch the entire repository. + git -C "$gnulib_path" fetch origin \ + || cleanup_gnulib + git -C "$gnulib_path" checkout "$GNULIB_REVISION" \ + || cleanup_gnulib + fi fi - mkdir -p "$gnulib_path" - # Only want a shallow checkout of $GNULIB_REVISION, but git does not - # support cloning by commit hash. So attempt a shallow fetch by commit - # hash to minimize the amount of data downloaded and changes needed to - # be processed, which can drastically reduce download and processing - # time for checkout. If the fetch by commit fails, a shallow fetch can - # not be performed because we do not know what the depth of the commit - # is without fetching all commits. So fall back to fetching all - # commits. - git -C "$gnulib_path" init - git -C "$gnulib_path" remote add origin \ - ${GNULIB_URL:-$default_gnulib_url} - git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \ - || git -C "$gnulib_path" fetch origin \ - || cleanup_gnulib - git -C "$gnulib_path" reset --hard FETCH_HEAD fi - trap - HUP INT PIPE TERM + else + # The subdirectory 'gnulib' already exists. + if test -n "$GNULIB_REVISION"; then + if test -d "$gnulib_path/.git"; then + # The 'git checkout "$GNULIB_REVISION"' command succeeds if the + # GNULIB_REVISION is a commit hash that exists locally, or if it + # is a branch name that can be fetched from origin. It fails, + # however, if the GNULIB_REVISION is a commit hash that only + # exists in origin. In this case, we need a 'git fetch' and then + # retry 'git checkout "$GNULIB_REVISION"'. + git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \ + || { git -C "$gnulib_path" fetch origin \ + && git -C "$gnulib_path" checkout "$GNULIB_REVISION"; } \ + || exit $? + else + die "Error: GNULIB_REVISION is specified in bootstrap.conf," \ + "but '$gnulib_path' contains no git history" + fi + fi fi fi - GNULIB_SRCDIR=$gnulib_path - # Verify that the submodule contains a gnulib checkout. + # Verify that $gnulib_path contains a gnulib checkout. test -f "$gnulib_path/gnulib-tool" \ - || die "Error: $gnulib_path is supposed to contain a gnulib checkout," \ + || die "Error: '$gnulib_path' is supposed to contain a gnulib checkout," \ "but does not contain gnulib-tool" + GNULIB_SRCDIR=$gnulib_path fi - - # XXX Should this be done if $use_git is false? - if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \ - && ! git_modules_config submodule.gnulib.url >/dev/null; then - (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib - fi - # $GNULIB_SRCDIR now points to the version of gnulib to use, and # we no longer need to use git or $gnulib_path below here. } @@ -647,7 +712,8 @@ fi autopull_usage() { cat </dev/null | sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return - langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g') - test "$langs" = '*' && langs=x - for po in $langs; do + for po in x $(ls $ref_po_dir | sed -n 's/\.po$//p'); do case $po in x) continue;; esac new_po="$ref_po_dir/$po.po" cksum_file="$ref_po_dir/$po.s1" @@ -890,7 +956,8 @@ update_po_files() { autogen_usage() { cat < diff --git a/cfg.mk b/cfg.mk index f9a028212..2fd5fb1c9 100644 --- a/cfg.mk +++ b/cfg.mk @@ -22,7 +22,8 @@ local-checks-to-skip = \ sc_cast_of_argument_to_free \ sc_prohibit_gnu_make_extensions \ \ - sc_indent + sc_indent \ + sc_codespell #SHELL=bash -x show-vc-list-except: @@ -33,5 +34,5 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX = ^ABOUT-NLS|((msdos|vms)/.*)|ChangeLog-2014-12-10| update-copyright-env = UPDATE_COPYRIGHT_USE_INTERVALS=1 generated_files = -old_NEWS_hash = b80dbf02602654e200d7cbce7aeda8d2 +old_NEWS_hash = 20a35ad12d4ab87d7aaa2f740b2e2333 manual_title = $(VERSION) diff --git a/configure.ac b/configure.ac index 5ef12fe40..5f6a7286c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Template file for GNU Autoconf -dnl Copyright (C) 1995-1997, 2001, 2007-2014, 2018-2024 Free Software -dnl Foundation, Inc. +dnl Copyright (C) 1995-1997, 2001, 2007-2014, 2018-2024, 2026 Free +dnl Software Foundation, Inc. dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -398,6 +398,8 @@ if test -n "$WARN_CFLAGS"; then nw="$nw -Wnested-externs" # Stylistic choice and we do use it in hsts code nw="$nw -Wc90-c99-compat" # gcc-12, we use C99 nw="$nw -Wlong-long" # gcc-12, we use C99 + nw="$nw -Wc99-c11-compat" # gnulib is at C11 + nw="$nw -Wuseless-cast" # gcc-14 warns about it (pretty useless for portable code) if test "$cross_compiling" = yes; then nw="$nw -Wformat" fi diff --git a/contrib/commit-check b/contrib/commit-check index 82c39649f..3024abc70 100755 --- a/contrib/commit-check +++ b/contrib/commit-check @@ -1,6 +1,6 @@ #!/usr/bin/env sh -# Copyright (c) 2018-2022, 2024 Free Software Foundation, Inc. +# Copyright (c) 2018-2022, 2024, 2026 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/contrib/make-release b/contrib/make-release index dc4832626..1d252ac44 100755 --- a/contrib/make-release +++ b/contrib/make-release @@ -52,7 +52,7 @@ case $REL_TYPE_IN in esac echo "This script will make a new release and upload it to the GNU FTP Servers" -echo "Will run git clean -dxf to get a clean dir" +echo "Will run \`git clean -dxf\` to get a clean dir" ask_continue # Make sure we have a clean working directory @@ -60,11 +60,15 @@ git clean -dxfq echo "=> Bootstrap" ./bootstrap > /dev/null 2>&1 -autoreconf -ivf + +echo "=> autoreconf" +autoreconf -if echo "=> Configure" ./configure -q +APP_NAME=$(grep "^PACKAGE_NAME='" configure | cut -d "'" -f2) + echo "Building $APP_NAME v$VERSION $REL_TYPE" ask_continue @@ -74,13 +78,6 @@ sed -n "${LNO_CVER},${LNO_PVER}p" NEWS echo "This is the current contents of your NEWS" ask_continue -export RELEASE="$VERSION $REL_TYPE" - -echo "=> Making release-commit" -make -s release-commit - -echo "=> Make release" -make -s release GPG_KEY= while [ -z $GPG_KEY ]; do @@ -92,20 +89,16 @@ while [ -z $GPG_KEY ]; do [ "$x" = "y" ] || [ "$x" = "Y" ] && GPG_KEY="$key" done -echo "" +export RELEASE="$VERSION $REL_TYPE" +export GNUPLOADFLAGS="--user $GPG_KEY --symlink-regex" -upload_command=$(make -s emit_upload_commands \ - | sponge \ - | head -n3 \ - | tail -1 \ - | sed "s/--to/--user $GPG_KEY --symlink-regex --to/g" -) +echo "=> Making release" +make -s release-commit release RELEASE="$RELEASE" GNUPLOADFLAGS="$GNUPLOADFLAGS" echo "=> Uploading" echo "Upload tarballs?" -echo "$upload_command" ask_continue -$upload_command +make upload RELEASE="$RELEASE" GNUPLOADFLAGS="$GNUPLOADFLAGS" if [[ $REL_TYPE == "stable" ]]; then export CVSROOT=:ext:${CVSUSER:-${USER}}@cvs.savannah.gnu.org:/web/wget diff --git a/doc/Makefile.am b/doc/Makefile.am index 6133c5c53..606ec8e41 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,6 +1,6 @@ # Makefile for `wget' utility -# Copyright (C) 1995-1997, 2007-2011, 2015, 2018-2024 Free Software -# Foundation, Inc. +# Copyright (C) 1995-1997, 2007-2011, 2015, 2018-2024, 2026 Free +# Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/doc/fdl.texi b/doc/fdl.texi index d151a6a6a..9afbc31a5 100644 --- a/doc/fdl.texi +++ b/doc/fdl.texi @@ -5,8 +5,8 @@ @c hence no sectioning command or @node. @display -Copyright @copyright{} 2000--2002, 2007--2008, 2015, 2018--2024 Free -Software Foundation, Inc. +Copyright @copyright{} 2000--2002, 2007--2008, 2015, 2018--2024, 2026 +Free Software Foundation, Inc. @uref{http://fsf.org/} Everyone is permitted to copy and distribute verbatim copies diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 9325edb20..5d7144890 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -1,7 +1,7 @@ #! /usr/bin/env perl -# Copyright (C) 1999-2001, 2003, 2007, 2009-2011, 2015, 2018-2024 Free -# Software Foundation, Inc. +# Copyright (C) 1999-2001, 2003, 2007, 2009-2011, 2015, 2018-2024, +# 2026 Free Software Foundation, Inc. # This file is part of GCC. diff --git a/doc/wget.texi b/doc/wget.texi index 6d26fbb8e..b33df8581 100644 --- a/doc/wget.texi +++ b/doc/wget.texi @@ -31,7 +31,7 @@ This file documents the GNU Wget utility for downloading network data. @c man begin COPYRIGHT -Copyright @copyright{} 1996--2011, 2015, 2018--2024 Free Software +Copyright @copyright{} 1996--2011, 2015, 2018--2024, 2026 Free Software Foundation, Inc. @iftex @@ -314,8 +314,8 @@ for text files. Here is an example: ftp://host/directory/file;type=a @end example -Two alternative variants of @sc{url} specification are also supported, -because of historical (hysterical?) reasons and their widespreaded use. +The two alternative variants of @sc{url} specifications are no longer +supported because of security considerations: @sc{ftp}-only syntax (supported by @code{NcFTP}): @example @@ -327,12 +327,8 @@ host:/dir/file host[:port]/dir/file @end example -These two alternative forms are deprecated, and may cease being -supported in the future. - -If you do not understand the difference between these notations, or do -not know which one to use, just use the plain ordinary format you use -with your favorite browser, like @code{Lynx} or @code{Netscape}. +These two alternative forms have been deprecated long time ago, +and support is removed with version 1.22.0. @c man begin OPTIONS @@ -513,6 +509,13 @@ treated as @samp{html} if the Content-Type matches @samp{text/html}. Furthermore, the @var{file}'s location will be implicitly used as base href if none was specified. +If the @var{file} is a local file, on systems that support it, it will be +opened with the @code{O_NONBLOCK} flag to allow non-blocking reads from the +file. @samp{Wget} will attempt to continue reading from the file until +EOF is reached or it is closed. This allows one to stream a list of files +for retrieval where the list is dynamically generated during the execution +of the process. Currently, this feature is not available on Windows platforms. + @cindex input-metalink @item --input-metalink=@var{file} Downloads files covered in local Metalink @var{file}. Metalink version 3 @@ -631,7 +634,7 @@ Wget needs to be built with libcares for this option to be available. @item -t @var{number} @itemx --tries=@var{number} Set number of tries to @var{number}. Specify 0 or @samp{inf} for -infinite retrying. The default is to retry 20 times, with the exception +infinite retrying. The default is to try 20 times, with the exception of fatal errors like ``connection refused'' or ``not found'' (404), which are not retried. @@ -2139,8 +2142,8 @@ Preserve remote file permissions instead of permissions set by umask. @item --retr-symlinks By default, when retrieving @sc{ftp} directories recursively and a symbolic link is encountered, the symbolic link is traversed and the pointed-to files are -retrieved. Currently, Wget does not traverse symbolic links to directories to -download them recursively, though this feature may be added in the future. +retrieved. By default, Wget does not traverse symbolic links whose target is +a directory; see @samp{--ftp-recurse-symlink-dirs} to enable that. When @samp{--retr-symlinks=no} is specified, the linked-to file is not downloaded. Instead, a matching symbolic link is created on the local @@ -2154,6 +2157,27 @@ Note that when retrieving a file (not a directory) because it was specified on the command-line, rather than because it was recursed to, this option has no effect. Symbolic links are always traversed in this case. + +@cindex symbolic links, directories, recursion +@item --ftp-recurse-symlink-dirs +When retrieving @sc{ftp} directories recursively, descend through +symbolic links whose target is a directory on the server. Without this +option, symbolic links to directories are either materialized as local +symbolic links (when @samp{--retr-symlinks=no}) or retrieved as files +(the failure of which is silently ignored), and their contents are never +explored. + +Wget performs server-side descent: the symlink's name is used in a +@sc{cwd} command, and the server resolves the target. Cycles are +detected by canonicalizing each symlink's target path (relative targets +are resolved against the current remote directory) and tracking them in +a per-session set; a symlink whose target has already been descended +through is skipped with a diagnostic. + +This option is disabled by default because a malicious @sc{ftp} server +could craft a listing with symlinks that amplify recursion cost or +redirect descent outside the intended subtree. Combine with +@samp{--exclude-directories} and @samp{--level} to bound the crawl. @end table @section FTPS Options diff --git a/fuzz/fuzzer.h b/fuzz/fuzzer.h index cae9726f9..b13037ed0 100644 --- a/fuzz/fuzzer.h +++ b/fuzz/fuzzer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/glob_crash.c b/fuzz/glob_crash.c index c165bdb30..60b2c115a 100644 --- a/fuzz/glob_crash.c +++ b/fuzz/glob_crash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/main.c b/fuzz/main.c index 4f240bf66..c8df7d9f5 100644 --- a/fuzz/main.c +++ b/fuzz/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/run-afl.sh b/fuzz/run-afl.sh index 4db40a6a1..6916138fd 100755 --- a/fuzz/run-afl.sh +++ b/fuzz/run-afl.sh @@ -1,6 +1,6 @@ #!/bin/sh -eu -# Copyright (c) 2017, 2019-2024 Free Software Foundation, Inc. +# Copyright (c) 2017, 2019-2024, 2026 Free Software Foundation, Inc. # # This file is part of GNU Wget. # diff --git a/fuzz/run-clang.sh b/fuzz/run-clang.sh index 09154090a..f9a126197 100755 --- a/fuzz/run-clang.sh +++ b/fuzz/run-clang.sh @@ -1,6 +1,6 @@ #!/bin/bash -e # -# Copyright (c) 2017, 2019-2024 Free Software Foundation, Inc. +# Copyright (c) 2017, 2019-2024, 2026 Free Software Foundation, Inc. # # This file is part of GNU Wget. # diff --git a/fuzz/wget_cookie_fuzzer.c b/fuzz/wget_cookie_fuzzer.c index 9fc3e6d51..e2a6d3c04 100644 --- a/fuzz/wget_cookie_fuzzer.c +++ b/fuzz/wget_cookie_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_css_fuzzer.c b/fuzz/wget_css_fuzzer.c index 46f37c4db..3bd8dd77b 100644 --- a/fuzz/wget_css_fuzzer.c +++ b/fuzz/wget_css_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_ftpls_fuzzer.c b/fuzz/wget_ftpls_fuzzer.c index dcc69e62f..9ec1484d1 100644 --- a/fuzz/wget_ftpls_fuzzer.c +++ b/fuzz/wget_ftpls_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_html_fuzzer.c b/fuzz/wget_html_fuzzer.c index 0f321f2b3..e7121ad8e 100644 --- a/fuzz/wget_html_fuzzer.c +++ b/fuzz/wget_html_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_netrc_fuzzer.c b/fuzz/wget_netrc_fuzzer.c index 1baf81651..5faefb80b 100644 --- a/fuzz/wget_netrc_fuzzer.c +++ b/fuzz/wget_netrc_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_ntlm_fuzzer.c b/fuzz/wget_ntlm_fuzzer.c index ef01e4e74..5f38a2585 100644 --- a/fuzz/wget_ntlm_fuzzer.c +++ b/fuzz/wget_ntlm_fuzzer.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2017-2019, 2021-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2019, 2021-2024, 2026 Free Software Foundation, + * Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_options_fuzzer.c b/fuzz/wget_options_fuzzer.c index a337bb191..792a0a286 100644 --- a/fuzz/wget_options_fuzzer.c +++ b/fuzz/wget_options_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * @@ -90,6 +90,10 @@ void exit(int status) libc_exit(status); } } +// Work-around linker issue "multiple definition of `getaddrinfo'" +#ifdef _WIN32 +__attribute__ ((weak)) +#endif int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) { if (fuzzing) { diff --git a/fuzz/wget_progress_fuzzer.c b/fuzz/wget_progress_fuzzer.c index d01cad65d..5148f4aa8 100644 --- a/fuzz/wget_progress_fuzzer.c +++ b/fuzz/wget_progress_fuzzer.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2017-2019, 2021-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2019, 2021-2024, 2026 Free Software Foundation, + * Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_read_hunk_fuzzer.c b/fuzz/wget_read_hunk_fuzzer.c index 4315925dc..1dfbc3bed 100644 --- a/fuzz/wget_read_hunk_fuzzer.c +++ b/fuzz/wget_read_hunk_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024 Free Software Foundation, Inc. + * Copyright (c) 2019-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_robots_fuzzer.c b/fuzz/wget_robots_fuzzer.c index 24dd4cf3d..ae0e651bb 100644 --- a/fuzz/wget_robots_fuzzer.c +++ b/fuzz/wget_robots_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/fuzz/wget_url_fuzzer.c b/fuzz/wget_url_fuzzer.c index d6eb42c48..e20f270cb 100644 --- a/fuzz/wget_url_fuzzer.c +++ b/fuzz/wget_url_fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2024 Free Software Foundation, Inc. + * Copyright (c) 2017-2024, 2026 Free Software Foundation, Inc. * * This file is part of GNU Wget. * diff --git a/gnulib b/gnulib index 92cdf62b5..06f06019b 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit 92cdf62b56462b914193c7770440e505a37c2526 +Subproject commit 06f06019b66cd443e715014e4c49f64ceb61edfe diff --git a/m4/wget.m4 b/m4/wget.m4 index 03b390b08..66c41f089 100644 --- a/m4/wget.m4 +++ b/m4/wget.m4 @@ -1,5 +1,6 @@ dnl Wget-specific Autoconf macros. -dnl Copyright (C) 1995-2011, 2018-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1995-2011, 2018-2024, 2026 Free Software Foundation, +dnl Inc. dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by diff --git a/m4/wget_manywarnings.m4 b/m4/wget_manywarnings.m4 index 9a2390d06..7ddebd1c4 100644 --- a/m4/wget_manywarnings.m4 +++ b/m4/wget_manywarnings.m4 @@ -1,5 +1,5 @@ # wget_manywarnings.m4 serial 1 -dnl Copyright (C) 2016-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2016-2024, 2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/po/POTFILES.in b/po/POTFILES.in index 41cbcc618..352b58de8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1,6 @@ # List of files which containing translatable strings. -# Copyright (C) 1995-2011, 2018-2024 Free Software Foundation, Inc. +# Copyright (C) 1995-2011, 2018-2024, 2026 Free Software Foundation, +# Inc. # Package source files src/connect.c diff --git a/src/Makefile.am b/src/Makefile.am index 86be5330b..9fd7d9a00 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ # Makefile for `wget' utility -# Copyright (C) 1995-2011, 2015, 2018-2024 Free Software Foundation, -# Inc. +# Copyright (C) 1995-2011, 2015, 2018-2024, 2026 Free Software +# Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/connect.c b/src/connect.c index d00482ffc..9365e5197 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1,6 +1,6 @@ /* Establishing and handling network connections. - Copyright (C) 1995-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1995-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/connect.h b/src/connect.h index a48752d27..5a446a2d1 100644 --- a/src/connect.h +++ b/src/connect.h @@ -1,6 +1,6 @@ /* Declarations for connect. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/convert.c b/src/convert.c index 2e5bc22b0..feb90a35d 100644 --- a/src/convert.c +++ b/src/convert.c @@ -1,5 +1,5 @@ /* Conversion of links to local files. - Copyright (C) 2003-2011, 2014-2015, 2018-2024 Free Software + Copyright (C) 2003-2011, 2014-2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/convert.h b/src/convert.h index 47f8e9536..c9d2f5c23 100644 --- a/src/convert.h +++ b/src/convert.h @@ -1,6 +1,6 @@ /* Declarations for convert.c - Copyright (C) 2003-2006, 2009-2011, 2015, 2018-2024 Free Software - Foundation, Inc. + Copyright (C) 2003-2006, 2009-2011, 2015, 2018-2024, 2026 Free + Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/cookies.c b/src/cookies.c index f551ac8af..370c04539 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -1,6 +1,6 @@ /* Support for cookies. - Copyright (C) 2001-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2001-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/cookies.h b/src/cookies.h index ce8fea3f7..a37ede507 100644 --- a/src/cookies.h +++ b/src/cookies.h @@ -1,6 +1,6 @@ /* Support for cookies. - Copyright (C) 2001-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2001-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/css-tokens.h b/src/css-tokens.h index 56f302536..13dfcc287 100644 --- a/src/css-tokens.h +++ b/src/css-tokens.h @@ -1,5 +1,5 @@ /* Declarations for css.lex - Copyright (C) 2006, 2009-2011, 2015, 2018-2024 Free Software + Copyright (C) 2006, 2009-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/css-url.c b/src/css-url.c index 78fc0dd26..ae318b70f 100644 --- a/src/css-url.c +++ b/src/css-url.c @@ -1,6 +1,6 @@ /* Collect URLs from CSS source. - Copyright (C) 1998, 2000-2003, 2009-2011, 2014-2015, 2018-2024 Free - Software Foundation, Inc. + Copyright (C) 1998, 2000-2003, 2009-2011, 2014-2015, 2018-2024, 2026 + Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/css-url.h b/src/css-url.h index bfa4c3105..8972c38c4 100644 --- a/src/css-url.h +++ b/src/css-url.h @@ -1,5 +1,5 @@ /* Declarations for css-url.c. - Copyright (C) 2006, 2009-2011, 2015, 2018-2024 Free Software + Copyright (C) 2006, 2009-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/css.l b/src/css.l index cf6bc2950..852506cca 100644 --- a/src/css.l +++ b/src/css.l @@ -12,7 +12,7 @@ %{ /* Lex source for CSS tokenizing. Taken from http://www.w3.org/TR/CSS21/grammar.html#q2 - Copyright (C) 2006, 2009-2011, 2015, 2018-2024 Free Software + Copyright (C) 2006, 2009-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/exits.c b/src/exits.c index 4e7182590..fbcf5d2e5 100644 --- a/src/exits.c +++ b/src/exits.c @@ -1,6 +1,6 @@ /* Exit status handling. - Copyright (C) 2009-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2009-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/exits.h b/src/exits.h index fa5145c6b..1097767bf 100644 --- a/src/exits.h +++ b/src/exits.h @@ -1,6 +1,6 @@ /* Exit status related declarations. - Copyright (C) 2009-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2009-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/ftp-basic.c b/src/ftp-basic.c index 8f7d19c16..4870256a2 100644 --- a/src/ftp-basic.c +++ b/src/ftp-basic.c @@ -1,5 +1,5 @@ /* Basic FTP routines. - Copyright (C) 1996-2011, 2014-2015, 2018-2024 Free Software + Copyright (C) 1996-2011, 2014-2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/ftp-ls.c b/src/ftp-ls.c index 7a18584ff..e4175f8ec 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -1,6 +1,6 @@ /* Parsing FTP `ls' output. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/ftp-opie.c b/src/ftp-opie.c index 47ad0ddd1..4619e566f 100644 --- a/src/ftp-opie.c +++ b/src/ftp-opie.c @@ -1,6 +1,6 @@ /* Opie (s/key) support for FTP. - Copyright (C) 1998-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1998-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/ftp.c b/src/ftp.c index 3ffbb2d0b..76a77eac8 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1,5 +1,5 @@ /* File Transfer Protocol support. - Copyright (C) 1996-2011, 2014-2015, 2018-2024 Free Software + Copyright (C) 1996-2011, 2014-2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -40,6 +40,7 @@ as that of the covered work. */ #include #include "utils.h" +#include "hash.h" #include "url.h" #include "retr.h" #include "ftp.h" @@ -2194,6 +2195,69 @@ static uerr_t ftp_retrieve_dirs (struct url *, struct url *, static uerr_t ftp_retrieve_glob (struct url *, struct url *, ccon *, int); static struct fileinfo *delelement (struct fileinfo **, struct fileinfo **); +/* Cycle-detection table for --ftp-recurse-symlink-dirs. Keys are + heap-allocated "host:port:abs-path" strings owned by the table and + leaked at process exit. NULL until first symlink is visited. */ +static struct hash_table *ftp_visited_symlinks; + +/* Build a canonical cycle-detection key from the current URL and a + symlink target. Relative targets are resolved against u->dir; + absolute targets are used as-is. Trailing slashes are stripped so + "foo" and "foo/" collide. Caller frees. */ +static char * +ftp_symlink_cycle_key (const struct url *u, const char *linkto) +{ + char *abs; + char *key; + size_t plen; + + if (linkto[0] == '/') + abs = xstrdup (linkto); + else + { + const char *base = u->dir ? u->dir : ""; + size_t blen = strlen (base); + int need_sep = !(blen > 0 && base[blen - 1] == '/'); + abs = aprintf ("%s%s%s", base, need_sep ? "/" : "", linkto); + } + + plen = strlen (abs); + while (plen > 1 && abs[plen - 1] == '/') + abs[--plen] = '\0'; + + key = aprintf ("%s:%d:%s", u->host ? u->host : "", u->port, abs); + xfree (abs); + return key; +} + +static bool +ftp_symlink_already_visited (const struct url *u, const char *linkto) +{ + char *key; + bool seen; + + if (!ftp_visited_symlinks) + return false; + key = ftp_symlink_cycle_key (u, linkto); + seen = hash_table_contains (ftp_visited_symlinks, key) != 0; + xfree (key); + return seen; +} + +static void +ftp_symlink_mark_visited (const struct url *u, const char *linkto) +{ + char *key; + + if (!ftp_visited_symlinks) + ftp_visited_symlinks = make_string_hash_table (0); + key = ftp_symlink_cycle_key (u, linkto); + if (hash_table_contains (ftp_visited_symlinks, key)) + xfree (key); + else + hash_table_put (ftp_visited_symlinks, key, "1"); +} + /* Retrieve a list of files given in struct fileinfo linked list. If a file is a symbolic link, do not retrieve it, but rather try to set up a similar link on the local disk, if the symlinks are @@ -2312,6 +2376,25 @@ The sizes do not match (local %s) -- retrieving.\n\n"), switch (f->type) { case FT_SYMLINK: + /* --ftp-recurse-symlink-dirs: treat a symlink as if it were + a directory so ftp_retrieve_dirs will CWD into it. The + FTP server resolves the symlink server-side; we only need + to avoid infinite loops from circular links. */ + if (opt.ftp_recurse_symlink_dirs && opt.recursive && f->linkto) + { + if (ftp_symlink_already_visited (u, f->linkto)) + { + logprintf (LOG_VERBOSE, + _("Symlink cycle detected at %s -> %s, skipping.\n"), + quote_n (0, f->name), quote_n (1, f->linkto)); + break; + } + ftp_symlink_mark_visited (u, f->linkto); + DEBUGP (("Reclassifying symlink %s -> %s as directory for recursion.\n", + f->name, f->linkto)); + f->type = FT_DIRECTORY; + break; + } /* If opt.retr_symlinks is defined, we treat symlinks as if they were normal files. There is currently no way to distinguish whether they might be directories, and diff --git a/src/ftp.h b/src/ftp.h index 21ed5c062..a6ada2b4d 100644 --- a/src/ftp.h +++ b/src/ftp.h @@ -1,6 +1,6 @@ /* Declarations for FTP support. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/gnutls.c b/src/gnutls.c index cfcdf671d..fe049a503 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -1,6 +1,6 @@ /* SSL support via GnuTLS library. - Copyright (C) 2005-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2005-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/hash.c b/src/hash.c index 670ec1cf6..25b4d0fea 100644 --- a/src/hash.c +++ b/src/hash.c @@ -1,6 +1,6 @@ /* Hash tables. - Copyright (C) 2000-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2000-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -33,6 +33,8 @@ as that of the covered work. */ #ifndef STANDALONE # include "wget.h" +#else +# include "config.h" #endif #include diff --git a/src/hash.h b/src/hash.h index da6dd1ab9..d8fe9631e 100644 --- a/src/hash.h +++ b/src/hash.h @@ -1,5 +1,5 @@ /* Hash table declarations. - Copyright (C) 2000, 2007-2011, 2015, 2018-2024 Free Software + Copyright (C) 2000, 2007-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/host.c b/src/host.c index 76527a6be..499bc06db 100644 --- a/src/host.c +++ b/src/host.c @@ -1,6 +1,6 @@ /* Host name resolution and matching. - Copyright (C) 1996-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/host.h b/src/host.h index f07f5177d..35cbb342b 100644 --- a/src/host.h +++ b/src/host.h @@ -1,6 +1,6 @@ /* Declarations for host.c - Copyright (C) 1996-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/hsts.c b/src/hsts.c index e00bb1b91..a7d20a2a3 100644 --- a/src/hsts.c +++ b/src/hsts.c @@ -1,6 +1,6 @@ /* HTTP Strict Transport Security (HSTS) support. - Copyright (C) 1996-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/hsts.h b/src/hsts.h index cdeb3080e..550eac3cd 100644 --- a/src/hsts.h +++ b/src/hsts.h @@ -1,6 +1,6 @@ /* Declarations for hsts.c - Copyright (C) 1996-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/html-parse.c b/src/html-parse.c index d724384d3..65eccaaa9 100644 --- a/src/html-parse.c +++ b/src/html-parse.c @@ -1,6 +1,6 @@ /* HTML parser for Wget. - Copyright (C) 1998-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1998-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/html-parse.h b/src/html-parse.h index 54501838c..236e180ce 100644 --- a/src/html-parse.h +++ b/src/html-parse.h @@ -1,6 +1,6 @@ /* Declarations for html-parse.c. - Copyright (C) 1998-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1998-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/html-url.c b/src/html-url.c index 8e9600922..9229d9460 100644 --- a/src/html-url.c +++ b/src/html-url.c @@ -1,6 +1,6 @@ /* Collect URLs from HTML source. - Copyright (C) 1998-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1998-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -932,7 +932,7 @@ get_urls_file (const char *file, bool *read_again) url_text = merged; } - new_url = rewrite_shorthand_url (url_text); + new_url = maybe_prepend_scheme (url_text); if (new_url) { xfree (url_text); diff --git a/src/html-url.h b/src/html-url.h index cf80e43d7..552ea9a91 100644 --- a/src/html-url.h +++ b/src/html-url.h @@ -1,6 +1,6 @@ /* Declarations for html-url.c. - Copyright (C) 1995-1997, 2009-2011, 2015, 2018-2024 Free Software - Foundation, Inc. + Copyright (C) 1995-1997, 2009-2011, 2015, 2018-2024, 2026 Free + Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/http-ntlm.c b/src/http-ntlm.c index ee054e0b2..df9603b0d 100644 --- a/src/http-ntlm.c +++ b/src/http-ntlm.c @@ -1,6 +1,6 @@ /* NTLM code. - Copyright (C) 2005-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2005-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. Contributed by Daniel Stenberg. This file is part of GNU Wget. diff --git a/src/http-ntlm.h b/src/http-ntlm.h index 58e67fc8b..5b47bac0c 100644 --- a/src/http-ntlm.h +++ b/src/http-ntlm.h @@ -1,7 +1,7 @@ #ifndef __HTTP_NTLM_H #define __HTTP_NTLM_H /* Declarations for http_ntlm.c - Copyright (C) 1995-1997, 2000, 2007-2011, 2015, 2018-2024 Free + Copyright (C) 1995-1997, 2000, 2007-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. Contributed by Daniel Stenberg. diff --git a/src/http.c b/src/http.c index 0ff4572a9..570b72a72 100644 --- a/src/http.c +++ b/src/http.c @@ -1,5 +1,5 @@ /* HTTP support. - Copyright (C) 1996-2012, 2014-2015, 2018-2024 Free Software + Copyright (C) 1996-2012, 2014-2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -4244,7 +4244,6 @@ http_loop (const struct url *u, struct url *original_url, char **newloc, struct stat st; bool send_head_first = true; bool force_full_retrieve = false; - bool return_local_file; /* If we are writing to a WARC file: always retrieve the whole file. */ if (opt.warc_filename != NULL) @@ -4253,11 +4252,6 @@ http_loop (const struct url *u, struct url *original_url, char **newloc, /* Assert that no value for *LOCAL_FILE was passed. */ assert (local_file == NULL || *local_file == NULL); - /* Set LOCAL_FILE parameter. */ - return_local_file = local_file && opt.output_document && !HYPHENP (opt.output_document); - -// return_local_file = (local_file && opt.output_document && !HYPHENP (opt.output_document)); - /* Reset NEWLOC parameter. */ *newloc = NULL; diff --git a/src/http.h b/src/http.h index 570f76837..2856230dd 100644 --- a/src/http.h +++ b/src/http.h @@ -1,6 +1,6 @@ /* Declarations for HTTP. - Copyright (C) 2005-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2005-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/init.c b/src/init.c index 10557e305..2cf6f58ec 100644 --- a/src/init.c +++ b/src/init.c @@ -1,5 +1,5 @@ /* Reading/parsing the initialization file. - Copyright (C) 1996-2012, 2014-2015, 2018-2024 Free Software + Copyright (C) 1996-2012, 2014-2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -206,6 +206,7 @@ static const struct { { "ftppasswd", &opt.ftp_passwd, cmd_string }, /* deprecated */ { "ftppassword", &opt.ftp_passwd, cmd_string }, { "ftpproxy", &opt.ftp_proxy, cmd_string }, + { "ftprecursesymlinkdirs", &opt.ftp_recurse_symlink_dirs, cmd_boolean }, #ifdef HAVE_SSL { "ftpscleardataconnection", &opt.ftps_clear_data_connection, cmd_boolean }, { "ftpsfallbacktoftp", &opt.ftps_fallback_to_ftp, cmd_boolean }, @@ -448,6 +449,11 @@ defaults (void) */ opt.retr_symlinks = true; + /* Disabled by default: a malicious FTP server could use circular + symlinks to cause excessive downloads. Cycle detection mitigates + this, but the conservative default preserves historical behavior. */ + opt.ftp_recurse_symlink_dirs = false; + #ifdef HAVE_SSL opt.check_cert = CHECK_CERT_ON; opt.ftps_resume_ssl = true; @@ -937,9 +943,9 @@ setval_internal_tilde (int comind, const char *com, const char *val) ret = setval_internal (comind, com, val); /* We make tilde expansion for cmd_file and cmd_directory */ - if (((commands[comind].action == cmd_file) || + if (ret && ((commands[comind].action == cmd_file) || (commands[comind].action == cmd_directory)) - && ret && (*val == '~' && ISSEP (val[1]))) + && (*val == '~' && ISSEP (val[1]))) { pstring = commands[comind].place; if (opt.homedir) diff --git a/src/init.h b/src/init.h index d8857a06b..76c555ca0 100644 --- a/src/init.h +++ b/src/init.h @@ -1,6 +1,6 @@ /* Declarations for init.c. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/iri.c b/src/iri.c index 351357daa..3a3306f1e 100644 --- a/src/iri.c +++ b/src/iri.c @@ -1,6 +1,6 @@ /* IRI related functions. - Copyright (C) 2008-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2008-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/iri.h b/src/iri.h index 2f033105c..5d3961c1e 100644 --- a/src/iri.h +++ b/src/iri.h @@ -1,6 +1,6 @@ /* Internationalization related declarations. - Copyright (C) 2008-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2008-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/log.c b/src/log.c index c0451a2cb..fe8c3982c 100644 --- a/src/log.c +++ b/src/log.c @@ -1,6 +1,6 @@ /* Messages logging. - Copyright (C) 1998-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1998-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/log.h b/src/log.h index 74b943923..679b83db9 100644 --- a/src/log.h +++ b/src/log.h @@ -1,6 +1,6 @@ /* Declarations for log.c. - Copyright (C) 1998-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1998-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/main.c b/src/main.c index 77b1a0b6f..680883bbb 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ /* Command line parsing. - Copyright (C) 1996-2015, 2018-2024 Free Software Foundation, Inc. + Copyright (C) 1996-2015, 2018-2024, 2026 Free Software Foundation, + Inc. This file is part of GNU Wget. @@ -325,6 +326,7 @@ static struct cmdline_option option_data[] = #ifdef __VMS { "ftp-stmlf", 0, OPT_BOOLEAN, "ftpstmlf", -1 }, #endif /* def __VMS */ + { "ftp-recurse-symlink-dirs", 0, OPT_BOOLEAN, "ftprecursesymlinkdirs", -1 }, { "ftp-user", 0, OPT_VALUE, "ftpuser", -1 }, IF_SSL ( "ftps-clear-data-connection", 0, OPT_BOOLEAN, "ftpscleardataconnection", -1 ) IF_SSL ( "ftps-fallback-to-ftp", 0, OPT_BOOLEAN, "ftpsfallbacktoftp", -1 ) @@ -696,13 +698,13 @@ Download:\n"), --read-timeout=SECS set the read timeout to SECS\n"), N_("\ -w, --wait=SECONDS wait SECONDS between retrievals\n\ - (applies if more then 1 URL is to be retrieved)\n"), + (applies if more than 1 URL is to be retrieved)\n"), N_("\ --waitretry=SECONDS wait 1..SECONDS between retries of a retrieval\n\ - (applies if more then 1 URL is to be retrieved)\n"), + (applies if more than 1 URL is to be retrieved)\n"), N_("\ --random-wait wait from 0.5*WAIT...1.5*WAIT secs between retrievals\n\ - (applies if more then 1 URL is to be retrieved)\n"), + (applies if more than 1 URL is to be retrieved)\n"), N_("\ --no-proxy explicitly turn off proxy\n"), N_("\ @@ -917,6 +919,8 @@ FTP options:\n"), --preserve-permissions preserve remote file permissions\n"), N_("\ --retr-symlinks when recursing, get linked-to files (not dir)\n"), + N_("\ + --ftp-recurse-symlink-dirs when recursing, descend into symlinks to directories\n"), "\n", #ifdef HAVE_SSL @@ -2126,7 +2130,7 @@ only if outputting to a regular file.\n")); struct iri *iri = iri_new (); struct url *url_parsed; - t = rewrite_shorthand_url (argv[optind]); + t = maybe_prepend_scheme (argv[optind]); if (!t) t = argv[optind]; diff --git a/src/metalink.c b/src/metalink.c index de2439c90..9e355fd09 100644 --- a/src/metalink.c +++ b/src/metalink.c @@ -1,5 +1,5 @@ /* Metalink module. - Copyright (C) 2015, 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/metalink.h b/src/metalink.h index bd8b99c9a..28659c71b 100644 --- a/src/metalink.h +++ b/src/metalink.h @@ -1,5 +1,5 @@ /* Declarations for metalink.c. - Copyright (C) 2015, 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/mswindows.c b/src/mswindows.c index 5b3685607..95d389ca2 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -1,5 +1,5 @@ /* mswindows.c -- Windows-specific support - Copyright (C) 1996-2011, 2014-2015, 2018-2024 Free Software + Copyright (C) 1996-2011, 2014-2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -310,6 +310,17 @@ fake_fork (void) /* We failed, return. */ } + +/* + * This is the corresponding Windows implementation of + * set_fd_nonblocking() function in utils.c + * Currently it is an empty no-op. Maybe, we will get to + * implementing a nice solution one day + */ +void +set_fd_nonblocking(const int fd) +{} + /* This is the corresponding Windows implementation of the fork_to_background() function in utils.c. */ bool diff --git a/src/mswindows.h b/src/mswindows.h index 3409e6853..39853820b 100644 --- a/src/mswindows.h +++ b/src/mswindows.h @@ -1,6 +1,6 @@ /* Declarations for windows - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -74,5 +74,6 @@ void ws_percenttitle (double); char *ws_mypath (void); void windows_main (char **); void set_windows_fd_as_blocking_socket (int); +void set_fd_nonblocking(const int); #endif /* MSWINDOWS_H */ diff --git a/src/netrc.c b/src/netrc.c index 285f595c4..343c174a3 100644 --- a/src/netrc.c +++ b/src/netrc.c @@ -1,5 +1,5 @@ /* Read and parse the .netrc file to get hosts, accounts, and passwords. - Copyright (C) 1996, 2007-2011, 2015, 2018-2024 Free Software + Copyright (C) 1996, 2007-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/netrc.h b/src/netrc.h index b7fc1b372..658aa5788 100644 --- a/src/netrc.h +++ b/src/netrc.h @@ -1,5 +1,5 @@ /* Declarations for netrc.c - Copyright (C) 1996, 1996-1997, 2007-2011, 2015, 2018-2024 Free + Copyright (C) 1996, 1996-1997, 2007-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. diff --git a/src/openssl.c b/src/openssl.c index a97087530..0e16373f8 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -1,6 +1,6 @@ /* SSL support via OpenSSL library. - Copyright (C) 2000-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2000-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. Originally contributed by Christian Fraenkel. This file is part of GNU Wget. diff --git a/src/options.h b/src/options.h index 78fbceb01..c4a5b6f55 100644 --- a/src/options.h +++ b/src/options.h @@ -1,6 +1,6 @@ /* struct options. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -117,6 +117,9 @@ struct options retrieving? */ bool retr_symlinks; /* Whether we retrieve symlinks in FTP. */ + bool ftp_recurse_symlink_dirs;/* When recursing over FTP, descend + through symlinks whose target is a + directory. */ char *output_document; /* The output file to which the documents will be printed. */ char *warc_filename; /* WARC output filename */ diff --git a/src/progress.c b/src/progress.c index 4ea30f425..863d0e26b 100644 --- a/src/progress.c +++ b/src/progress.c @@ -1,6 +1,6 @@ /* Download progress. - Copyright (C) 2001-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2001-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/progress.h b/src/progress.h index 5b69cd5de..1cefa5e1e 100644 --- a/src/progress.h +++ b/src/progress.h @@ -1,6 +1,6 @@ /* Download progress. - Copyright (C) 2001-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2001-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/ptimer.c b/src/ptimer.c index 0e6888153..1ae7fd947 100644 --- a/src/ptimer.c +++ b/src/ptimer.c @@ -1,6 +1,6 @@ /* Portable timers. - Copyright (C) 2005-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2005-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/ptimer.h b/src/ptimer.h index 288bd0cb7..a9e300368 100644 --- a/src/ptimer.h +++ b/src/ptimer.h @@ -1,6 +1,6 @@ /* Declarations for ptimer.c. - Copyright (C) 2005-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2005-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/recur.c b/src/recur.c index ba35f56db..ba9e01dd5 100644 --- a/src/recur.c +++ b/src/recur.c @@ -1,6 +1,6 @@ /* Handling of recursive HTTP retrieving. - Copyright (C) 1996-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/recur.h b/src/recur.h index e5a3a8421..c2b082d48 100644 --- a/src/recur.h +++ b/src/recur.h @@ -1,6 +1,6 @@ /* Declarations for recur.c. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/res.c b/src/res.c index 7131ca876..b7b130bee 100644 --- a/src/res.c +++ b/src/res.c @@ -1,5 +1,5 @@ /* Support for Robot Exclusion Standard (RES). - Copyright (C) 2001, 2006-2011, 2015, 2018-2024 Free Software + Copyright (C) 2001, 2006-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of Wget. diff --git a/src/res.h b/src/res.h index 9f7fafa0a..4b07b3c56 100644 --- a/src/res.h +++ b/src/res.h @@ -1,5 +1,5 @@ /* Declarations for res.c. - Copyright (C) 2001, 2007-2011, 2015, 2018-2024 Free Software + Copyright (C) 2001, 2007-2011, 2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of Wget. diff --git a/src/retr.c b/src/retr.c index f54a8083d..b2212efa4 100644 --- a/src/retr.c +++ b/src/retr.c @@ -1,5 +1,5 @@ /* File retrieval. - Copyright (C) 1996-2011, 2014-2015, 2018-2024 Free Software + Copyright (C) 1996-2011, 2014-2015, 2018-2024, 2026 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -1182,6 +1182,8 @@ static uerr_t retrieve_from_url_list(struct urlpos *url_list, int *count, struct struct urlpos *cur_url; uerr_t status; + status = RETROK; /* Suppose everything is OK. */ + for (cur_url = url_list; cur_url; cur_url = cur_url->next, ++*count) { char *filename = NULL, *new_file = NULL, *proxy; @@ -1267,7 +1269,6 @@ retrieve_from_file (const char *file, bool html, int *count) char *input_file, *url_file = NULL; const char *url = file; - status = RETROK; /* Suppose everything is OK. */ *count = 0; /* Reset the URL count. */ /* sXXXav : Assume filename and links in the file are in the locale */ @@ -1545,7 +1546,7 @@ getproxy (struct url *u) /* Handle shorthands. `rewritten_storage' is a kludge to allow getproxy() to return static storage. */ - rewritten_url = rewrite_shorthand_url (proxy); + rewritten_url = maybe_prepend_scheme (proxy); if (rewritten_url) return rewritten_url; diff --git a/src/retr.h b/src/retr.h index 9509f5edf..47778c1a1 100644 --- a/src/retr.h +++ b/src/retr.h @@ -1,6 +1,6 @@ /* Declarations for retr.c. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/spider.c b/src/spider.c index 95709d152..e31a5066a 100644 --- a/src/spider.c +++ b/src/spider.c @@ -1,6 +1,6 @@ /* Keep track of visited URLs in spider mode. - Copyright (C) 2006-2011, 2015, 2019-2024 Free Software Foundation, - Inc. + Copyright (C) 2006-2011, 2015, 2019-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/spider.h b/src/spider.h index 4626ccd27..49a09b086 100644 --- a/src/spider.h +++ b/src/spider.h @@ -1,6 +1,6 @@ /* Declarations for spider.c - Copyright (C) 2006-2011, 2015, 2019-2024 Free Software Foundation, - Inc. + Copyright (C) 2006-2011, 2015, 2019-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/ssl.h b/src/ssl.h index c2d760afa..14f52f0c4 100644 --- a/src/ssl.h +++ b/src/ssl.h @@ -1,6 +1,6 @@ /* SSL support. - Copyright (C) 2000-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2000-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. Originally contributed by Christian Fraenkel. This file is part of GNU Wget. diff --git a/src/sysdep.h b/src/sysdep.h index fe59f7f90..adabd7ed8 100644 --- a/src/sysdep.h +++ b/src/sysdep.h @@ -1,6 +1,6 @@ /* Dirty system-dependent hacks. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/url.c b/src/url.c index 07c3bc876..c7801769c 100644 --- a/src/url.c +++ b/src/url.c @@ -1,6 +1,6 @@ /* URL handling. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -594,60 +594,39 @@ parse_credentials (const char *beg, const char *end, char **user, char **passwd) return true; } -/* Used by main.c: detect URLs written using the "shorthand" URL forms - originally popularized by Netscape and NcFTP. HTTP shorthands look - like this: - - www.foo.com[:port]/dir/file -> http://www.foo.com[:port]/dir/file - www.foo.com[:port] -> http://www.foo.com[:port] - - FTP shorthands look like this: - - foo.bar.com:dir/file -> ftp://foo.bar.com/dir/file - foo.bar.com:/absdir/file -> ftp://foo.bar.com//absdir/file +static bool is_valid_port(const char *p) +{ + unsigned port = (unsigned) atoi (p); + if (port == 0 || port > 65535) + return false; - If the URL needs not or cannot be rewritten, return NULL. */ + int digits = strspn (p, "0123456789"); + return digits && (p[digits] == '/' || p[digits] == '\0'); +} +/* Prepend "http://" to url if scheme is missing, otherwise return NULL. */ char * -rewrite_shorthand_url (const char *url) +maybe_prepend_scheme (const char *url) { - const char *p; - char *ret; - if (url_scheme (url) != SCHEME_INVALID) return NULL; - /* Look for a ':' or '/'. The former signifies NcFTP syntax, the - latter Netscape. */ - p = strpbrk (url, ":/"); + const char *p = strchr (url, ':'); if (p == url) return NULL; /* If we're looking at "://", it means the URL uses a scheme we don't support, which may include "https" when compiled without - SSL support. Don't bogusly rewrite such URLs. */ + SSL support. Don't bogusly prepend "http://" to such URLs. */ if (p && p[0] == ':' && p[1] == '/' && p[2] == '/') return NULL; - if (p && *p == ':') - { - /* Colon indicates ftp, as in foo.bar.com:path. Check for - special case of http port number ("localhost:10000"). */ - int digits = strspn (p + 1, "0123456789"); - if (digits && (p[1 + digits] == '/' || p[1 + digits] == '\0')) - goto http; - - /* Turn "foo.bar.com:path" to "ftp://foo.bar.com/path". */ - if ((ret = aprintf ("ftp://%s", url)) != NULL) - ret[6 + (p - url)] = '/'; - } - else - { - http: - /* Just prepend "http://" to URL. */ - ret = aprintf ("http://%s", url); - } - return ret; + if (p && p[0] == ':' && !is_valid_port (p + 1)) + return NULL; + + + logprintf (LOG_VERBOSE, _ ("Prepended http:// to '%s'\n"), url); + return aprintf ("http://%s", url); } static void split_path (const char *, char **, char **); diff --git a/src/url.h b/src/url.h index 2dfbf30b3..ba220ab15 100644 --- a/src/url.h +++ b/src/url.h @@ -1,6 +1,6 @@ /* Declarations for url.c. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -128,7 +128,7 @@ char *uri_merge (const char *, const char *); int mkalldirs (const char *); -char *rewrite_shorthand_url (const char *); +char *maybe_prepend_scheme (const char *); bool schemes_are_similar_p (enum url_scheme a, enum url_scheme b); bool are_urls_equal (const char *u1, const char *u2); diff --git a/src/utils.c b/src/utils.c index 8c33fa5f7..b70fa54c5 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,6 +1,6 @@ /* Various utility functions. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -1273,6 +1273,21 @@ wget_read_file (const char *file) return wget_read_from_file(file, &left_open); } +/* + * Set a file-descriptor to be non-blocking. + * Since the needed fcntl flags are not implemented in gnulib + * for Windows, we will provide an alternate stub implementation + * in mswindows.c. The stub will be a no-op and will prevent + * asynchronous file operations on Windows, but such is life + */ +#if !defined(WINDOWS) && !defined(MSDOS) +static void set_fd_nonblocking(const int fd) +{ + int flags = fcntl(fd, F_GETFL, 0); + fcntl(fd, F_SETFL, flags | O_NONBLOCK); +} +#endif + /* Read FILE into memory. A pointer to `struct file_memory' are returned; use struct element `content' to access file contents, and the element `length' to know the file length. `content' is *not* @@ -1303,8 +1318,6 @@ wget_read_from_file (const char *file, bool *left_open) if (HYPHENP (file)) { fd = fileno (stdin); - int flags = fcntl(fd, F_GETFL, 0); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); inhibit_close = true; /* Note that we don't inhibit mmap() in this case. If stdin is redirected from a regular file, mmap() will still work. */ @@ -1314,6 +1327,7 @@ wget_read_from_file (const char *file, bool *left_open) fd = open (file, O_RDONLY); if (fd < 0) return NULL; + set_fd_nonblocking(fd); fm = xnew (struct file_memory); #ifdef HAVE_MMAP @@ -2496,12 +2510,12 @@ compile_posix_regex (const char *str) * see https://sourceware.org/glibc/wiki/Security%20Exceptions */ str = "a"; #endif - int errcode = regcomp ((regex_t *) regex, str, REG_EXTENDED | REG_NOSUB); + int errcode = regcomp (regex, str, REG_EXTENDED | REG_NOSUB); if (errcode != 0) { - size_t errbuf_size = regerror (errcode, (regex_t *) regex, NULL, 0); + size_t errbuf_size = regerror (errcode, regex, NULL, 0); char *errbuf = xmalloc (errbuf_size); - regerror (errcode, (regex_t *) regex, errbuf, errbuf_size); + regerror (errcode, regex, errbuf, errbuf_size); fprintf (stderr, _("Invalid regular expression %s, %s\n"), quote (str), errbuf); xfree (errbuf); diff --git a/src/utils.h b/src/utils.h index 2e6a979f5..f3cc8f7b9 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,6 +1,6 @@ /* Declarations for utils.c. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -31,8 +31,8 @@ as that of the covered work. */ #ifndef UTILS_H #define UTILS_H -#include #include +#include /* Constant is using when we don`t know attempted size exactly */ #define UNKNOWN_ATTEMPTED_SIZE -3 @@ -164,7 +164,7 @@ const char *print_decimal (double); long get_max_length (const char *path, int length, int name); #ifndef HAVE_STRLCPY -size_t strlcpy (char *dst, const char *src, size_t size); +size_t strlcpy (char * restrict dst, const char * restrict src, size_t size); #endif void wg_hex_to_string (char *str_buffer, const char *hex_buffer, size_t hex_len); diff --git a/src/version.h b/src/version.h index 5a84474de..c16f089fc 100644 --- a/src/version.h +++ b/src/version.h @@ -1,5 +1,6 @@ /* Extern declarations for printing version information - Copyright (C) 2013, 2015, 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2013, 2015, 2018-2024, 2026 Free Software Foundation, + Inc. This file is part of GNU Wget. diff --git a/src/warc.c b/src/warc.c index 230bd36ff..fa9a92c76 100644 --- a/src/warc.c +++ b/src/warc.c @@ -1,6 +1,6 @@ /* Utility functions for writing WARC files. - Copyright (C) 2011-2012, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2011-2012, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/src/wget.h b/src/wget.h index c33407253..92b63e60e 100644 --- a/src/wget.h +++ b/src/wget.h @@ -1,6 +1,6 @@ /* Miscellaneous declarations. - Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 1996-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -222,6 +222,7 @@ static inline unsigned char _unhex(unsigned char c) } \ if (DR_newsize) { \ void *basevar_new = xrealloc (basevar, DR_newsize * sizeof (type)); \ + assert(basevar_new); \ if (basevar_new != basevar) { \ memset (basevar_new + sizevar_old * sizeof (type), 0, (DR_newsize - sizevar_old) * sizeof (type)); \ basevar = basevar_new; \ diff --git a/src/xattr.c b/src/xattr.c index 0a7ff8248..d25de5aac 100644 --- a/src/xattr.c +++ b/src/xattr.c @@ -1,6 +1,6 @@ /* xattr.h -- POSIX Extended Attribute support. - Copyright (C) 2016, 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2016, 2018-2024, 2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/xattr.h b/src/xattr.h index 0ed873d6a..814dcae33 100644 --- a/src/xattr.h +++ b/src/xattr.h @@ -1,6 +1,6 @@ /* xattr.h -- POSIX Extended Attribute function mappings. - Copyright (C) 2016, 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2016, 2018-2024, 2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/testenv/Makefile.am b/testenv/Makefile.am index a592e9087..a2e96ddc9 100644 --- a/testenv/Makefile.am +++ b/testenv/Makefile.am @@ -1,5 +1,6 @@ # Makefile for `wget' utility -# Copyright (C) 2013, 2015, 2018-2024 Free Software Foundation, Inc. +# Copyright (C) 2013, 2015, 2018-2024, 2026 Free Software Foundation, +# Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tests/Makefile.am b/tests/Makefile.am index f9ee54e4c..a05778761 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ # Makefile for `wget' utility -# Copyright (C) 1995-2011, 2015, 2018-2024 Free Software Foundation, -# Inc. +# Copyright (C) 1995-2011, 2015, 2018-2024, 2026 Free Software +# Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tests/unit-tests.c b/tests/unit-tests.c index 28b9328ab..e9695e981 100644 --- a/tests/unit-tests.c +++ b/tests/unit-tests.c @@ -1,6 +1,6 @@ /* Unit testing. - Copyright (C) 2005-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2005-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/tests/unit-tests.h b/tests/unit-tests.h index 44635f0cd..4402c0173 100644 --- a/tests/unit-tests.h +++ b/tests/unit-tests.h @@ -1,6 +1,6 @@ /* Unit testing declarations. - Copyright (C) 2005-2011, 2015, 2018-2024 Free Software Foundation, - Inc. + Copyright (C) 2005-2011, 2015, 2018-2024, 2026 Free Software + Foundation, Inc. This file is part of GNU Wget. diff --git a/util/Makefile.am b/util/Makefile.am index f40cee2b2..b2d2687f8 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -1,6 +1,6 @@ # Makefile for `wget' utility -# Copyright (C) 1995-1997, 2007-2011, 2015, 2018-2024 Free Software -# Foundation, Inc. +# Copyright (C) 1995-1997, 2007-2011, 2015, 2018-2024, 2026 Free +# Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/util/paramcheck.pl b/util/paramcheck.pl index d6839a53c..81e50ee95 100755 --- a/util/paramcheck.pl +++ b/util/paramcheck.pl @@ -1,7 +1,7 @@ #!/usr/bin/env perl -# Copyright (C) 2008-2011, 2015, 2018-2024 Free Software Foundation, -# Inc. +# Copyright (C) 2008-2011, 2015, 2018-2024, 2026 Free Software +# Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/util/rmold.pl b/util/rmold.pl index eb61fda35..87f69a3fa 100755 --- a/util/rmold.pl +++ b/util/rmold.pl @@ -1,7 +1,7 @@ #!/usr/bin/env perl -w -# Copyright (C) 1995-1997, 2007-2011, 2015, 2018-2024 Free Software -# Foundation, Inc. +# Copyright (C) 1995-1997, 2007-2011, 2015, 2018-2024, 2026 Free +# Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by