181 Commits

Author SHA1 Message Date
0fe5f9282d New function wget_logger_is_active()
* include/wget/wget.h: Add prototype
* libwget/Makefile.am: Add logger.h
* libwget/log.c: Include logger.h
* libwget/logger.c: Include logger.h, add wget_logger_is_active()
* libwget/net.c: Use wget_logger_is_active()
* libwget/private.h: Remove struct _wget_logger_st
2017-01-23 16:55:52 +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
315c8f7516 base46: Use size_t as string length param 2017-01-20 16:23:02 +01:00
dfc4b53eae Add typedef for wget_vector_browse() callback function
* include/wget/wget.h: Add typedef wget_list_browse_cb_t
* libwget/list.c: Use wget_list_browse_cb_t
2017-01-19 17:11:58 +01:00
566e9f7c70 Add typedef for wget_update() callback functions
* include/wget/wget.h: Add typedef wget_update_cb_t
* libwget/cookie.c: Use wget_update_cb_t
* libwget/hsts.c: Likewise
* libwget/tls_session.c: Likewise
2017-01-19 17:11:58 +01:00
8248bfecd1 Add console color abstraction
* docs/Makefile.am: Add libwget-console.3
* include/wget/wget.h: Add console routines
* libwget/Makefile.am: Add libwget/console.c
* libwget/console.c: New file with console functions
* src/log.c: Add WIN32 and console function calls
2017-01-06 14:23:37 +01:00
1f39794852 Add function wget_truncate()
* bootstrap.conf: Ad gnulib module ftruncate
* include/wget/wget.h: Add wget_truncate
* libwget/io.c: Add wget_truncate
* src/job.c: Call wget_truncate instead of truncate

The truncate() function is not covered by gnulib.
wget_truncate() is a wrapper around ftruncate(), which is covered
by gnulib.
2017-01-06 12:14:40 +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
43f30f309e Rename wget_str_[v]asprintf to wget_[v]aprintf
* include/wget/wget.h: Rename wget_str_[v]asprintf to wget_[v]aprintf
* libwget/http.c: Likewise
* libwget/iri.c: Likewise
* libwget/printf.c: Likewise
* libwget/vector.c: Likewise
* src/options.c: Likewise
* tests/test-metalink.c: Likewise
2016-12-21 11:54:36 +01:00
909afd75fc Make the visibiity attribute preceed the prototype
* include/wget/wget.h: Make library symbol export attribute
((__visibility__)) preceed the function prototype to work on Windows
with MSVC
* tests/libtest.h: Same

Reported-by: Gisle Vanem
2016-11-16 12:03:27 +01:00
ecbfea77c0 Rename LIBWGET_EXPORT to WGETAPI
* include/wget/wget.t: Rename LIBWGET_EXPORT to WGETAPI
* tests/libtest.h: Same
2016-11-16 11:45:46 +01:00
fe967f4817 Export symbols only from wget.h
* libwget/iri.c: Move exporting of symbol wget_iri_schemes from here
* include/wget/wget.h: To here
2016-11-16 11:16:58 +01:00
ba365efd0d Replace x{malloc,calloc} calls with wget_* methods
* include/wget/wget.h: Remove preprocessor definitions for xmalloc,
xcalloc and xrealloc
* src/job.c(job_validate_file): Replace xcalloc with wget_calloc
* src/wget.c(main): Same
(process_head_response): Same
(_prepare_file): Same
(http_send_request): Same
2016-11-16 11:06:25 +01:00
f6c3382f30 * include/wget.h: G_GNUC_WGET_PRINT_FORMAT -> G_GNUC_WGET_PRINTF_FORMAT 2016-11-08 21:40:08 +01:00
58d18ad60c New function to check for literal IPv4/IPv6 addresses
* bootstrap.conf: Add gnulib module 'inet_pton'
* docs/Makefile.am: Add man page libwget-ip.3
* wget/wget.h (struct wget_iri_st): New field 'is_ip_address'.
* libwget/Makefile.am: Add new file ip.c
* libwget/ip.c: New file defining new function wget_ip_is_family()
* libwget/iri.c (wget_iri_parse): Check for literal IP address
* src/wget.c: Do not add to HSTS if literal IP address
2016-11-08 16:22:08 +01:00
f7d74af712 * include/wget/wget.h: Fix compilation error 2016-11-07 17:30:31 +01:00
2e1b1ad2fc * include/wget/wget.h: Define empty LIBWGET_EXPORT if LIBWGET_STATIC is defined 2016-11-07 16:18:18 +01:00
c270cda231 New inline function to compute length of base64 decoded string
* include/wget/wget.h (wget_base64_get_decoded_length): new function
 * libwget/tls_session.c (_tls_session_db_load): use
   wget_base64_get_decoded_length().
