Commit Graph

43 Commits

Author SHA1 Message Date
81cf05e1da Move Win32 console save/restore from libwget into wget.c.
* libwget/init.c: Remove Win32 console code.
* src/wget.c: Add Win32 console code.
2024-05-19 19:58:29 +02:00
2b6bd2e190 Windows: handle ctrl+break to restore console modes
* libwget/init.c: Add HandleCtrlEvent(),
  (global_exit): Restore console modes,
  (global_init): Save console modes.

Copyright-paperwork-exempt: Yes
2024-05-19 13:34:30 +02:00
188989e067 Update copyright year 2024-01-07 12:41:02 +01:00
15ba1db248 Update copyrights 2023-08-31 12:57:30 +02:00
33a6454aa7 gcc specific C constructor/destructors support for MSVC
* libwget/private.h: Define INITIALIZER to support constructors with MSVC.
* libwget/dns.c: Use INITIALIZER for library constructor.
* libwget/http.c: Likewise.
* libwget/init.c: Likewise.
* libwget/random.c: Likewise.
* libwget/ssl_gnutls.c: Likewise.
* libwget/ssl_openssl.c: Likewise.
* libwget/ssl_wolfssl.c: Likewise.

Co-authored-by: Tim Rühsen <tim.ruehsen@gmx.e
2023-08-18 20:40:02 +02:00
3dc7f71098 Update copyright year 2022-02-25 17:46:43 +01:00
22162f82b2 Update copyright year 2021-01-22 21:58:38 +01:00
91bba3f697 Add option --bind-interface
* libwget/net.h (wget_tcp_st): New variable
  const char *bind_interface.
* libwget/net.c: Add function wget_tcp_bind_interface().
  (set_socket_options): Add parameter wget_tcp *tcp and
  implement binding of tcp to bind_interface.
* libwget/init.c (wget_global_init): Call wget_tcp_bind_interface().
* include/wget/wget.h: Add wget_tcp_bind_interface() and
  WGET_BIND_INTERFACE.
* src/options.c: Add --bind-interface handling.
  (init): Call wget_tcp_bind_interface().
* src/wget2_options.h (config): Add const char *bind_interface.
* docs/wget2.md: Add documentation for --bind-interface.

