Commit Graph

221 Commits

Author SHA1 Message Date
15ba1db248 Update copyrights 2023-08-31 12:57:30 +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
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
3dc7f71098 Update copyright year 2022-02-25 17:46:43 +01:00
974d1f1dbc * tests/libtest.c (wget_test): Add --gen-suppressions=all to valgrind options 2022-01-01 18:41:23 +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
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
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
22162f82b2 Update copyright year 2021-01-22 21:58:38 +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
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
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
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
42461e5313 Added test simulations of aborts while sending response body
* tests/Makefile.am: add tests/test-interrupt-response test
* tests/libtest.c (_callback_interruptable, _answer_to_connection):
  add interruptable response callback, enable in wget_test_url_t
  settings
* tests/libtest.h: added interrupt_response_mode and
  interrupt_response_after_nbytes to wget_test_url_t
* tests/test-interrupt-response.c: add test for interruptable
  responses and interrupt of responses while timestamping active
2020-01-31 19:19:45 +01:00
6c387c468f * tests/libtest.c (wget_test): Reduce timeout from 10s to 3s 2020-01-31 19:19:07 +01:00
7c09403e00 * tests/libtest.c (wget_test): Amend error output to be more informative / prominent 2020-01-31 19:18:54 +01:00
59d9ecd9c0 * Update copyright year to 2020 2020-01-10 00:33:02 +01:00
d0740ec9e8 * tests/libtest.c: Fix implicit conversion 2020-01-06 13:06:17 +01:00
85f33e164a * tests/libtest.c (wget_test): Fix output, make use of wget_read_file() 2019-11-06 11:51:47 +01:00
5d72533570 Fix license of all tests
All the tests in tests/ are part of Wget2 the binary, not libwget. Fix
the license and copyright information accordingly.

* tests/libtest.c: libwget -> Wget. LGPLv3+ -> GPLv3+
* tests/test--accept.c: Same
* tests/test--filter-mime-type.c: Same
* tests/test--follow-tags.c: Same
* tests/test--https-enforce-hard1.c: Same
* tests/test--https-enforce-hard2.c: Same
* tests/test--https-enforce-hard3.c: Same
* tests/test--https-enforce-soft1.c: Same
* tests/test--https-enforce-soft2.c: Same
* tests/test--https-enforce-soft3.c: Same
* tests/test--page-requisites.c: Same
* tests/test--post-file.c: Same
* tests/test--save-content-on.c: Same
* tests/test--spider-r.c: Same
* tests/test-E-k.c: Same
* tests/test-auth-basic.c: Same
* tests/test-auth-digest.c: Same
* tests/test-bad-chunk.c: Same
* tests/test-base.c: Same
* tests/test-c-r.c: Same
* tests/test-chunked.c: Same
* tests/test-compression.c: Same
* tests/test-cut-dirs.c: Same
* tests/test-cut-get-vars.c: Same
* tests/test-directory-clash.c: Same
* tests/test-ftp.c: Same
* tests/test-ftps.c: Same
* tests/test-gpg-bad.c: Same
* tests/test-gpg-invalid.c: Same
* tests/test-gpg-missing.c: Same
* tests/test-gpg-save-failed.c: Same
* tests/test-gpg-styles.c: Same
* tests/test-gpg-valid.c: Same
* tests/test-gpg-verify-no-file.c: Same
* tests/test-gzip.c: Same
* tests/test-i-http.c: Same
* tests/test-i-https.c: Same
* tests/test-idn-cmd.c: Same
* tests/test-idn-meta.c: Same
* tests/test-idn-robots.c: Same
* tests/test-include-and-exclude-directories.c: Same
* tests/test-iri-disabled.c: Same
* tests/test-iri-forced-remote.c: Same
* tests/test-iri-list.c: Same
* tests/test-iri-percent.c: Same
* tests/test-iri-subdir.c: Same
* tests/test-iri.c: Same
* tests/test-k.c: Same
* tests/test-limit-rate-http2.c: Same
* tests/test-limit-rate.c: Same
* tests/test-meta-robots.c: Same
* tests/test-metalink.c: Same
* tests/test-np.c: Same
* tests/test-ocsp-server.c: Same
* tests/test-ocsp-stap.c: Same
* tests/test-p-nc.c: Same
* tests/test-parse-css.c: Same
* tests/test-parse-html-css.c: Same
* tests/test-parse-rss.c: Same
* tests/test-plugin-dummy.c: Same
* tests/test-plugin-failure.c: Same
* tests/test-plugin-interception.c: Same
* tests/test-plugin-nonexistance.c: Same
* tests/test-plugin.c: Same
* tests/test-post-handhshake-auth.c: Same
* tests/test-redirection.c: Same
* tests/test-restrict-ascii.c: Same
* tests/test-robots.c: Same
* tests/test-stats-dns.c: Same
* tests/test-stats-ocsp.c: Same
* tests/test-stats-server.c: Same
* tests/test-stats-site.c: Same
* tests/test-stats-tls.c: Same
* tests/test-timestamping.c: Same
* tests/test-unlink.c: Same
* tests/test-wget-1.c: Same
2019-11-02 16:10:19 +01:00
5e54cdaa07 * tests/libtest.c (_answer_to_connection): Switch off Content-Length sanity checks in MHD 2019-10-29 18:44:13 +01:00
45349f5b12 * tests/libtest.c (wget_test_start_server): Print MHD info 2019-10-29 18:44:10 +01:00
53d309228f * tests/libtest.c (_http_server_start): Fix checks for MHD options 2019-10-29 18:44:06 +01:00
93f28a0c71 * tests/libtest.c: Fix CI failure 2019-10-28 10:56:59 +01:00
8927c62877 * tests/libtest.c (_http_server_start): Make use of MHD_OPTION_SERVER_INSANITY 2019-10-28 10:48:21 +01:00
80eba1c1e6 Add wget_test_set_executable() to test suite
* tests/libtest.h: Add declaration of wget_test_set_executable()
* tests/libtest.c: Add definition of wget_test_set_executable(),
  add global variable 'global_executable',
  (wget_test): Use 'global_executable' to initialize 'executable',
  (wget_test): Use 'executable' if set
