Commit Graph

2699 Commits

Author SHA1 Message Date
Вячеслав Петрищев
fb5e2e628d New implementation for openssl_read, openssl_peek ssl_connect_with_timeout (openssl)
Add new implementation for openssl_read, openssl_peek
ssl_connect_with_timeout (openssl). Thats allow continue
read after ETIMEDOUT (if timeout < opt.read_timeout)
without 'Retrying', and do not create thread (under MSWin)
for every read. Old implementation, (with fix for 'timeout')
avaible for build with: -DOPENSSL_RUN_WITHTIMEOUT

Add timeout for transport_implementation {reader,peeker};

* src/init.c (cmd_time): Add check for negative value.
* src/connect.h (transport_implementation {reader,peeker}): Change function prototype.
* src/connect.c (select_fd_nb): New function, aviod conversion to blocked under MSWin.
* src/gnutls.c
   (gnutls_read): Fix: using timeout, seting ETIMEDOUT, conversion to blocked.
   (gnutls_peek): Likewise.
   (wgnutls_errstr): Add errmsg for ETIMEDOUT.
   (_do_handshake) (_do_reauth): Fix conversion to blocked.
* src/openssl.c:
   Add new implementation for openssl_read, openssl_peek, ssl_connect_with_timeout.
   (init_prng): when option --random-file given warn user if RAND_load_file() fail.
2020-05-01 17:51:48 +02:00
Tim Rühsen
9dacc2836a Add missing linefeed in output strings
* src/ftp.c (getftp): Add linefeed to error message.
* src/res.c (res_parse_from_file): Likewise.
* src/utils.c (fopen_stat): Likewise.
  (open_stat): Likewise.
2020-04-18 18:39:50 +02:00
Tim Rühsen
6e5cf727c5 * src/metalink.c: Include filename.h instead of dosname.h 2020-03-28 19:26:12 +01:00
Tomas Hozza
706e71564c Don't print message about loading crl or ca-cert files with --no-verbose
* src/gnutls.c (ssl_init): Use LOG_VERBOSE verbosity for informative
  message related to loading CRL or CA certificate file.

Before change [1], wget didn't produce any output related to loading CA
certificates when --no-verbose option has been used. When --no-verbose
option is used, only error messages and basic information should get
printed. Information about loading CRL or CA certificate is probably not
a basic information. Any error when loading the CRL or CA certificate
will be still printed with --no-verbose.

Some users rely on wget not printing such information and they consider
it a regression.

Reported as https://bugzilla.redhat.com/show_bug.cgi?id=1807267

[1] http://git.savannah.gnu.org/cgit/wget.git/commit/?id=e4a8fe84e2b813b65d91aec29298eecabe4850a5

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2020-03-24 14:58:01 +01:00
Tim Rühsen
4221b5656a * src/http.c (check_auth): Fix memory leak 2020-03-06 12:09:02 +01:00
Tim Rühsen
fe5fbdd947 * src/http-ntlm.c (mkhash): Fix read buffer overflow 2020-03-06 11:37:57 +01:00
Tim Rühsen
238074e2b8 Add code coverage reporting
* configure.ac: Add AX_CODE_COVERAGE.
* Makefile.am: Add rules 'check-coverage' and 'fuzz-coverage'.
* fuzz/Makefile.am: Amend LDADD, AM_CFLAGS and AM_CPPFLAGS.
* src/Makefile.am: Amend LDADD, AM_CFLAGS and AM_CPPFLAGS.

This add a new configure option, --enable-code-coverage.

With this option enabled, generate test code coverage with
  make code-coverage
and generate coverage for the fuzz test corpora with
  make fuzz-coverage
