Commit Graph

616 Commits

Author SHA1 Message Date
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
39a5e91407 * tests/test-post-handshake-auth.c (main.c): Fix warning when building with non-gnutls libraries 2021-02-06 19:47:02 +01:00
258506ce85 Separate GnuTLS in wget2 and in test suite
* configure.ac: Separate GnuTLS in wget2 and in test suite.
* tests/libtest.c: Use WITH_GNUTLS_OCSP insteadof WITH_OCSP.
2021-02-06 19:47:02 +01:00
420c5672e0 * tests/test-chunked.c: Extend test with hand-crafted chunked pattern 2021-01-31 19:21:59 +01:00
22162f82b2 Update copyright year 2021-01-22 21:58:38 +01:00
280f74c4b3 Fix combination of redirections with --retry-on-http-error
* src/wget.c: Move some code logic around.
* tests/test-interrupt-response.c: Correct expected wget2 exit status.
* tests/test-redirection.c: Add tests for --retry-on-http-error.

Reported-by: Sergei Litvin
2020-12-27 14:37:11 +01:00
f8427fa1af * tests/libtest.c (wget_test): Add --tries=1 to wget2 command line 2020-12-27 11:28:32 +01:00
e584b0052b * tests/libtest.c (wget_test_start_server): Fix warning 'break will never be executed' 2020-12-25 19:02:41 +01:00
3a9401a62a * tests/libtest.c (wget_test_start_server): Fix unused variable warning 2020-12-25 19:00:42 +01:00
cc19fdf5c4 Fix findings from scan-build 11
* tests/libtest.c (_parse_hostname): Fix += into +.
  (_answer_to_connection): Limit scope of body_len.
2020-12-20 17:13:00 +01:00
1948557a4c Implement --download-attr=[strippath|usepath]
* docs/wget2.md: Amend docs.
* src/options.c: Add parse_download_attr(),
  amend option --download-attr.
* src/wget.c (queue_url_from_remote): Strip path if
  DOWNLOAD_ATTR_STRIPPATH is set.
* src/wget_options.h: Add enum download_attr_mode.
* tests/test-download-attr.c: Test strippath and usepath.
2020-09-13 17:16:55 +02:00
318d53b9ed Update OCSP responses and certs
tests/certs/ocsp/*: Fix the cert stack for the testing HTTPS+OCSP server.
2020-09-05 17:51:28 +02:00
fd0fb3236e libtest: send normal cert chain in OCSP stapling HTTPS server
* tests/libtest.c (_ocsp_stap_cert_callback): rename variable
   'pcert' -> 'certs'.
   (_http_server_start): send normal cert chain in responses.
2020-09-05 17:47:41 +02:00
bcda2c6d6d OpenSSL: Enable test-ocsp-stap
This commit enables the test `test-ocsp-stap`

It was previously skipped for OpenSSL since OCSP stapling was not
yet implemented in OpenSSL.

This commit also modifies these tests to pass the --no-ocsp-date flag to
wget2.

 * tests/test-ocsp-stap.c (main): remove ifdef clause; pass
   --no-ocsp-date flag.
2020-09-05 17:47:41 +02:00
e88c29c88f OpenSSL: Implement OCSP stapling
* libwget/ssl_openssl.c (ocsp_resp_cb): new function: stapled OCSP
  response callback.
  (check_ocsp_response): do not check OCSP nonce here.
  (verify_ocsp): check OCSP nonce here.
  (openssl_init): set stapled OCSP callback function, ocsp_resp_cb.
  (openssl_open): send status_request extension in handshake.
* tests/libtest.c (_http_server_start): Fix callback macro
2020-09-05 17:47:15 +02:00
9b88044a66 * tests/libtest.c: Fix MHD 0.97.1 ABI/API breakage 2020-07-26 11:52:49 +02:00
cb20de8e01 Remove CR and LF from URLs
* libwget/iri.c (iri_unescape_inline): Remove CR/LF from URL.
* tests/test-base.c: Add CR+LF into URL.

References
https://gitlab.com/gnuwget/wget2/-/issues/522
2020-04-22 13:49:08 +02:00
0a40b647dd Create test cases
* tests/test-wget-1.c (main): Create test cases for --chunk-size with --progress
2020-04-19 14:19:56 +08:00
27c382c9e7 test-ocsp-stap: Skip
OCSP stapling is not yet supported in OpenSSL.

 * tests/test-ocsp-stap.c (main): skip this test in OpenSSL
2020-04-07 10:26:11 +02:00
239ec8a976 Include serverAuth extension in OCSP certificates
Since the OCSP tests use the same certificate chain for both the OCSP server and
the HTTPS server, the 'serverAuth' flags needs to be added, in addition to the OCSP flags.

OpenSSL will refuse to run a TLS handshake for HTTPS if that flag is not present.

 * tests/certs/ocsp/demoCA/*, tests/certs/ocsp/*.pem: change testing certificates
 * tests/certs/ocsp/ocsp_resp_revoked.der,
   tests/certs/ocsp/ocsp_stapled_resp.der
   tests/certs/ocsp/ocsp_resp_ok.der: update OCSP responses to contain
   the new certificates
 * tests/certs/ocsp/interm.cnf: add the serverAuth extension
 * tests/certs/ocsp/root-template.txt: likewise
2020-03-30 21:37:14 +02:00
a8b7bf99b9 Adapt configure.ac to support multiple SSL/TLS backends
This patch modifies `configure.ac` to support GnuTLS, OpenSSL and wolfSSL as the SSL/TLS backends.

Either of these can be enabled at compile time the `configure` switch `--with-ssl`. Example:

    ./configure --with-ssl=openssl

If `--with-ssl` is omitted, the default behavior will be to build with GnuTLS if available, and without
TLS if not. TLS can be explicitly disabled with `--without-ssl`.

Regardless of which specific backend has been selected, the TLS and OCSP tests will always be built with GnuTLS,
as that is the only backend currently supported in the test suite.

It renames the constant `HAVE_GNUTLS_OCSP_H` to a more generic `WITH_OCSP`, that captures
the notion that OCSP has been enabled at compile-time, hiding the specific backend.

Changed files

 * configure.ac: honor --with-ssl option, but keep on testing for GnuTLS
   for the test suite.
 * libwget/ssl_gnutls.c: replace HAVE_GNUTLS_OCSP_H with WITH_OCSP
 * libwget/ssl_openssl.c: likewise
 * tests/libtest.c: replace HAVE_GNUTLS_OCSP_H with WITH_OCSP.
   Check for WITH_GNUTLS_IN_TESTSUITE.
2020-03-30 21:29:35 +02:00
0c5f786756 Fix indentation for some tests
* tests/test-parse-css.c: Fix indentation.
* tests/test-parse-html-css.c: Likewise.
* tests/test-parse-rss.c: Likewise.
2020-03-17 16:49:35 +01:00