Package: wget Version: 1.25.0-2 Severity: normal X-Debbugs-Cc: [email protected]
When wget reads a list of input URLs from a pipe on stdin with `--input-file=-`, it may break URLs in the middle of a line depending on the speed and buffering of the input pipe. If the program writing into wget's standard input writes 1024 bytes, say, wget may treat the partial line leading up to the 1024th byte as a complete URL, even though more data is forthcoming. The remainder of the URL after the 1024th byte, when it is written, is itself treated as a complete URL. Here is a reproduction recipe. It uses perl to write a file into wget's stdin in chunks, with a delay between each chunk. Write these contents to a file called input.txt: https://www.debian.org/index.html?param=11111111111111111111111111111111 https://www.debian.org/index.html?param=22222222222222222222222222222222 https://www.debian.org/index.html?param=33333333333333333333333333333333 https://www.debian.org/index.html?param=44444444444444444444444444444444 https://www.debian.org/index.html?param=55555555555555555555555555555555 https://www.debian.org/index.html?param=66666666666666666666666666666666 https://www.debian.org/index.html?param=77777777777777777777777777777777 If you run wget to read the input from the file input.txt, it works as expected, saving 7 files: $ wget --no-verbose --directory-prefix=file --input-file input.txt 2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=11111111111111111111111111111111 [15862/15862] -> "file/index.html?param=11111111111111111111111111111111" [1] 2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=22222222222222222222222222222222 [15862/15862] -> "file/index.html?param=22222222222222222222222222222222" [1] 2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=33333333333333333333333333333333 [15862/15862] -> "file/index.html?param=33333333333333333333333333333333" [1] 2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=44444444444444444444444444444444 [15862/15862] -> "file/index.html?param=44444444444444444444444444444444" [1] 2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=55555555555555555555555555555555 [15862/15862] -> "file/index.html?param=55555555555555555555555555555555" [1] 2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=66666666666666666666666666666666 [15862/15862] -> "file/index.html?param=66666666666666666666666666666666" [1] 2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=77777777777777777777777777777777 [15862/15862] -> "file/index.html?param=77777777777777777777777777777777" [1] FINISHED --2026-12-04 23:42:04-- Total wall clock time: 0.9s Downloaded: 7 files, 108K in 0.06s (1.70 MB/s) Now pipe input.txt through a program that buffers it in 192-byte chunks. The 3rd and 6th lines coincide with the chunk boundaries and each get split into two URLs: $ perl -e '$| = 1; my $buf; do { read(STDIN, $buf, 192); print($buf); sleep 1; } while ($buf);' < input.txt | wget --no-verbose --directory-prefix=pipe --input-file=- 2026-12-04 23:40:51 URL:https://www.debian.org/index.html?param=11111111111111111111111111111111 [15862/15862] -> "pipe/index.html?param=11111111111111111111111111111111" [1] 2026-12-04 23:40:52 URL:https://www.debian.org/index.html?param=22222222222222222222222222222222 [15862/15862] -> "pipe/index.html?param=22222222222222222222222222222222" [1] 2026-12-04 23:40:52 URL:https://www.debian.org/index.html?param=333333 [15862/15862] -> "pipe/index.html?param=333333" [1] Prepended http:// to '33333333333333333333333333' wget: unable to resolve host address ‘33333333333333333333333333’ 2026-12-04 23:40:52 URL:https://www.debian.org/index.html?param=44444444444444444444444444444444 [15862/15862] -> "pipe/index.html?param=44444444444444444444444444444444" [1] 2026-12-04 23:40:52 URL:https://www.debian.org/index.html?param=55555555555555555555555555555555 [15862/15862] -> "pipe/index.html?param=55555555555555555555555555555555" [1] wget: unable to resolve host address ‘www.debian.’ Prepended http:// to 'org/index.html?param=66666666666666666666666666666666' wget: unable to resolve host address ‘org’ 2026-12-04 23:40:53 URL:https://www.debian.org/index.html?param=77777777777777777777777777777777 [15862/15862] -> "pipe/index.html?param=77777777777777777777777777777777" [1] FINISHED --2026-12-04 23:40:55-- Total wall clock time: 4.0s Downloaded: 6 files, 93K in 0.07s (1.35 MB/s) If you want to know what I was doing when I ran into this problem, I was running a command that uses wget to fetch a JSON file, filters the JSON with jq to output a list of URLs, and piping the list into another instance of wget to download the files. https://gitlab.torproject.org/dcf/snowflake-graphs/-/blob/f702555796b6372c2df3a18af12a259d9db1148b/README.md#L83 wget -O - https://collector.torproject.org/index/index.json | jq -r '.directories[]|select(.path == "archive").directories[]|select(.path == "snowflakes").files[]|("https://collector.torproject.org/archive/snowflakes/"+.path)' | wget --input-file=- --timestamping --directory-prefix=./descriptors/ I found that the URL spanning the 4096-byte boundary was getting split: https://collector.torproject.org/archive/bridge-descriptors/extra-in fos/bridge-extra-infos-2020-03.tar.xz -- System Information: Debian Release: 13.8 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 6.12.118+deb13-amd64 (SMP w/4 CPU threads; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages wget depends on: ii libc6 2.41-12+deb13u5 ii libgnutls30t64 3.8.9-3+deb13u4 ii libidn2-0 2.3.8-2 ii libnettle8t64 3.10.1-1 ii libpcre2-8-0 10.46-1~deb13u3 ii libpsl5t64 0.21.2-1.1+b1 ii libuuid1 2.41.5-0+deb13u1 ii zlib1g 1:1.3.dfsg+really1.3.1-1+deb13u1 Versions of packages wget recommends: ii ca-certificates 20250419+deb13u1 wget suggests no packages. -- no debconf information