2016-11-06 17:10:18 +01:00
b049eb6d3a Fix gcc/clang warnings from the new manywarnings feature
* configure.ac: Suppress -Wunsuffixed-float-constants for gcc,
  add -Wno-disabled-macro-expansion to clang flags
* examples/getstream.c: Removed 'unused' attributes from argc and argv.
* include/wget/wget.h: Fix slot to int for bar functions.
* libwget/bar.c: Fix slot to int for bar functions, cast to int,
  change type of bitfield 'redraw' to unsigned.
* libwget/hsts.c (wget_hsts_new): Fix int to bitfield conversion.
* libwget/http.c: Cast printf %p format to (void *).
* src/wget.c: Cast printf %p format to (void *),
  remove ACTION_DONE from enum actions.
* src/wget_host.h: Fix double declaration of host_remove_job()
* tests/libtest.c (wget_test_check_filesystem): Fix type of 'rc'.
* tests/test-idn-robots.c: Fix comma to semikolon at end of line.
* tests/test.c (test_strcasecmp_ascii): Fix type of loop variable.
2016-11-02 22:19:41 +01:00
861385a6c8 Separate progress bar logic into library and application parts
* include/wget/wget.h: Remove struct _wget_bar_ctx and wget_bat_ctx_t,
  amend prototypes of wget_bar functions,
  new function wget_bar_write_line()
* libwget/bar.c: Bunch of cleanups and code rearrangements
* src/wget_progress.h: Remove
* src/Makefile.am: Remove src/wget_progress.h
* src/bar.c: Remove mutex usage,
  (_error_write) call wget_bar_write_line
* src/log.c: Remove redundant param checks
* src/wget.c: Add struct _body_callback_context,
  always call bar_slot_begin() on begin of new download,
  use downloader->id as progress slot
* src/wget_bar.h: Amend prototypes of bar_ functions
2016-10-13 16:39:59 +02:00
49ab9740e1 Fix progress bar details
* include/wget/wget.h: wget_get_screen_size() must not be pure
* libwget/bar.c (_bar_get_width): Leave one space right to avoid linebreaks
* libwget/utils.c (wget_human_readable): Align # of bytes
* src/bar.c (wget_get_screen_size): Fix return value
2016-10-05 11:49:45 +02:00
40340af300 Export a new function for determining screen dimensions
* include/wget/wget.h: New function wget_get_screen_size. Replaces old
wget_determine_screen_width
* libwget/bar.c (_bar_get_width): Use wget_get_screen_size instead of
wget_determine_screen_width
* libwget/utils.c: Replace function wget_determine_screen_width with a
more generic wget_get_screen_size.
2016-10-04 21:31:34 +02:00
354c8624d1 Handle SIGWINCH for progress bar
* include/wget/wget.h: New function wget_bar_screen_resized, as an
indicator that the screen size may have changed. Also, wget_bar_update
may now modify the *bar parameter
* libwget/bar.c: Move detection code for screen size into a separate
function called _bar_get_width.
  (wget_bar_update): Check if the screen width has changed and
