637 Commits

Author SHA1 Message Date
0390345ceb Fix redirect/mirror regression from 400713ca (#698)
* src/wget.c (process_response_header): Delegate link handling to process_response().
* tests/Makefile.am: Add test-link-location.c.
* tests/test-link-location.c: New test file.
2025-12-30 18:26:14 +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
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
f1822db636 * tests/libtest.c: Use wget lib functions instead of select() 2025-12-29 14:41:50 +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
253d8daf41 * tests/valgrind-suppressions: Suppress libc6 2.40 getaddrinfo/memmove 2024-10-03 18:03:41 +02:00
2b1f266ca6 Fix status 8 for failed redirection of robots.txt
* src/wget.c (queue_url_from_remote): Copy job->robotstxt flag for redirections"
* tests/test-redirection.c: Add test for correct status code after robots redirection fails"

Fixes https://gitlab.com/gnuwget/wget2/-/issues/677
2024-08-29 17:00:29 +02:00
769dc861fc * tests/valgrind-suppressions: Drop libgpgme version from suppression 2024-05-21 13:56:10 +02:00
570a022fd2 * tests/Makefile.am: Add suppression files 2024-05-21 13:56:02 +02:00
e8f1e99c96 Accept --progress=dot:... for backwards compatibility
* src/options.c (parse_progress_type): Fix checking dot options.
* tests/test-wget-1.c: Add check for --progress variants.
2024-05-20 13:19:15 +02:00
b5dc13759d * tests/libtest.c: Fix two memleaks 2024-05-19 13:18:19 +02:00
24419cd330 * tests/libtest.c: Remove superfluous casts 2024-05-18 19:26:37 +02:00
715e646642 Fix tests/test-ocsp-server
* tests/libtest.c: Handle > 1 OCSP responses.
* tests/libtest.h: Rename WGET_TEST_OCSP_RESP_FILE to WGET_TEST_OCSP_RESP_FILES.
* tests/test-ocsp-server.c: Make use of WGET_TEST_OCSP_RESP_FILES.
2024-05-12 19:51:44 +02:00
329d1282ca Limit cases where methods are redirected to GET
* tests/test-spider-r.c: Add new test for redirections with spider
* src/wget.c(process_response_header): Prevent changing the request
  method during a redirection to GET.

Fixes: #660
2024-04-29 19:54:14 +02:00
d55ecc7113 Update gnulib link libraries
* fuzz/Makefile.am: Update gnulib link libraries.
* libwget/Makefile.am: Likewise.
* src/Makefile.am: Likewise.
* tests/Makefile.am: Likewise.
* unit-tests/Makefile.am: Likewise.
2024-03-24 15:58:27 +01:00
1bb48422fd Skip failing OCSP tests with WolfSSL
* tests/test-ocsp-server.c: Skip failing tests.
* tests/test-ocsp-stap.c: Likewise.
2024-03-23 16:03:54 +01:00
a4f368e5b5 tests/test-page-requisites.c: Add HTML source/srcset to tests 2024-01-27 18:39:35 +01:00
ae1decb981 * tests/test-timestamping.c: Pass correct type to variadic function 2024-01-14 16:54:33 +00:00
188989e067 Update copyright year 2024-01-07 12:41:02 +01:00
0415d036b3 Fix minor typos in comments 2023-11-04 14:36:43 +01:00
15ba1db248 Update copyrights 2023-08-31 12:57:30 +02:00
3fb56d60ff Fix parsing HTMP/XML entities in URLs from HTML/XML
* libwget/xml.c (wget_xml_decode_entities_inline): Fix decoding of &#dddd; and &#xhhhh;.
* tests/test-base.c (main): Add test case for &#dddd; and &#xhhhh;.

Reported-by: Michael Roosz
2023-08-27 20:38:17 +02:00
dad7aaa868 * tests/test-timestamping.c: Replace VLA 2023-07-31 18:19:18 +02:00
1ba0dfc383 * tests/test-include-and-exclude-directories.c: Replace VLA 2023-07-31 18:19:18 +02:00
471ba2bd2e * tests/test-metalink.c: Replace VLA 2023-07-31 18:19:18 +02:00
b33a61a67e * tests/libtest.c: Replace VLA 2023-07-29 19:01:21 +02:00
bcef2ad0ca tests/libtest.c (wget_test): Don't use backslash in path for MINGW32 2023-07-08 12:17:17 +02:00
b50bce35be * tests/test-parse-css.c (main): Add data url to test 2023-05-28 18:00:02 +02:00
261d05e082 Decode numeric XML entities
* libwget/xml.c (wget_xml_decode_entities_inline): Decode numeric entities.
* tests/test-base.c (main): Add test.
2022-12-02 13:00:06 +01:00
dcad432329 * tests/valgrind-suppressions: Suppress memleak in gpgme_data_new_from_mem() 2022-08-14 14:48:50 +02:00
7f2db0c398 Fix status code for 5xx errors
* src/wget.c (process_response_header): Set EXIT_STATUS_REMOTE on 5xx.
* tests/test-i-https.c: New test to check 503 behavior.
* tests/test-wget-1.c: Likewise.
2022-07-01 18:19:42 +02:00
0ed4616ad0 Refactor and fix code formatting
* libwget/vector.c: Refactor
* libwget/xml.c: Refactor
* tests/test-include-and-exclude-directories.c: Refactor
* tests/libtest.c: Fix code formatting
2022-06-25 14:09:39 +02:00
7292244bec Add tests for --level
* tests/Makefile.am: Add test-level.c.
* tests/test-level.c: New file with tests for --level.
2022-04-03 14:52:36 +02:00
4a24762773 * tests/test-robots.c (main): Add a test for --no-robots 2022-04-03 13:16:55 +02:00
0f554ef216 * */Makefile.am: Reorder link libraries (libgnu.la first) 2022-03-05 16:23:15 +01:00
336a22b1ac Fix copyright statements 2022-02-25 17:56:49 +01:00
3dc7f71098 Update copyright year 2022-02-25 17:46:43 +01:00
be4e2deaf9 Fix -k/--convert-links fragment
* src/wget.c (convert_link_file_only): Use wget_debug_printf instead of wget_info_printf,
  (convert_links): Add fragment.
* tests/test-k.c: Add fragment to test.
2022-02-20 19:05:46 +01:00
72f48aaa1f Properly escape URLs with -k/--convert-links
* src/wget.c (convert_link_whole): Use wget_iri_escape_path() instead of wget_buffer_strcat().
* tests/test-k.c (main): Add test of URL with query part including escaped characters.
2022-02-20 18:32:54 +01:00
954c3c19b6 * tests/test--*.c: Rename to test-*.c 2022-02-19 18:44:50 +01:00
66d24458d0 Fix --directory-prefix with --content-disposition
* src/blacklist.c (get_local_filename): Remove static from definition.
* src/wget_blacklist.h (get_local_filename): Add declaration.
* src/wget.c (process_response): Use get_local_filename() to process
  the filename from Content-Disposition,
  (get_header): Likewise.
* tests/Makefile.am: Add new test file test-directory-prefix.c.
* tests/test-directory-prefix.c: New test file.
2022-02-18 19:57:14 +01:00
c5e393f818 * tests/valgrind-suppressions: Suppress glibc false positive in dynnamic loading 2022-01-01 18:42:06 +01:00
974d1f1dbc * tests/libtest.c (wget_test): Add --gen-suppressions=all to valgrind options 2022-01-01 18:41:23 +01:00
1d260ecfef Add support for unquoted HTML attribute values
* libwget/xml.c (getHTMLValue): New function.
  (getValue): Call getHTMLValue if parsing HTML.
* tests/test-base.c: Use an unquoted HREF value to trigger the new code.
2022-01-01 17:55:36 +01:00
b3582cccdc * tests/libtest.c: Replace gnutls_free() with free()
I did this after having issues to build a static MinGW Wget2.exe.
gnutls_free() was not properly exported by libgnutls.a.
2021-10-31 15:25:42 +01:00
5dedff4c42 * tests/test--page-requisites.c: Add tests for new rel parsing 2021-08-08 09:56:14 +02:00
1358405061 Fix building without TLS library
This changes configure semantics to fail if no TLS library
is found and no --with-ssl=none was explicitly requested.
It protects users from accidentally building without TLS.

* .gitlab-ci.yml: Tarball build using --with-ssl=none.
* configure.ac: Stop with error if no TLS was found and --with-ssl
  was not used.
* tests/libtest.c: Fix issues with conditionally declared variables.
2021-02-07 12:34:39 +01:00
d123cb89a7 * tests/test-ocsp-server.c: Skip cert revocation check for WolfSSL 2021-02-06 19:47:02 +01:00