f8f2f69a9f
Simplify vector API
...
* libwget/vector.c: Use wget_free as default destructor,
renamed _vec_insert_private() -> insert_element,
(insert_element): removed args 'size' and 'alloc',
removed the _noalloc() API,
removed the 'size' argument from functions,
added wget_vector_add_memdup() as convenience function,
renamed _compare() -> compare_element
* include/wget/wget.h: Removed _noalloc() functions
* fuzz/libwget_cookie_fuzzer.c: Amended to new API
* libwget/*.c: Likewise
* src/*.c: Likewise
* tests/*.c: Likewise
* unit-tests/*.c: Likewise
2019-06-26 16:43:20 +02:00
d3359537fc
* libwget/ssl_gnutls.c: Fix Doxygen indenting of bullet list
...
Seems Doxgen gets confused unless all bullet-ed items in a list have the same number of spaced.
And the generated HTML looks jagged.
2019-06-25 10:35:20 +02:00
d839efb02e
* AUTHORS: Add Gisle Vanem
2019-06-25 10:35:20 +02:00
14b1ffbed3
Add sc_prohibit_alloc to 'make syntax-check'
...
* cfg.mk: Add sc_prohibit_alloc rule plus exceptions
* src/options.c: Tag exceptions
* unit-tests/test.c: Likewise
This rule checks for calling malloc()/calloc()/realloc(). Instead, either
use wget_malloc(), wget_calloc() or wget_realloc().
2019-06-24 16:04:39 +02:00
baa5ef562f
Add sc_prohibit_free to 'make syntax-check'
...
* cfg.mk: Add sc_prohibit_free rule plus exceptions
* examples/print_css_urls3.c: Remove unneeded comment
* fuzz/libwget_base64_fuzzer.c: Use wget_free() instead of free()
* fuzz/libwget_cookie_fuzzer.c: Likewise
* fuzz/libwget_css_url_fuzzer.c: Likewise
* fuzz/libwget_http_client_fuzzer.c: Likewise
* fuzz/libwget_utils_fuzzer.c: Likewise
* libwget/vector.c: Likewise
* src/options.c: Likewise
* src/wget_main.h: Likewise
* tests/test-compression.c: Likewise
* tests/test-cookies-http_state.c: Likewise
* tests/test-metalink.c: Likewise
* unit-tests/stringmap_perf.c: Likewise
This rule checks for calling free(). Instead, either use wget_free() or
the convenience macro xfree().
2019-06-24 16:04:23 +02:00
01bd3780d5
* m4/wget_manywarnings.m4: Remove -Werror-... options
2019-06-24 13:53:12 +02:00
31a792db9e
* libwget/net.c: Fix compiler warning on MinGW
2019-06-24 12:34:51 +02:00
5e3c8e19be
* fuzz/wget_options_fuzzer.c: Fix compiler warning on MinGW
2019-06-24 12:34:20 +02:00
afa91cb09e
* tests/Makefile.am: Avoid using unportable .o reference with libtool
2019-06-24 12:23:24 +02:00
a006365324
Remove need for C11 thread local storage
...
* configure.ac: Remove check for threads.h
* libwget/ssl_gnutls.c: Remove need for C11 thread local storage
2019-06-24 12:06:37 +02:00
5a424bcea0
* fuzz/libwget_http_client_fuzzer.c: Add emulation of freeaddrinfo()
2019-06-23 15:38:25 +02:00
6f7a6ac7b4
* tests/libtest.c (_answer_to_connection): Add const to conn_info
2019-06-23 15:38:25 +02:00
d2e5701518
* tests/Makefile.am: Use top_srcdir instead of .. to fix VPATH build
2019-06-23 15:38:25 +02:00
9a26e7baf0
* src/options.c (deinit): Fix OSS-Fuzz issue 15443
2019-06-22 16:21:52 +02:00
08af837899
* src/options.c (parse_stats): Fix OSS-Fuzz issue 15438
2019-06-22 14:17:39 +02:00
014360442e
* tests/Makefile.am: Use top_srcdir instead of .. to fix VPATH build
2019-06-21 16:58:08 +02:00
144d40beab
Inline most of stringmap API
...
* include/wget/wget.h: Add stringmap API (mostly) as static inline functions
* libwget/stringmap.c: Remove stringmap implementation (mostly)
2019-06-21 16:04:36 +02:00
39d6f15873
Add memory checks and error return value to hashmap API
...
* include/wget/wget.h: wget_hashmap_sethashfunc() returns int
* libwget/hashmap.c: Check memory allocations
* libwget/stringmap.c: wget_stringmap_sethashfunc() returns int
2019-06-21 16:04:33 +02:00
d55c540b1b
Simplify hashmap and stringmap API
...
* include/wget/wget.h: Replace _put() by _put_noalloc() functions to
keep memory allocations outside the library functions.
* libwget/stringmap.c: Likewise
* libwget/hashmap.c: Likewise
* libwget/*.c: Likewise
* src/*.c: Likewise
* unit-tests/*.c: Likewise
2019-06-21 16:04:29 +02:00
dcd9a3725a
Separate DNS and DNS caching
...
* include/wget/wget.h: Rewrite parts of the DNS / DNS caching API
* libwget/dns.c: Likewise
* libwget/dns_cache.c: Likewise
* libwget/init.c (wget_global_init): Amend WGET_DNS_CACHING
* libwget/net.c: Cleanup and amend for the new API
* libwget/net.h: Cleanup
* src/options.c: Use DNS caching instance if caching is requested
2019-06-21 15:52:40 +02:00
94d3969488
Remove --stats-all
...
* docs/wget2.md Remove docs for --stats-all
* src/options.c: Remove --stats-all and parse_stats_all()
* fuzz/wget_options_fuzzer.dict: remove --stats-all
* tests/Makefile.am: Remove test-stats-all
* tests/test-stats-all.c: Remove file
2019-06-21 15:52:40 +02:00
5230e1d165
Rewrite Site statistics --stats-site
...
* fuzz/Makefile.am: Remove ../src/stats_site.o
* include/wget/wget.h: Remove wget_stats_type_t
* po/POTFILES.in. Remove src/stats.c
* src/Makefile.am: Remove stats_site.c
* src/options.c (parse_stats_all): Remove site stats code,
(init): Add DNS stats code,
(deinit): Cleanup dns stats code
* src/stats.c: Remove file
* src/stats_site.c: iFix for new stats code
* src/wget.c (main): stats_print -> site_stats_print,
(add_statistics): config.stats_site -> config.stats_site_args,
(process_response): Likewise
* src/wget_options.h (struct config): Remove stats_site, add stats_site_args
* src/wget_stats.h: Remove stats_opt_t,
remove stats_print_func_t,
remove stats_callback_setter_t,
remove struct stats_opts,
remove stats_site_opts,
rename stats_init -> site_stats_init,
rename stats_exit -> site_stats_exit,
rename stats_print -> site_stats_print
* unit-tests/Makefile.am: Remove ../src/stats.o
2019-06-21 15:43:34 +02:00
15fba495cf
Amend --stats-* syntax
...
* docs/wget2.md: Amend docs for --stats-*
* src/options.c: Amend option syntax for --stats-*
* tests/stats-test-util.h: Amend tests to succeed
2019-06-21 15:42:10 +02:00
619a7456c1
Rewrite Server statistics --stats-server
...
* fuzz/Makefile.am: Remove ../src/stats_server.o
* include/wget/wget.h:
remove wget_server_stats_t,
rename wget_stats_callback_t -> wget_server_stats_callback_t,
rename wget_tcp_set_stats_server -> wget_server_set_stats_callback,
add wget_server_stats_data_t,
add wget_server_stats_callback_t,
* libwget/http.c: Remove _stats_data_t,
add server_stats_callback,
add server_stats_ctx
* src/Makefile.am: Remove stats_server.c
* src/options.c (parse_stats_all): Remove server stats code,
add stats_callback_server(),
(init): Add DNS stats code,
(deinit): Cleanup dns stats code
* src/stats.c (stats_print_func_t): Remove print_server[],
remove WGET_STATS_TYPE_SERVER
* src/stats_server.c: Remove file
* src/wget_options.h (struct config): Remove stats_server, add stats_server_args
* src/wget_stats.h: Remove stats_server_opts
* unit-tests/Makefile.am: Remove ../src/stats_server.o
2019-06-21 15:33:06 +02:00
e5ef8c168f
Rewrite TLS statistics --stats-tls
...
* fuzz/Makefile.am: Remove ../src/stats_tls.o
* include/wget/wget.h: Add wget_tls_stats_data_t,
add wget_tls_stats_callback_t,
add wget_ssl_set_stats_callback_tls,
remove WGET_STATS_TYPE_TLS,
remove wget_tls_stats_t,
remove wget_tcp_set_stats_tls(),
remove wget_tcp_get_stats_tls()
* libwget/ssl_gnutls.c: Remove old stats code, add new stats code
* libwget/ssl_none.c: Add/remove function stubs
* libwget/ssl_wolfssl.c: Remove old stats code, add new stats code
* src/Makefile.am: Remove stats_tls.c
* src/options.c (parse_stats_all): Remove TLS stats code,
add stats_callback_tls(),
(init): Add TLS stats code,
* src/stats.c (stats_print_func_t): Remove print_tls[],
remove WGET_STATS_TYPE_TLS
* src/stats_tls.c: Remove file
* src/wget_options.h (struct config): Remove stats_tls, add stats_tls_args
* src/wget_stats.h: Remove stats_tls_opts
* unit-tests/Makefile.am: Remove ../src/stats_tls.o
2019-06-21 15:32:13 +02:00
6df1578283
Rewrite OCSP statistics --stats-ocsp
...
* fuzz/Makefile.am: Remove ../src/stats_ocsp.o
* include/wget/wget.h: Add wget_ocsp_stats_data_t,
add wget_ocsp_stats_callback_t,
add wget_ssl_set_stats_callback_ocsp,
remove WGET_STATS_TYPE_OCSP,
remove wget_ocsp_stats_t,
remove wget_tcp_set_stats_ocsp(),
remove wget_tcp_get_stats_ocsp()
* libwget/ssl_gnutls.c: Remove old stats code, add new stats code
* libwget/ssl_none.c: Add/remove function stubs
* libwget/ssl_wolfssl.c: Remove old stats code, add new stats code
* src/Makefile.am: Remove stats_ocsp.c
* src/options.c (parse_stats_all): Remove OCSP stats code,
add stats_callback_ocsp(),
(init): Add OCSP stats code,
* src/stats.c (stats_print_func_t): Remove print_ocsp[],
remove WGET_STATS_TYPE_OCSP
* src/stats_ocsp.c: Remove file
* src/wget_options.h (struct config): Remove stats_ocsp, add stats_ocsp_args
* src/wget_stats.h: Remove stats_ocsp_opts
* unit-tests/Makefile.am: Remove ../src/stats_ocsp.o
2019-06-21 15:32:13 +02:00
584c7f8801
Rewrite DNS statistics --stats-dns
...
* fuzz/Makefile.am: Remove ../src/stats_dns.o
* include/wget/wget.h: Add wget_dns_stats_data_t,
add wget_dns_stats_callback_t,
add wget_dns_set_stats_callback,
remove WGET_STATS_TYPE_DNS,
remove wget_dns_stats_t,
remove wget_dns_set_stats(),
remove wget_dns_get_stats()
* libwget/dns.c: Remove _stats_data_t,
amend struct wget_dns_st,
add wget_dns_set_stats_callback(),
remove wget_dns_get_stats()
* src/Makefile.am: Remove stats_dns.c
* src/options.c (parse_stats_all): Remove DNS stats code,
add stats_callback_dns(),
(init): Add DNS stats code,
* src/stats.c (stats_print_func_t): Remove print_dns[],
remove WGET_STATS_TYPE_DNS
* src/stats_dns.c: Remove file
* src/wget_options.h (struct config): Remove stats_dns, add stats_dns_args
* src/wget_stats.h: Remove stats_dns_opts
* tests/stats-test-util.h: Remove "human"
* unit-tests/Makefile.am: Remove ../src/stats_ocsp.o
2019-06-21 15:27:33 +02:00
b6c2f5f75c
Put resolver/dns code into own source file
...
* docs/Makefile.am: Add libwget-dns.3 man page
* examples/batch_loader.c: Remove call to wget_tcp_set_dns_timeout()
* examples/check_url_types.c: Use wget_dns_set_timeout()
* include/wget/wget.h: Add wget_dns_ API
* libwget/Makefile.am: Add dns.c
* libwget/dns.c: New file
* libwget/init.c: Use wget_dns_set_caching()
* libwget/net.c: Remove DNS functions
* libwget/net.h (wget_tcp_st): Add dns member
* po/POTFILES.in: Add libwget/dns.c
* src/options.c: Use new DNS API
* src/stats.c: Add some checks
* src/stats_dns.c: Use wget_dns_get_stats()
2019-06-21 13:10:47 +02:00
138a03bf8a
* libwget/thread.c: Manually inline wget_get_timemillis() into wget_thread_cond_wait()
2019-06-21 12:48:47 +02:00
73b7441e9a
Move wget_restrict_file_name() to src/utils.c
...
* fuzz/libwget_utils_fuzzer.c: Remove test code for wget_restrict_file_name()
* include/wget/wget.h: Remove wget_restrict_file_name() prototype
* libwget/utils.c: Remove wget_restrict_file_name()
* src/utils.c: Add wget_restrict_file_name()
* src/wget_utils.h: Add wget_restrict_file_name() prototype
* tests/Makefile.am: Add ../src/utils.c to libtest_la_SOURCES
* tests/libtest.c: Include ../src/wget_utils.h
2019-06-21 12:47:06 +02:00
5bc488bbac
Fix several forgotten xmalloc -> wget_malloc
...
* libwget/css.c (wget_css_parse_file): Rename xmalloc->wget_malloc
* libwget/hashfile.c (wget_hash_init): Likewise
* libwget/ssl_gnutls.c (_cert_verify_hpkp): Likewise
* libwget/xml.c (wget_xml_parse_file): Likewise
2019-06-21 11:42:01 +02:00
2c4f9439ce
* libwget/hashmap.c (hashmap_rehash): Fix for wget_calloc()
2019-06-20 17:02:20 +02:00
b381286783
Remove xrealloc define for wget_realloc
...
* libwget/private.h: Remove #define
* libwget/*.c: Replace xrealloc by wget_realloc
2019-06-20 16:51:57 +02:00
802f2a65a5
Remove xcalloc define for wget_calloc
...
* libwget/private.h: Remove #define
* libwget/*.c: Replace xcalloc by wget_calloc
2019-06-20 16:50:58 +02:00
5079807ffd
Remove xmalloc define for wget_malloc
...
* libwget/private.h: Remove #define
* libwget/*.c: Replace xmalloc by wget_malloc
2019-06-20 16:43:46 +02:00
8ee4bf299a
* libwget/vector.c (wget_vector_create): Check result of malloc()
2019-06-20 16:34:52 +02:00
66293d3dc5
* libwget/thread.c: Check result of malloc()
2019-06-20 16:34:48 +02:00
9d56b0997c
* libwget/mem.c: Check result of malloc()
2019-06-20 16:34:45 +02:00
d179036956
* libwget/list.c (wget_list_append): Check result of malloc()
2019-06-20 16:34:42 +02:00
97975c4c2d
* libwget/iri.c (wget_iri_parse,wget_iri_clone): Check result of malloc()
2019-06-20 16:34:37 +02:00
cc69ecf0be
* libwget/http.c (_server_stats_add): Check result of malloc()
2019-06-20 16:34:34 +02:00
22092a2bdb
* libwget/cookie.c (wget_cookie_create_request_header): Check result of malloc()
2019-06-20 16:34:31 +02:00
ecbb8036e4
* include/wget/wget.h: Add LIBWGET_WARN_UNUSED_RESULT
2019-06-20 16:34:26 +02:00
b689d4b441
Don't ignore wget_malloc() return value
...
* libwget/test_linking.c: Don't ignore wget_malloc() return value
2019-06-20 16:33:40 +02:00
0748a233b4
Add G_GNUC_WGET_RETURNS_NONNULL in wget.h
...
* include/wget/wget.h: Add G_GNUC_WGET_RETURNS_NONNULL
* src/Makefile.am: Add -DMALLOC_RETURNS_NONNULL
* src/options.c: Use G_GNUC_WGET_RETURNS_NONNULL for own alloc functions
2019-06-20 12:59:03 +02:00
188413e188
* libwget/base64.c: Check for malloc failures
2019-06-20 12:57:43 +02:00
9afed6a6cd
Amend buffer functions to handle failed memory allocations
...
* include/wget/wget.h: wget_buffer_ensure_capacity() returns int
* libwget/buffer.c (wget_buffer_init): Return NULL if malloc fails,
(_buffer_realloc): Return error if malloc fails
* libwget/http.c (wget_http_get_response_cb): Check return value of
wget_buffer_ensure_capacity()
* unit-tests/test.c (test_buffer): Add asserts
2019-06-19 16:59:21 +02:00
5b80d9c678
Make wget allocation functions overridable function pointers
...
* include/wget/wget.h: Remove allocation function prototypes,
add function pointer types and 'extern' globals
* libwget/private.h: Use wget_free() instead of free()
* libwget/xalloc.c: Remove function definitions,
add global function pointer variables
* src/options.c: Add own allocation functions
* unit-tests/test.c: Test that function pointers are overridable
2019-06-19 16:14:53 +02:00
1e53b65110
Change OOM callback implementation
2019-06-19 16:14:26 +02:00
ee13c9991c
Fix robots.txt code for stand-alone library API
...
* fuzz/libwget_robots_parse_fuzzer.c: Amend API call
* include/wget/wget.h: Amend wget_robots_parse() API
* libwget/robots.c: Amend wget_robots_parse() API,
check memory allocations
* libwget/test_linking_robots.c: New file
* src/wget.c (process_response): Amend call to wget_robots_parse()
* unit-tests/test.c (test_robots): Amend call to wget_robots_parse()
2019-06-19 16:13:14 +02:00