reallocate more space if necessary
* src/wget.c: Install a new signal handler for SIGWINCH
2016-10-04 21:30:00 +02:00
e10cf1d1f3 Move window size detection to libwget
* include/wget/wget.h: Declare new function wget_determine_screen_width.
Also change prototype of wget_bar_init to not accept a max_width
parameter
* src/utils.c: Move function determine_screen_width from here ...
* libwget/utils.c: ... to here.
* src/utils.{c,h}: Delete empty file
* src/Makefile.am: Remove source files utils.{c,h}
* src/bar.c: Move detection of screen width from here ...
* libwget/bar.c: ... to here
* tests/test.c: wget_bar_init() no longer takes a max_width parameter
2016-10-04 20:29:30 +02:00
4cdffd2def Cleaner API for progress bar within libwget
* include/wget/wget.h (_wget_bar_ctx): Remove unused elements
expected_size and filename. Rename slotpos to _slotpos to reflect that
it should not be used by the client.
* include/wget/wget.h: Remove declaration for old API functions
bar_register and bar_deregister. Define declarations for
wget_bar_slot_begin, wget_bar_slot_register and
wget_bar_slot_deregister.
* libwget/bar.c (_bar_slot_status_t): Define new enum to store the
status of a slot of the progress bar.
  (_bar_slot_t): Remove unused element last_ctx. Also, define slot
  elements: filename, file_size, bytes_downloaded and status.
  (wget_bar_slot_begin): Define new function. Invoked when the client
  has started downloading a new file.
  (wget_bar_slot_register): New function to register a new file in a
  progress bar slot.
  (wget_bar_deregister): Remove old function
  (wget_bar_slot_deregister): New function, called after file has
  finished downloading. Successfully or unsuccessfully.
  (wget_bar_deregister): Remove old function
  (_bar_set_progress): last_ctx is no longer used. Instead data is
  stored within the slot struct itself
  (_bar_update_slot): Same
  (_bar_print_final): Same
  (wget_bar_deinit): Free the filename stored in the slot
* src/bar.c: Edit to reflect the changes in libwget API
* src/wget.c (_get_header): Same
  (http_send_request): Same
  (http_receive_response): Same
* src/wget_bar.h: Same
2016-10-04 20:23:56 +02:00
9568b0c87e Rename include/libwget.h to include/wget/wget.h+wgetver.h 2016-09-30 09:47:32 +02:00
f633c3c75a Support dynamic thread allocation in progress bar
* include/libwget.h.in: Add new function wget_bar_set_slots
* libwget/bar.c (_wget_bar_st): Add new struct member max_slots to store
the maximum number of slots of the progress bar
  (wget_bar_init): Initialize the memory for all the possible
progress_bars
  (wget_bar_set_slots): New function to modify the number of progress
slots at runtime. Can only increase the number of slots, not decrease.
* src/bar.c(bar_init): Remove unneeded variable lf. bar_init() is
invoked before any threads are created, hence do not print the required
newlines. This is now done by wget_bar_set_slots
  (bar_update_slots): Wget2 interface for libwget's wget_bar_set_slots
  (_error_write): Fix the position of acquiring the mutex. Don't make
  changes to the screen while some other progress bar function may be
  running
* src/bar.h: New function bar_update_slots
* src/wget.c: Create global variable nthreads.
  (downloader_thread): Update the number of progress bar slots