2020-03-05 20:24:07 +01:00
Tim Rühsen
6377ae1647 * src/http.c: Don't cast 3rd param to request_set_header. 2020-03-05 19:19:42 +01:00
Tim Rühsen
eb02512a40 * src/http.c (gethttp): Remove unneeded free of hstat.(message|error) 2020-03-03 19:33:53 +01:00
Tim Rühsen
1ac3812e8a * src/http.c (gethttp): Fix memleaks
Reported-by: Вячеслав Петрищев
2020-03-03 18:38:41 +01:00
Tim Rühsen
910c0abe7a * src/http.c (read_response_body): Fix memleak
Reported-by: Вячеслав Петрищев
2020-03-03 10:26:09 +01:00
Tim Rühsen
f4a57afd42 Always build ssl_cleanup
* src/gnutls.c (ssl_cleanup): Don't build conditionally.
* src/openssl.c (ssl_cleanup): Likewise
2020-02-29 17:25:41 +01:00
Tim Rühsen
fded294d7a * src/convert.c (convert_cleanup): Free downloaded_css_set 2020-02-27 20:04:24 +01:00
Tim Rühsen
c0d76ec935 * src/openssl.c (ssl_cleanup): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:59:15 +01:00
Tim Rühsen
472823283c * src/gnutls.c (ssl_cleanup): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:59:05 +01:00
Tim Rühsen
b0e94e582b * src/netrc.c (netrc_cleanup): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:56:40 +01:00
Tim Rühsen
8215479ffb * src/log.c (log_cleanup): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:56:05 +01:00
Tim Rühsen
30139c6745 * src/host.c (host_cleanup): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:55:31 +01:00
Tim Rühsen
4588045b28 * src/spider.c (spider_cleanup): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:54:48 +01:00
Tim Rühsen
765271fdf5 * src/res.c (res_cleanup): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:53:57 +01:00
Tim Rühsen
e52e418bdd * src/convert.c (convert_cleanup): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:53:15 +01:00
Tim Rühsen
a3d3322a48 * src/html-url.c (cleanup_html_url): Only compile for DEBUG_MALLOC or TESTING 2020-02-27 19:51:55 +01:00
Tim Rühsen
ee187476de * src/http.c (http_cleanup): Free hashtable basic_authed_hosts 2020-02-27 19:33:47 +01:00
Tim Rühsen
8cd4dcc278 * src/cookies.c (cookie_jar_delete): Set psl to NULL after calling psl_free 2020-02-27 14:38:01 +01:00
Tim Rühsen
4d8bf37870 * src/init.c (cleanup): Call ssl_cleanup and connect_cleanup 2020-02-27 14:30:53 +01:00
Tim Rühsen
b209ca91fb Add ssl_cleanup to free memory
* src/ssl.h: Add declaration for ssl_cleanup.
* src/openssl.c: Add ssl_cleanup stub.
* src/gnutls.c: Implement ssl_cleanup.
2020-02-27 14:29:25 +01:00
Tim Rühsen
7146b9dc77 * src/http.c (http_cleanup): Call invalidate_persistent to free resources 2020-02-27 14:28:10 +01:00
Tim Rühsen
b3dc802efb * src/cookies.c: Free PSL in cookie_jar_delete 2020-02-27 14:27:05 +01:00
Tim Rühsen
6938c84aa4 * src/connect.c (connect_cleanup): Only needed with DEBUG_MALLOC or TESTING 2020-02-27 14:26:31 +01:00
Tim Rühsen
8010507d73 * src/http.c (http_loop): Avoid unneeded strdup 2020-02-27 11:35:50 +01:00
Вячеслав Петрищев
f747eea059 * src/http.c (gethttp): Fix memleak 2020-02-27 11:12:27 +01:00
Tim Rühsen
46a6e2957e * src/http.c: Do not reveal OS type to server via User-Agent: header
Following the "privacy by design" principle, which is now European law by
virtue of the GDPR since 2018, the client should not transmit the operating
system.

