Commit Graph

3487 Commits

Author SHA1 Message Date
69d3692c95 * docs/libwget.doxy.in: Skip building graphs because too complex 2025-12-30 17:51:54 +01:00
7b0b8e0fe1 * docs/wget2.md: Fix html examples in text 2025-12-30 17:51:08 +01:00
ceabf85d26 * README.md: Fix anchor links for Gitlab 2025-12-30 17:15:54 +01:00
b6b195707f Fix --server-response for HTTP/1.1 (#705)
* libwget/http.c (wget_http_get_response_cb): Clone header memory.
2025-12-30 17:07:31 +01:00
defac2cfcd Fix convert-links (#709)
* src/wget.c (convert_links): process URL the same way as in normalize_uri().
* tests/Makefile.am: Add new test file test-k-percent-encoding.c.
* tests/test-k-percent-encoding.c: New file.
2025-12-30 14:27:13 +01:00
bb324b89f2 * src/wget.c: Set exit status 8 on 403 2025-12-29 20:05:12 +01:00
b966fa041a * libwget/ssl_openssl.c (wget_ssl_set_config_int): Ignore WGET_SSL_DANE 2025-12-29 20:04:39 +01:00
89dde538d4 * .gitlab-ci.yml (Sanitizers/Debian): Fetch fuzzer corpora from git 2025-12-29 18:54:29 +01:00
8bd2fb62cc tests/test-limit-rate-http2.c: Increase timeout variance for valgrind tests 2025-12-29 17:56:35 +01:00
d801660640 * tests/test-ocsp-server.c: Silence syntax-check 2025-12-29 17:54:00 +01:00
37010560fc * tests/test-ocsp-server.c: Skip some tests for OpenSSL 2025-12-29 17:47:11 +01:00
f21cdfdaa6 * .gitlab-ci.yml: Fix artifacts for Scan-Build/Debian 2025-12-29 17:38:55 +01:00
5181f2ca30 * src/wget.c (set_file_metadata): Explicitly set errno to 0 2025-12-29 17:37:10 +01:00
8dbbe1e6f4 src/options.c (preload_dns_cache): Simplify fopen/fclose logic to calm scan-build 2025-12-29 17:32:07 +01:00
fe3605c49b * configure.ac: Disable several clang warnings for gnulib code 2025-12-29 17:09:51 +01:00
f1822db636 * tests/libtest.c: Use wget lib functions instead of select() 2025-12-29 14:41:50 +01:00
225e58fa42 * configure.ac: Disable UBSAN flag 'function' 2025-12-29 14:18:37 +01:00
684be47852 Fix file overwrite issue with metalink
Fix a remotely triggered arbitrary file write/overwrite abusing
metalink <file name="…"> path traversal.

Reported-by: Arkadi <arkadva8@gmail.com>
2025-12-26 19:17:42 +01:00
fc7fcbc00e Fix remote buffer overflow in get_local_filename_real()
In src/blacklist.c:get_local_filename_real(), the stack/heap selection for
fname_esc was inverted, so the code used `char tmp[1024]` exactly when the
required size is >1024, leading to stack corruption when
wget_restrict_file_name() writes into it.

This was introduced by commit 3dc30f5f0c.

Reported-by: Arkadi <arkadva8@gmail.com>
2025-12-26 18:27:29 +01:00
43cd61f0f5 * .gitlab-ci.yml: Drop -Werror for Sanitizer runner 2025-12-26 17:55:13 +01:00
ba4d64e443 Fix WolfSSL build
* Makefile.am: Run tests of GnuTLS is available.
* configure.ac: Add conditional WITH_GNUTLS_IN_TESTSUITE,
  add check for SSLv2_client_method().
* libwget/ssl_wolfssl.c (wget_ssl_init): Silently fall back to
  SSLv3 if SSLv2 is requested but not available.
2025-12-26 17:42:16 +01:00
4626211f57 * libwget/ssl_wolfssl.c (ShowX509): Fix -Wzero-as-null-pointer-constant 2025-12-26 17:42:16 +01:00
8e62f3a38f * .gitlab-ci.yml: Drop i386 CI runner 2025-12-26 17:42:15 +01:00
5766fd3e2a * .gitlab-ci.yml: Drop HTTP2 CI runner 2025-12-26 17:42:15 +01:00
7189cf41c5 Add comprehensive HTTP/2 testing infrastructure with libnghttp2
This adds extensive HTTP/2 test coverage using libnghttp2 as the test
server, covering multiplexing, stream error handling, connection
management, and settings negotiation.

* tests/libtest.h (wget_test_url_t): Add h2_delay_response and
  h2_rst_stream_error fields for HTTP/2 test control.
  (WGET_TEST_H2_MIN_CONCURRENT_STREAMS): New test flag.
  (wget_test_get_h2_server_port): Declare function.

* tests/libtest.c: Remove HAVE_MICROHTTPD_HTTP2_H infrastructure,
  (h2_session_data, h2_server_t): New structures for libnghttp2 server,
  (h2_send_callback, h2_recv_callback): Implement nghttp2 I/O callbacks,
  (h2_on_frame_recv_callback): Handle HTTP/2 frames,
  (h2_on_header_callback): Process request headers,
  (h2_data_read_callback): Stream response body with 8KB chunk limit,
  (h2_on_stream_close_callback): Clean up stream resources,
  (h2_session_data_new, h2_session_data_free): Manage session lifecycle,
  (h2_server_thread): Main server loop with TLS and ALPN support,
  (h2_server_start, h2_server_stop): Control server lifecycle,
  (_http_server_stop): Remove gnutls_global_deinit() call to fix
  server restart issues,
  (wget_test_start_server_handler): Default start_h2 to 0 (opt-in),
  enable HTTP/2 with WGET_TEST_H2_ONLY flag,
  (wget_test): Skip H2_PASS when libnghttp2 unavailable,
  (wget_test_get_h2_server_port): Return HTTP/2 server port.

* tests/Makefile.am (WGET_TESTS): Add test-http2-multiplexing,
  test-http2-stream-errors, test-http2-connection-errors,
  test-http2-settings.

* tests/test-http2-multiplexing.c: New file testing concurrent
  downloads over single HTTP/2 connection with multiplexing.

* tests/test-http2-stream-errors.c: New file testing stream error
  isolation with RST_STREAM frames.

* tests/test-http2-connection-errors.c: New file testing connection
  recovery after server restart.

* tests/test-http2-settings.c: New file testing SETTINGS frame
  exchange, header compression, and large headers.

* tests/test-limit-rate-http2.c (main): Skip 3-file multiplexed
  download test when running with HTTP/2 due to rate limiting
  limitations in test server.

The HTTP/2 test server uses libnghttp2 with GnuTLS for TLS and ALPN
negotiation. Tests verify protocol-specific features like multiplexing,
stream independence, and proper SETTINGS exchange. HTTP/2 is now opt-in
via WGET_TEST_H2_ONLY to avoid breaking existing tests.
2025-12-26 17:42:15 +01:00
c2a9108c4d Fix checks for errno
* libwget/ssl_gnutls.c (ssl_writev): Only check errno on error.
* src/job.c (job_validate_file): Set errno explicitly to 0.
* src/utils.c (mkdir_path): Check a secure value of errno.
* src/wget.c (prepare_file): Likewise.
2025-12-14 18:56:19 +01:00
087b931b7d * src/options.c (set_long_option): Allow 'no_' prefix in config options 2025-12-07 19:35:24 +01:00
a479b1aeaf * html_url (html_get_url): Remove dead code (Coverity #209327) 2025-12-07 18:09:29 +01:00
c7eb342fd1 * README.md: Remove OpenCSW badges (build pipeline isn't maintained since a while) 2025-12-07 18:03:56 +01:00
18165409bb Fix gcc 15 -Wunterminated-string-initialization
* libwget/base64.c (base64_encode): Drop explicit error length.
* libwget/buffer_printf.c (convert_pointer): Likewise.

Just cosmetics - allows to build with -Werror.
2025-11-09 19:43:29 +01:00
b02444a10a Fix gcc 15 -Wzero-as-null-pointer-constant
* libwget/logger.c (wget_logger_is_active): Fix warning.
* libwget/ssl_gnutls.c (verify_certificate_callback): Likewise.
* src/host.c (_search_host_for_free_job): Likewise.
* src/wget.c (main, input_thread): Likewise.

Just cosmetics - allows to build with -Werror.
2025-11-09 19:31:19 +01:00
ce1736518a * configure.ac: Hide m4_ifdef from autopoint 2025-11-09 19:28:04 +01:00
0d59934e3b * gnulib: Update 2025-11-09 19:13:30 +01:00
ba30ace241 bootstrap: Sync with gnulib 2025-10-14 17:22:59 +05:30
a57e87aaca gnulib: Pull forward 2025-10-14 17:20:48 +05:30
262a8d5b5c * contrib:Dockerfile.win32.static: Update and fix build 2025-08-03 17:48:31 +02:00
e69c0aa511 * contrib/Dockerfile.win32.static: Use upstream gnulib with git 2025-07-12 19:37:55 +02:00
400713caeb Fix redirect regression
* src/wget.c (process_response_header): Follow location header.

Fixes https://gitlab.com/gnuwget/wget2/-/issues/689
Reported-by: https://gitlab.com/omos
2025-02-02 19:42:49 +01:00
07d10bd090 Drop iri->uri_allocated
* include/wget/wget.h (struct wget_iri_st): Remove uri_allocated.
* libwget/iri.c (wget_iri_free_content): Do not free iri->uri,
  (wget_iri_clone): Simplify code and do not heap-allocate iri->uri.
2025-02-02 19:19:47 +01:00
9949f9d48d Fix buffer overflow in wget_iri_clone() after wget_iri_set_scheme()
* fuzz/libwget_iri_fuzzer.c: Call wget_iri_clone() after wget_iri_set_scheme().
* libwget/iri.c (wget_iri_parse): Increase value of iri->msize,
  (wget_iri_clone): Use wget_memdup() instead of malloc+memcpy,
  (wget_iri_set_scheme): Tiny code cleanup.

Fixes: https://gitlab.com/gnuwget/wget2/-/issues/687
Reported-by: https://gitlab.com/gleurent
2025-02-02 19:19:32 +01:00
bc77fe1c8a Add --show-progress
* src/options.c (struct optionw options): Add show-progress item.

Copyright-paperwork-exempt: Yes
2025-01-30 19:38:42 +01:00
0651b0a447 * src/wget.c: use _() to translate info and error strings 2025-01-01 15:07:01 +01:00
4d4d9b3a4d Fix sorting of metalink mirrors by priority
* libwget/metalink.c (compare_mirror): Fix implementation.

Reported-by: Aidan Harris (https://gitlab.com/aidanharris)
2024-12-08 19:27:22 +01:00
15c06c2f2a Fix metalink with -O/--output-document
* src/wget.c (process_response): Handle config.output_document.

Reported-by: Aidan Harris (https://gitlab.com/aidanharris)
2024-12-08 19:26:06 +01:00
709067e544 Fix chunk_size conversion on 32bit arch
* src/wget.c (process_head_response): Cast size_t to long long.
* src/wget_options.h (struct config): Change type of chunk_size from size_t to long long.

Reported-by: https://gitlab.com/uhle
2024-12-01 19:54:46 +01:00
15ef8c390c * src/wget.c (queue_url_from_remote): Make messages consistent 2024-12-01 19:31:44 +01:00
ff8ff4dc98 * src/wget.c (in_pattern_list): Change return type from int to boolean 2024-12-01 19:15:54 +01:00
ad80bf39ce Prevent file truncation with --no-clobber
* src/options.c (init): Check config.clobber.
2024-12-01 13:37:47 +01:00
1372b17202 Use the local system timestamp when requested via --no-use-server-timestamps.
* src/wget.c (http_receive_response): Check config.use_server_timestamps.
2024-12-01 13:29:33 +01:00
e4a04807d7 * src/utils.c (wget_restrict_file_name): Explicitly use signed char
Fix test--restrict-ascii failures on aarch64, s390x and ppc64le.
2024-11-30 19:52:47 +01:00