This finishes task #430
2020-02-24 12:28:00 +01:00
59d9ecd9c0 * Update copyright year to 2020 2020-01-10 00:33:02 +01:00
6d50b8f24a * libwget/init.c: Improve C99 compliancy 2019-09-23 21:17:38 +02:00
29d6777b57 Change second param type of wget_tcp_set_tcp_fastopen() to bool
* include/wget/wget.h: Likewise
* libwget/net.c: Likewise
* libwget/init.c (wget_global_init): Fix param type to wget_tcp_set_tcp_fastopen()
* src/wget_options.h (struct config): Change type of tcp_fastopen to bool
2019-09-18 12:59:43 +02:00
c5f11d5548 * libwget/init.c: Use '!= 0' instead of !! 2019-09-18 12:55:38 +02:00
5b32f680ee Use bool param for wget_cookie_set_keep_session_cookies()
* include/wget/wget.h: Change second param of wget_cookie_set_keep_session_cookies() to bool
* libwget/cookie.c: Likewise
* libwget/init.c (struct _CONFIG): Use bool for cookies_enabled, keep_session_cookies
2019-09-18 12:23:47 +02:00
4b9edbad2d Update Copyright statements to be compatible with update-copyright module 2019-09-10 23:41:56 +02:00
d51398947e * libwget/init.c (wget_global_get_ptr): Fix return type for WGET_COOKIE_DB 2019-09-06 00:31:43 +02:00
c4c68472c9 Rename wget_logger_func_t -> wget_logger_func
* include/wget/wget.h: Rename wget_logger_func_t -> wget_logger_func
* libwget/init.c: Likewise
* libwget/logger.c: Likewise
2019-08-12 11:03:06 +02:00
c59a0e34b5 Rename wget_global_get_func_t -> wget_global_func
* include/wget/wget.h: Rename wget_global_get_func_t -> wget_global_func
* libwget/init.c: Likewise
2019-08-12 10:54:29 +02:00
a13caad84d Rename wget_dns_cache_t -> wget_dns_cache
* include/wget/wget.h: Rename wget_dns_cache_t -> wget_dns_cache
* libwget/dns.c: Likewise
* libwget/dns_cache.c: Likewise
* libwget/init.c: Likewise
* src/options.c: Likewise
2019-07-19 16:18:31 +02:00
618f49160d Rename wget_cookie_db_t -> wget_cookie_db
* include/wget/wget.h: Rename wget_cookie_db_t -> wget_cookie_db
* examples/http_get2.c: Likewise
* fuzz/libwget_cookie_fuzzer.c: Likewise
* libwget/cookie.c: Likewise
* libwget/http_highlevel.c: Likewise
* libwget/init.c: Likewise
* src/wget_options.h: Likewise
* tests/test-cookies-http_state.c: Likewise
* unit-tests/test-cookies-http_state.c: Likewise
* unit-tests/test.c: Likewise
2019-07-18 13:11:55 +02:00
aadf56562f Rename wget_thread_mutex_t -> wget_thread_mutex
* include/wget/wget.h: Rename wget_thread_mutex_t -> wget_thread_mutex
* libwget/*.c: Likewise
* src/*.c: Likewise
* unit-tests/test-cond.c: Likewise
2019-07-18 12:54:37 +02:00
3228d0a6a5 Typedef wget_logger_func_t not as pointer
* include/wget/wget.h: Remove '*' signature from function typedef
* libwget/init.c: Amend va_arg params
* libwget/logger.c: Amend function params
2019-07-17 12:32:55 +02:00
3f0d5a5037 Typedef wget_global_get_func_t not as pointer
* include/wget/wget.h: Remove '*' signature from function typedef
* libwget/init.c: Amend function definition
2019-07-17 12:15:45 +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
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
cdb3600791 Update copyrigght to 2019 2019-01-02 12:42:53 +01:00
3688ffb941 Update copyright to 2018 2018-04-30 20:52:11 +02:00
7285154243 Refactor DNS chaching code out of net.c
* include/wget/wget.h: Add missing wget_dns_cache declarations
* libwget/Makefile.am: Add dns_cache.c
* libwget/dns_cache.c: New file
* libwget/net.c: Remove DNS chaching code
2018-01-09 09:40:06 +01:00
b82f692949 Thread abstraction via gnulib thread wrapper (glthread)
* bootstrap.conf: Add modules cond, lock and thread,
  remove module pthread
* include/wget/wget.h: Remove pthread code,
  add new wget_thread_* functions,
  amend params of wget_thread_* functions,
  add init and exit functions for mutex initialization
* */*.[ch]: Amend threading to new API