* src/wget.h: New global variable nthreads
2016-09-27 22:17:37 +02:00
21bc107c1a Make wget_bar_update update the entire progress 2016-09-26 16:56:12 +02:00
58ecced947 Use wget_human_readable() from Wget1.x
* bootstrap.conf: Remove module 'human'
* include/libwget.h.in: Amend wget_human_readable()
* libwget/bar.c: Use new function wget_human_readable()
* libwget/utils.c: Replace wget_human_readable()
* src/wget.c: Use new function wget_human_readable()
2016-09-20 16:39:39 +02:00
6417de198a Print human readable total number of bytes in progress bar
* include/libwget.h.in: Add wget_human_readable_alloc()
* libwget/utils.c: Add wget_human_readable_alloc()
* libwget/bar.c: Use wget_human_readable_alloc()
* src/bar.c (bar_init): Set log function after call to wget_bar_init()
* src/wget.c (main): Use wget_human_readable() to print bottom line of bar
2016-09-20 13:59:36 +02:00
36b095fd64 Fix Robots Exclusion Standard
* include/libwget.h.in: Add function wget_list_getnext().
* libwget/list.c: Add function wget_list_getnext().
* libwget/robots.c: Fix memory leak.
* src/host.c (host_remove_job): Cleanup queue after downloading and
  scanning robots.txt.
* src/job.h (struct JOB): Add flag 'requested_by_user'.
* src/wget.c (add_url_to_queue): Set 'requested_by_user',
  (add_url): Fix checking for disallowed paths.
* tests/Makefile.am: Add test 'test-robots'.
* tests/test-robots.c: New test to prove robots functionality.

Special handling for automatic robots.txt jobs
==============================================
What can happen with --recursive and --span-hosts is that a document from hostA
has links to hostB. All these links might go into the hostB queue before robots.txt
is downloaded and parsed. To avoid downloading of 'disallowed' documents, the queue
for hostB has to be cleaned up right after downloading and parsing robots.txt.
Any links links that have been explicitly requested by the user are still downloaded.
2016-09-19 15:23:48 +02:00
8368a98e98 Use gnulib human module for human readable file size
* bootstrap.conf: Add the human module and its dependency unistd
* include/libwget.h.in: Replace method signature for wget_human_readable
* libwget/bar.c (_bar_slot_t): Add a new struct memeber for storing the
human readable string that it printed on the progress bar
  (wget_bar_init): Initialise the new human_size struct member
  (wget_bar_update): Use the new wget_human_readable() method
  (_bar_print_final): Same
  (wget_bar_deinit): Free the allocated memory for each slot
* libwget/utils.c (wget_human_readable): Replace the old function with a
call to the human_readable() method from gnulib
2016-09-16 16:37:03 +02:00
99b1551215 Separate out the last update of the progress bar
When the progress bar is updated for the last time (whether exiting due
to error, or download complete), we may want to print information not
normally presented in the progress bar, like total time taken. To allow
this, separate out the printing of the last update of the progress bar

* include/libwget.h.in (_wget_bar_ctx): Remove unused members, final and
cond
* libwget/bar.c: Separate out the bar slot selection for reuse.
(_bar_print_final): New method for printing the last update of a
progress bar
2016-09-16 16:37:03 +02:00
c6590e3433 Use pthread_cancel to kill a thread
* include/libwget.h.in: Export new function wget_thread_cancel to kill
an existing thread nicely.
* libwget/thread.c: Same
* src/bar.c: Use the cleaner wget_thread_cancel() method to kill the
progress bar instead of polling for a variable.
2016-09-16 16:37:03 +02:00
f04b680a08 Create an asynchronous progress bar
Give the progress bar its own thread and let it update the entire
display asynchronously at a specified time interval. The existing
implementation refreshes the progress bar for each network packet
downloaded. Over multiple downloader threads and a high speed network
connection this can lead to far too many redrawings of the screen. Also,
each of the downloader threads will block while trying to acquire the
thread mutex because another thread just retrieved a packet. While I
haven't profiled it, it seems like there would be extremely high lock
contention in the existing implementation. Instead, with a separate
thread, we can update all the progress bar slots simultaneously at
regular intervals.

    * bootstrap.conf: Include Gnulib module "ioctl"
    * include/libwget.h.in: Define always_inline, flatten and deprecated
	compiler attributes for both GCC and Clang
    * include/libwget.h.in: Export new functions wget_human_readable,
	wget_bar_register and wget_bar_deregister.
    * include/libwget.h.in (wget_http_response_t): Add new element
	"cur_downloaded" to struct. This element keeps a track of the raw
	number of bytes downloaded in the response
        (_wget_bar_ctx): Define new struct for storing the progress bar
	context.
    * libwget/bar.c: Fix display of downloaded ratio. Ensure it does not
	exceed 100% by comparing the raw downloaded bytes instead of
	uncompressed downloaded bytes.
	Add support for printing the filename and downloaded bytes to the
	progress bar.
    * libwget/http.c (wget_http_response_cb): Store the raw number of
	bytes downloaded from the network in the response data
    * libwget/utils.c (wget_human_readable): New function to convert an
	int value to a human readable string
    * src/bar.c: Use the entire screen width instead of just 70 columns
	for the progress bar.
	Provide methods to register and deregister a progress bar
	context
	(wget_bar_update_thread): New method for the progress bar thread
	to update the output periodically.
    * src/bar.h: Same
    * src/job.h: Move definition of struct DOWNLOADER from main.c to
        here
    * src/progress.h: Move definition of _body_callback_context from
        main.c to here
    * src/utils.c: Add new method to determine the width of the screen
    * src/utils.h: Same
    * src/wget.c: Use the new progress bar contexts. Update, register
    and deregister them
        (main): Deinit the progress bar only if it was enabled
    * src/Makefile.am: Add new files, progress.h, utils.c, utils.h