2019-10-27 20:17:10 +01:00
fc62c2f4b9 Add method check for test suite
* tests/libtest.h: Add expected_method to wget_test_url_t
* tests/libtest.c (_answer_to_connection): Check method against expected_method
2019-10-27 19:24:28 +01:00
33308b6b88 * tests/libtest.c (_answer_to_connection): Free query.params 2019-10-27 18:35:54 +01:00
c3a71b74eb * tests/libtest.c (_answer_to_connection): More code cleanup 2019-10-27 17:22:21 +01:00
671a779bf5 * tests/libtest.c (_answer_to_connection): Simplify URL expansion 2019-10-27 16:57:39 +01:00
5f34843e94 * tests/libtest.c (_answer_to_connection): Code cleanup 2019-10-27 16:25:38 +01:00
f58dbf9a8a * tests/libtest.c (_answer_to_connection): Set given status code for response 2019-10-27 15:57:22 +01:00
7a9690b4c5 * tests/libtest.c (wget_test_check_file_system): Use memcmp() instead of strcmp() 2019-10-10 15:41:33 +02:00
77c3c33ec8 Use int64_t for time_t to fix 32bit time_t limitations
* include/wget/wget.h: Use int64_t instead of time_t
* libwget/hpkp.c: Likewise
* libwget/hsts.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* libwget/tls_session.c: Likewise
* src/options.c: Likewise
* src/stats_site.c: Likewise
* src/wget.c: Likewise
* tests/libtest.c: Likewise
* tests/libtest.h: Likewise
* tests/test-plugin-dummy.c: Likewise
* unit-tests/test.c: Likewise
2019-09-23 21:17:38 +02:00
bfe8f8fdb0 * tests/libtest.c (wget_test): Print expected+real content of diverting files 2019-09-23 15:11:54 +02:00
758b038b61 Add new wget_test() option WGET_TEST_CLEAN_DIRECTORY
* tests/libtest.c: Implement WGET_TEST_CLEAN_DIRECTORY
* tests/libtest.h: Add WGET_TEST_CLEAN_DIRECTORY
2019-09-17 12:51:02 +02:00
4b9edbad2d Update Copyright statements to be compatible with update-copyright module 2019-09-10 23:41:56 +02:00
a4dac96cf3 Update cfg.mk. Add comments for future
* cfg.mk: Multiple changes.
  (sc_GPL_version): Don't exclude all files when only one has a parsing
  issue
  (sc_po_check): Tests should always output English. Their output is for
  developers, not users
  (sc_prohibit_magic_number_exit): tests/test-plugin.c has a parsing
  issue that has been reported to gnulib. Others should be checked.
  (sc_trailing_blank): Fixed the relevant files instead of ignoring them
  (sc_two_space_separator_in_usage): Doesn't seem to trigger on removal
  (sc_prohibit_empty_lines_at_EOF): Same
  (sc_prohibit_sprintf): Same
  (sc_prohibit_printf): Re-arrange within file
  (sc_prohibit_free): Same
  (sc_prohibit_alloc): Same
  (sc_gettext_printf): Same
* docs/DoxygenLayout.xml: Remove trailing whitespaces
* docs/libwget.doxy.in: Same
* tests/libtest.c: Don't internationalize test suite strings
* tests/test-*.c: Use EXIT_FAILURE and EXIT_SUCCESS instead of 1 and 0
2019-09-10 23:02:05 +02:00
01a1df91fc * tests/libtest.c: Create directories if needed when creating WGET_TEST_EXISTING_FILES 2019-08-22 16:32:43 +02:00
2431f95929 * tests/libtest.c (_insert_ports): Fix for reject_https_connection 2019-08-21 21:46:21 +02:00
4e6e74e0a2 * tests/libtest.c: Add WGET_TEST_EXPECTED_ERROR_CODE2 2019-08-21 21:46:21 +02:00
9c1be02e6b Add WGET_TEST_HTTP_REJECT_CONNECTIONS to test suite
* tests/libtest.h: Add WGET_TEST_HTTP_REJECT_CONNECTIONS
* tests/libtest.c: Implement WGET_TEST_HTTP_REJECT_CONNECTIONS
2019-08-21 21:46:21 +02:00
1ac1437020 * tests/libtest.c (_parse_hostname): Silence clang's scan-build 2019-08-15 12:24:14 +02:00
aca61cdedb * tests/libtest.c: Make post_handshake_auth static 2019-08-12 16:16:28 +02:00
c2066642df * tests/libtest.c: Freed read response in-case no request is received by the responder 2019-08-10 18:53:35 +05:30