This change let libwget work with different kinds of
threading libraries incl. pthreads and windows threads.
2017-12-17 14:20:01 +01:00
c6ee3d79ad Fix syntax-check 'sc_prohibit_have_config_h'
* cfg.mk: Remove sc_prohibit_have_config_h from local-checks-to-skip
* libwget/*.c: Include <config.h> unconditionally
* src/*.c: Likewise
* tests/*.c: Likewise
2017-04-30 22:01:34 +02:00
39d2a7584c * libwget/init.c (wget_global_init): Init console 2017-04-12 11:34:49 +02:00
d31de86454 Add support for 'no_proxy' environment variable
* include/wget/wget.h: Add flag 'proxied' to wget_http_connection_t,
  add arg 'proxied' to wget_http_request_to_buffer(),
  add new function declaration wget_http_set_no_proxy(),
  add new function declaration wget_http_match_no_proxy().
* libwget/http.c: Add variable 'no_proxies',
  (wget_http_open): Check host against 'no_proxy' and set 'conn->proxied'
  when appropriate,
  (wget_http_send_request): Call wget_http_request_to_buffer() with
   conn->proxied,
  (wget_http_request_to_buffer): Check 'proxied',
  (_parse_proxies): Cleanup,
  (_parse_no_proxies): New function,
  (wget_http_set_no_proxy): New function,
  (wget_http_match_no_proxy): New function
* libwget/init.c (wget_global_deinit): Free no_proxy memory
* libwget/ip.c: Add code in comments (for later use)
* libwget/utils.c (wget_match_tail, wget_match_tail_nocase): Cleanup
* src/options.c (init): Handle 'no_proxy' env variable
* src/wget_options.h (struct config): Add no_proxy member
2017-04-05 11:37:33 +02:00
96c8e81f81 * libwget/init.c (wget_global_deinit): Free more resources 2017-03-01 16:28:41 +01:00
ec396c577f Fix URLs to HTTPS where possible 2017-02-28 15:31:30 +01:00
1a3a000428 Fix memleak in cookie code
* examples/http_get2.c: Use wget_cookie_db_free() to free cookie db
* libwget/cookie.c (wget_cookie_db_init): Fix #ifdef around PSL code
* libwget/init.c (wget_global_deinit): Use wget_cookie_db_free()
2017-02-21 13:19:27 +01:00
bfcd65c12b Use typedefs for function pointer arguments
* include/wget/wget.h: Add typedefs
* libwget/cookie.c: Use typedefs
* libwget/css.c: Likewise
* libwget/css_url.c: Likewise
* libwget/decompressor.c: Likewise
* libwget/hashmap.c: Likewise
* libwget/hsts.c: Likewise
* libwget/http.c: Likewise
* libwget/init.c: Likewise
* libwget/io.c: Likewise
* libwget/list.c: Likewise
* libwget/logger.c: Likewise
* libwget/metalink.c: Likewise
* libwget/net.c: Likewise
* libwget/netrc.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/private.h: Likewise
* libwget/robots.c: Likewise
* libwget/stringmap.c: Likewise
* libwget/tls_session.c: Likewise
* libwget/vector.c: Likewise
* libwget/xml.c: Likewise
* src/blacklist.c: Likewise
* src/host.c: Likewise
* src/options.c: Likewise
* src/wget.c: Likewise
* tests/stringmap_perf.c: Likewise
* tests/test.c: Likewise
2017-01-23 14:43:17 +01:00
042065d44f Let MSVC compile libwget/init.c (wget_global_init)
Reported-by: Gisle Vanem
2017-01-05 22:13:46 +01:00
0354295e03 Add network init function to bootstrap sockets on Windows
* bootstrap.conf: Add gnulib module 'sockets'
* examples/http_get2.c: Call wget_net_init()
* include/wget/wget.h: Add wget_net_init() and wget_net_deinit()
* libwget/init.c (wget_global_init): Call wget_net_init(),
  (wget_global_deinit): Call wget_net_deinit()
* libwget/net.c: Add wget_net_init() and wget_net_deinit()
2017-01-05 12:09:25 +01:00
9568b0c87e Rename include/libwget.h to include/wget/wget.h+wgetver.h 2016-09-30 09:47:32 +02:00
dd3c2f63b2 Updated copyright year for all relevant files 2016-01-25 13:06:21 +01:00
ed5835f446 Cleanup cookie code
Cookies: Add new function wget_cookie_set_keep_session_cookies()
         and adjust wget_cookie_db_load() and wget_cookie_db_save().
         Use wget_update_file() for loading and saving.
2015-11-23 16:43:27 +01:00
36a47cc558 Add function wget_global_get_func()
* include/libwget.h: Add wget_global_get_func() prototype
* libwget/init.c: Add function wget_global_get_func()
2015-10-30 17:39:57 +01:00
0f8e49128a Transfer copyright to Free Software Foundation, Inc. 2015-09-22 11:50:06 +02:00
c6b0e461a1 Transform Mget into Wget 2015-09-19 22:54:38 +02:00