2016-09-16 16:37:03 +02:00
acabe283fb * include/libwget.h.in: Add attribute const to wget_hash_get_len() 2016-08-07 13:01:32 +02:00
2bc25879cf Add TLS Session Resumption with persistent cache
* include/libwget.h.in: Add wget_tls_session_* set of functions,
  add new define WGET_SSL_SESSION_CACHE
* libwget/Makefile.am: Add tls_session.c to libwget
* libwget/ssl_gnutls.c (struct _config): Add tls_session_cache.
  (struct _session_context): Add delayed_session_data.
  (wget_ssl_set_config_string): Handle WGET_SSL_SESSION_CACHE.
  (wget_ssl_open): Add False Start debug messages,
  Set session data if cound in cache,
  Write session data into cache.
  (wget_ssl_read_timeout): Write session data into cache when
    False Start has been activated.
* libwget/tls_session.c: New file with session data cache implementation
* src/options.c (print_help): Add new options --tls-resume and
  --tls-session-file.
  (config): Set tls_resume activated by default.
  (options[]): Add tls-resume and tls-session-file.
  (init): Create session file name, init session data cache,
  Set session cache for TLS layer.
  (deinit): Free session cache and session cache filename.
* src/options.h (struct config): Add tls_session_db, tls_session_file,
  tls_resume.
* src/wget.c (main): Save session cache if changed.

TLS Session Resumption speeds up TLS handshake by 1xRTT.
Together with TCP Fast Open (enabled by default), we are down at
1xRTT TLS handshake overhead. To get down to 0 RTT we need a different
TLS protocol - TLS v1.3 will hopefully soon be standardized.
2016-07-22 10:43:59 +02:00
bcb5cac192 Add support for TLS False Start
* include/libwget.h.in: New declaration wget_tcp_set_tls_false_start()
  and wget_tcp_get_tls_false_start()
* libwget/net.c: New functions wget_tcp_set_tls_false_start() and
  wget_tcp_get_tls_false_start()
* libwget/net.h: Add tls_false_start to struct wget_tcp_st
* libwget/ssl_gnutls.c (_do_handshake): Print TLS False Start status.
  (wget_ssl_open): Enable TLS False Start for GnuTLS >= 3.5.0.
* src/options.c: Add description for --tls-false-start.
  (struct option options): Add option --tls-false-start.
  (init): Call wget_tcp_set_tls_false_start().