Fixes #57884
Reported-by: Bruno Haible
2020-02-23 18:51:10 +01:00
Tim Rühsen
8e130c32ba Split unique_name into two functions with just one arg
* src/http.c (check_file_output): Call unique_name_passthrough.
* src/metalink.c (badhash_suffix): Call unique_name.
* src/url.c (url_file_name): Call unique_name_passthrough.
* src/utils.c: Split unique_name, amend description.
* src/utils.h: Amend unique_name, add unique_name_passthrough.
2020-02-22 12:59:18 +01:00
Tim Rühsen
d08bdbc878 * src/http.c (print_response_line): Fixed comparison
Introduced in 68868bbb37 (13.2.2020).

Reported-by: Gisle Vanem
2020-02-22 08:47:20 +01:00
Tim Rühsen
9934e228ac * src/retr.c (fd_read_body): Check timer before accessing (Coverity #600494) 2020-02-21 17:46:41 +01:00
Tim Rühsen
c65bddc086 * src/warc.c (warc_write_start_record): Check return values of fseek, fflush (Coverity #1419650) 2020-02-21 17:38:41 +01:00
Tim Rühsen
c5d0e58d0d * src/ftp-ls.c (eat_carets): Fix caret decoding issue (Coverity #1419653) 2020-02-21 14:55:03 +01:00
Tim Rühsen
365c00a4a2 * src/warc.c (warc_write_block_from_file): Check for write error (Coverity #1419654) 2020-02-21 14:41:40 +01:00
Tim Rühsen
4e519f5a80 * src/warc.c (warc_write_end_record): Check return value of fseeko (Coverity #1419657) 2020-02-21 14:37:40 +01:00
Tim Rühsen
43820b67bf * src/init.c (setoptval): Add missing comma (fix compilation) 2020-02-20 17:04:02 +01:00
Tim Rühsen
b53c52c4c1 Fix typos found by codespell
*/*: Fix typos

Thanks to https://fossies.org/features.html#codespell

Reported-by: Jens Schleusener
2020-02-20 16:21:33 +01:00
Tim Rühsen
9df2e0d746 * src/init.c (setoptval): Silence Coverity (Coverity #1419648) 2020-02-20 13:46:36 +01:00
Tim Rühsen
ada3396c72 * src/main.c (init_switches): Remove unneeded code (Coverity #1419658) 2020-02-20 13:20:21 +01:00
Tim Rühsen
9b1b9961ef * src/ftp-ls.c (ftp_parse_vms_ls): Fix use of uninitialized stack mem (Coverity #609373) 2020-02-20 13:17:31 +01:00
Tim Rühsen
79438d4d87 * src/retr.c (retrieve_url): Fix memory leak (Coverity #1316408) 2020-02-19 20:36:36 +01:00
Tim Rühsen
1c16819558 * src/http.c (set_file_timestamp): Fix stack memory leak (Coverity #1419655) 2020-02-19 19:13:48 +01:00
Tim Rühsen
d3f5311087 * src/main.c (main): Initialize variable (Coverity #1419660) 2020-02-19 18:54:06 +01:00
Tim Rühsen
1dfd1aa1cf * src/http.c (metalink_from_http): Fix memleak (Coverity #1419661, #1419656) 2020-02-19 17:07:52 +01:00
Tim Rühsen
21bb9d54cb * src/progress.c (eta_to_human_short): Silence -Wformat-overflow 2020-02-19 14:44:21 +01:00
Tim Rühsen
e6b76459db Remove alloca includes and macros
* bootstrap.conf: Remove gnulib module 'alloca'.
* src/sysdep.h: Remove include of alloca.h.
* src/wget.h: Likewise,
  remove macros BOUNDED_TO_ALLOCA and STRDUP_ALLOCA.
2020-02-14 16:13:50 +01:00
Tim Rühsen
7aac99d6e5 * src/utils.h: Remove alloca_array 2020-02-14 16:09:36 +01:00
Tim Rühsen
28beee5e75 * src/convert.c (convert_links_in_hashtable): Remove use of alloca 2020-02-14 16:08:09 +01:00
Tim Rühsen
ca56ca94ee * src/convert.c (local_quote_string): Remove use of alloca 2020-02-14 16:00:05 +01:00
Tim Rühsen
951bcac6df * src/convert.c (replace_attr_refresh_hack): Remove use of alloca 2020-02-14 15:38:53 +01:00
Tim Rühsen
6d1fcd1c48 * src/convert.c (write_backup_file): Remove use of alloca 2020-02-14 13:15:21 +01:00
Tim Rühsen
b62956872c * src/utils.c (fnmatch_nocase): Remove FNM_CASEFOLD emulation, gnulib takes care of it 2020-02-14 12:59:25 +01:00
Tim Rühsen
589b3743fa * src/cookies.c (cookie_header): Remove use of alloca 2020-02-14 12:50:32 +01:00
Tim Rühsen
d61d82c43c * src/cookies.c (cookie_header): Remove use of alloca 2020-02-14 12:43:12 +01:00
Tim Rühsen
f071030659 * src/cookies.c (cookie_handle_set_cookie): Remove use of alloca 2020-02-14 12:32:22 +01:00
Tim Rühsen
36ccb62e92 * src/cookies.c (parse_set_cookie): Explicitly convert from double to time_t 2020-02-14 12:04:41 +01:00
Tim Rühsen
e5cf56d7fa * src/cookies.c (parse_set_cookie): Remove use of alloca 2020-02-14 12:03:50 +01:00
Tim Rühsen
92c0d39894 * src/warc.c (warc_uuid_str): Add second param to windows_uuid_str 2020-02-14 11:53:10 +01:00
Tim Rühsen
78a848c69a * src/cookies.c (parse_set_cookie): Remove use of alloca 2020-02-14 11:48:19 +01:00
Tim Rühsen
8610b0b355 * src/main.c (main): Code clean, reduce allocations 2020-02-14 11:14:02 +01:00
Tim Rühsen
6bd21adabc * src/main.c: Modify macro IF_SSL to work with latest struct changes 2020-02-14 10:31:12 +01:00
Tim Rühsen
a274740598 * src/ftp.c (ftp_retrieve_dirs): Remove use of alloca 2020-02-13 20:19:26 +01:00
Tim Rühsen
94bae4dd18 * src/ftp.c (ftp_retrieve_list): Remove use of alloca 2020-02-13 20:11:45 +01:00
Tim Rühsen
d0695e269f * src/ftp.c (ftp_loop_internal): Remove use of alloca 2020-02-13 20:02:25 +01:00
Tim Rühsen
6a3e96275b * src/ftp.c (getftp): Remove use of alloca 2020-02-13 20:00:09 +01:00
Tim Rühsen
6d181cb8ef * src/http.c: Include xstrndup.h unconditionally 2020-02-13 19:34:36 +01:00
Tim Rühsen
89e09e59f2 * src/ftp-basic.c (ftp_request): Remove use of alloca 2020-02-13 17:10:01 +01:00
Tim Rühsen
5505aced03 * src/html-parse.c (name_allowed): Remove use of alloca 2020-02-13 17:01:29 +01:00
Tim Rühsen
6cc9acfd61 * src/netrc.c (search_netrc): Remove use of alloca 2020-02-13 16:55:41 +01:00
Tim Rühsen
e91e96ccb5 * src/init.c (parse_line): Remove use of alloca 2020-02-13 16:50:21 +01:00
Tim Rühsen
c3c04ffeba Remove use of alloca in setoptval
* src/init.c (setoptval): Remove use of alloca
* src/init.h: Add define MAX_LONGOPTION
* src/main.c (struct cmdline_option): Make 'long_name' a char array
2020-02-13 16:39:36 +01:00
Tim Rühsen
cbea3d41dd * src/http.c (check_auth): Remove use of alloca 2020-02-13 16:27:38 +01:00
Tim Rühsen
68868bbb37 * src/http.c (print_response_line): Remove use of alloca 2020-02-13 16:11:51 +01:00
Tim Rühsen
a3f2ba708d * src/http.c (request_set_user_header): Remove use of alloca 2020-02-13 16:11:23 +01:00
Tim Rühsen
f1ce7f5bd6 * src/http.c (metalink_from_http): Remove use of alloca 2020-02-13 16:00:19 +01:00
Tim Rühsen
704208b766 * src/http.c (basic_authentication_encode): Remove use of alloca 2020-02-13 15:54:16 +01:00
Tim Rühsen
0bc0729bcc * src/http.c (gethttp): Remove use of alloca 2020-02-13 15:40:48 +01:00
Tim Rühsen
572f6f9b39 * src/http.c (gethttp): Remove use of alloca 2020-02-13 15:34:13 +01:00
Tim Rühsen
e22dbe5af0 * src/http.c (set_file_timestamp): Remove use of alloca 2020-02-13 15:30:50 +01:00
Tim Rühsen
f460e1d049 * src/main.c (main): Remove use of alloca 2020-02-13 15:17:27 +01:00
Tim Rühsen
c0d8cceb93 * src/url.c (append_uri_pathel): Replace alloca by fixed array / sprintf 2020-02-13 15:04:17 +01:00
Tim Rühsen
c2d03b6293 * src/url.c (append_uri_pathel): Replace alloca by fixed array / xmalloc 2020-02-13 13:32:16 +01:00
Tim Rühsen
9adde1e441 * src/utils.c (make_directory): Replace alloca by fixed array / xmalloc 2020-02-13 12:09:34 +01:00
Tim Rühsen
4dd9dee2e7 * src/utils.c (unique_name_1): Replace alloca by xmalloc 2020-02-13 11:48:06 +01:00
Tim Rühsen
233f982f9d Add buffer size param to warc_uuid_str
* src/http.c (gethttp): Add buffer size param to warc_uuid_str.
* src/warc.c: Likewise
* src/warc.h: Likewise
2020-02-13 11:28:18 +01:00
Tim Rühsen
e5d0dda561 * src/http-ntlm.c (ntlm_output): Remove alloca 2020-02-12 17:05:01 +01:00
Tim Rühsen
17fad78290 * src/http-ntlm.c (mkhash): Replace alloca by fixed length array 2020-02-12 16:56:57 +01:00
Tim Rühsen
1ebd88063d * src/http-ntlm.c (ntlm_input): Replace alloca by fixed length array 2020-02-12 16:44:59 +01:00
Tim Rühsen
c65c23cfc7 * src/gnutls.c (ssl_init): Replace alloca by fixed length arrays 2020-02-12 16:24:45 +01:00
Tim Rühsen
94b9332f50 * src/retr.c (fd_read_body): Fix signedness warnings 2020-02-12 16:14:40 +01:00
Tim Rühsen
fd75f5d986 * src/retr.c (rotate_backups): Replace alloca by fixed length arrays 2020-02-12 16:13:40 +01:00
Tim Rühsen
473db08580 * src/wget.h: Add inline to _unhex 2020-02-12 16:12:09 +01:00
Tim Rühsen
0bb97fecb7 * src/metalink.h: Include dirname.h, remove declaration of last_component 2020-02-12 16:10:58 +01:00
Tim Rühsen
8bc1d1447b * src/convert.c (convert_links): Fix previous commit 2020-02-12 10:52:06 +01:00
Tim Rühsen
fe4ade75cf * src/convert.c (convert_links): Add \n (Fixes #57795) 2020-02-12 09:57:27 +01:00
Ander Juaristi
928c54d27e Do not overwrite restval if len is smaller
* src/http.c (http_loop): overwrite 'restval' only if 'len' is
   greater than it. Else substract 'len' to 'restval'.

When retrying a request, only send a 'Range' header if the previous
request returned data.
2020-01-25 18:35:05 +01:00