16 Commits

Author SHA1 Message Date
5495dab56a Fallback to select() if poll() not available
* bootstrap.conf: Add module select
* libwget/io.c (wget_ready_2_transfer): Add fallback code
2017-01-18 11:15:24 +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
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
40b8da056e Reduce redundant code by using strchrnul()
* bootstrap.conf: Add gnulib module strchrnul
* libwget/http.c (_parse_proxies): Remove redundant code
* libwget/ssl_gnutls.c (wget_ssl_open): Likewise
2016-12-16 15:41:58 +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
ed53ecbfa1 Use gnulib basename
* bootstrap.conf: Add gnulib module 'dirname'
* libwget/io.c: Use base_name() to get file basename
2016-11-08 12:41:12 +01:00
4c6d6179f2 Replace manywarnings module by our own code
* bootstrap.conf: Remove manywarnings, add warnings
* configure.ac: Replace manywarnings code

The new code works on recent gcc and clang with an overhead of
~100ms instead of ~9s here (without -C).
This is meant for developers only and is activated by either
--enable-gcc-warnings or by touching .manywarnings.
2016-11-02 16:51:49 +01:00
fd46f870b1 Add gnulib digest hash fallback
* bootstrap.conf: Add md2, md5, sha1, sha256, sha512 modules
* libwget/hashfile.c: Add code branch to use gnulib functions if needed
2016-10-17 21:04:36 +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
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
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
c835040f4a Fix fnmatch() on Solaris
* bootstrap.conf: Add fnmatch-gnu
* configure.ac: Add AC_GNU_SOURCE
2016-09-09 17:10:54 +02:00
4f632d29fe * examples/websequencediagram.c (main): Fix printf format string 2016-09-09 16:05:37 +02:00
58da53ddcc Generate distributed ChangeLog from git log
* bootstrap.conf: Add gnulib module 'gitlog-to-changelog'.
* Makefile.am: Generate the ChangeLog file from the git log.
2016-07-12 12:55:13 +02:00
efeec48707 Remove references to autogen.sh. Set SKIP_PO.
* bootstrap.conf: add SKIP_PO=1, so that we don't have to pass
  the --skip-po flag every time we run bootstrap.
* README.md, contrib/check-hard, contrib/mingw, docs/mainpage.md,
  .travis.sh: amend references to autogen.sh.
* autogen.sh: Removed
* .gitignore: Add build-aux
* po/Makevars: Remove auto-generated file from repo
2016-07-08 16:11:01 +02:00
ef6bc41ba3 Use bootstrap
* bootstrap, bootstrap.conf: new files.
 * configure.ac: invoke AC_CONFIG_MACRO_DIR and
   AC_CONFIG_AUX_DIR.
2016-06-26 17:03:31 +02:00