* src/options.h (struct config): Add member tls_false_start.
2016-07-20 13:22:18 +02:00
4740edc150 Declare wget_iri_is(un)reserved() as const
* include/libwget.h.in: Declare wget_iri_isunreserved() and
  wget_iri_isunreserved_path() with attribute 'const'
2016-07-12 09:15:57 +02:00
a9a4f9ce75 Use TCP Fast Open (TFO) within TLS handshake
* include/libwget.h.in: New declaration wget_tcp_get_tcp_fastopen()
* libwget/net.c: New function wget_tcp_get_tcp_fastopen(),
  (wget_tcp_connect): Support TFO
* libwget/ssl_gnutls.c: New function _ssl_writev()
  (wget_ssl_open): Set _ssl_writev() as push function in TFO requested
2016-07-11 14:53:36 +02:00
79dd277c12 Refactoring to separate send, receive and HTTP state machine
* examples/websequencediagram.c (main): Call wget_http_request_set_body()
  and wget_http_send_request() instead of wget_http_send_request_with_body().
* include/libwget.h.in: Add WGET_HTTP_USER_DATA, wget_get_timemillis(),
  extend wget_thread_cond_wait(), add body, user_data, body_length to
  wget_http_request_t, remove wget_http_send_request_with_body(),
  add wget_http_request_get_int(), wget_http_request_set_ptr(),
  wget_http_request_get_ptr(), wget_http_request_set_body().
* libwget/http.c: Add wget_http_request_get_int(),
  wget_http_request_set_ptr(), wget_http_request_get_ptr(),
  wget_http_request_set_body(),
  remove wget_http_send_request_with_body(),
  (wget_http_request_to_buffer): add body to request buffer.
* libwget/http_highlevel.c (wget_http_get): Replace
  wget_http_send_request_with_body()
* libwget/iri.c: Use c-ctype.h instead of ctype.h
  (wget_iri_parse): Allow any numbers of / after scheme:
  (wget_iri_parse): Catch URIs without /after scheme:
* libwget/list.c (wget_list_browse): Small code rearrangement
* libwget/metalink.c (_add_mirror): Check mirror.iri for NULL
* libwget/ssl_gnutls.c (send_ocsp_request): Replace
  wget_http_send_request_with_body()
* libwget/thread.c (wget_thread_cond_signal): Add timeout param
* libwget/utils.c: New function wget_get_timemillis()
* src/blacklist.c: Include wget.h instead of log.h
* src/blacklist.h: Fix indentation
* src/host.c: Add queueing stuff
* src/host.h: Reflect changes in host.c
* src/job.c: Remove queueing stuff
* src/job.h: Reflect changes in job.c
* src/log.c: Sync stdout/stderr to correct output order
* src/log.h: Remove shortcuts of print functions
* src/wget.c: Remove download_part() and http_get().
  Add http_send_request(), http_receive_response(), try_connection(),
  establish_connection(), add_statistics(), process_response_header().
  Amend downloader_thread() to reflect the changes.
* src/wget.h: Add shortcut defines for print functions.
* tests/libtest.c (_http_server_thread): Fix compiler warning,
  fix debug message.
  New function _write_msg() to print server messages yellow.
  (wget_test) Add -d to wget command line.
* tests/test-metalink.c (main): Add tests for V3 and V4 metalink
  files read from command line (-i, --force-metalink)
* tests/test.c (test_iri_parse): Add test for slash-less mailto: URI
2016-07-11 14:53:36 +02:00
aa389831a8 Use bitfields in structs where possible 2016-07-11 14:53:36 +02:00
06c5f8911e API changes for HTTP/2 parallel/async requests
* .gitignore: New entry examples/http_multi_get
* Makefile.am: Move subdir 'examples' before 'src'
* examples/Makefile.am: Add http_multi_get
* examples/http_get2.c (main): Adapt code to API changes
* examples/http_multi_get.c: New example to show async/parallel
  requests
* examples/websequencediagram.c (main): Adapt code to API changes
* include/libwget.h.in: New functions wget_http_request_set_header_cb,
    wget_http_request_set_body_cb, wget_http_request_set_int.
  Changed params of wget_http_get_response.
  Removed wget_http_get_response_func, wget_http_get_response_stream,
    wget_http_get_response_fd.
  Changed params of wget_http_get_response_cb.
  Add members pending_requests, received_http2_responses,
    pending_http2_requests to wget_http_connection_t.
  Add member req to wget_http_response_t.
  Add members header_callback, body_callback, header_user_data,
    body_user_data, response_keepheader to wget_http_request_t.
  New function types wget_http_header_callback_t and
    wget_http_body_callback_t.
* libwget/http.c: Implementation of the changes in include/libwget.h.in.
* libwget/http_highlevel.c: Adapt code to API changes
* libwget/ssl_gnutls.c: Fixed defaults for SNI, OCSP and
  ALPN.
  Adapt code to API changes.
* src/options.c: Reflect changes in libwget/ssl_gnutls.c
* src/wget.c: Adapt code to API changes
2016-06-22 09:17:57 +02:00
9457348d2d Fix compiler warnings
* include/libwget.h.in: Declare wget_tcp_get_protocol as PURE
* libwget/base64.c (wget_base64_decode, wget_base64_encode): Fix
  warning about missing switch() default
* libwget/http.c (_on_header_callback): Add switch default case,
  (wget_http_request_to_buffer): Remove unused variable 'use_proxy'
* libwget/ssl_gnutls.c (_print_info): Add switch default case
* libwget/vector.c (wget_vector_findext): Replace switch by if/else
* src/wget.c (_get_body): Check EAGAIN != EWOULDBLOCK via cpp
2016-06-15 17:01:48 +02:00
6ceb635ef6 Fix wget_srandom()
* include/libwget.h.in: Adjust wget_random() return type to int
* libwget/random.c (libwget/random.c): Use initstate_r() for seeding,
  (wget_srandom): Use initstate_r() for seeding
2016-05-08 22:40:33 +02:00
483c304aef Support parsing of UTF-16 HTML documents
* examples/print_html_urls.c (html_parse_localfile):
  Detect BOM (Byte Order Mark), convert UTF-16 to UTF-8 before parsing.
* include/libwget.h.in: Remove wget_charset_transcode(),
  add wget_memiconv() and wget_striconv().
* libwget/encoding.c: Implement wget_memiconv() and wget_striconv()
* src/wget.c (html_parse): Add 'html_len' param,
  convert UTF-16 to UTF-8 before parsing.
* tests/test.c: New test for wget_memiconv().
2016-04-24 15:08:20 +02:00
f7f06ba914 Add --force-metalink
* libwget.h.in: Remove metalink3_parse, metalink4_parse,
  Add wget_metalink_parse
* libwget/metalink.c: Merge metalink4_parse() and metalink3_parse()
  into wget_metalink_parse(),
  Only store HTTP and HTTPS mirrors
* src/job.c: Adjust debug message
* src/options.c: Add --force-options
* src/options.h: Add config.force_metalink
* src/wget.c: New function metalink_parse_localfile()
2016-03-30 14:40:35 +02:00
7f96ff9ed8 Do not use hard-coded user-agent in robots library code
* include/libwget.h.in: Update prototype of wget_robots_parse()
* libwget/robots.c (wget_robots_parse): Add client name as parameter
* src/wget.c: Call wget_robots_parse() with PACKAGE_NAME as client name
2016-03-29 19:20:01 +02:00
a51946b22b Fix compiler warnings
* include/libwget.h.in (wget_bar_init, wget_bar_update,
wget_bar_print): Change types to int and off_t.
* libwget/bar.c (wget_bar_init, wget_bar_update,
wget_bar_print): Change types to int and off_t.
* src/wget.c (_prepare_file): Add prototype.  Change type of rc to
size_t.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-20 14:42:56 +01:00