]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
8 years agolib-storage: Preserve box-name header when rebuilding index.
Timo Sirainen [Wed, 16 Nov 2016 01:01:22 +0000 (03:01 +0200)] 
lib-storage: Preserve box-name header when rebuilding index.

8 years agodoveadm dump: Add support for the new box-name index header.
Timo Sirainen [Tue, 15 Nov 2016 23:44:58 +0000 (01:44 +0200)] 
doveadm dump: Add support for the new box-name index header.

8 years agoLAYOUT=index: Update mailbox name to mailbox index's header when opening.
Timo Sirainen [Tue, 15 Nov 2016 23:43:34 +0000 (01:43 +0200)] 
LAYOUT=index: Update mailbox name to mailbox index's header when opening.

This way if the mailbox list index gets lost, a recent mailbox name is still
available.

8 years agolib-storage: Prevent renaming mailbox under itself.
Timo Sirainen [Tue, 15 Nov 2016 23:09:57 +0000 (01:09 +0200)] 
lib-storage: Prevent renaming mailbox under itself.

This resulted earlier in a loop, which broke the mailbox index.
Note that IMAP already prevented this, so it could only be triggered by
other tools, like doveadm.

8 years agolib-storage: Prevent parent loops in mailbox list index
Timo Sirainen [Tue, 15 Nov 2016 23:04:18 +0000 (01:04 +0200)] 
lib-storage: Prevent parent loops in mailbox list index

8 years agolib-storage: Fix invalid parents in LAYOUT=index
Timo Sirainen [Tue, 15 Nov 2016 23:03:20 +0000 (01:03 +0200)] 
lib-storage: Fix invalid parents in LAYOUT=index

Previously it just kept complaining without fixing the errors.

8 years agolib-storage: Improve mailbox list index corruption errors
Timo Sirainen [Tue, 15 Nov 2016 23:01:58 +0000 (01:01 +0200)] 
lib-storage: Improve mailbox list index corruption errors

8 years agolib-storage: If LAYOUT=index loses mailbox names, write the generated ones to index.
Timo Sirainen [Tue, 15 Nov 2016 22:57:06 +0000 (00:57 +0200)] 
lib-storage: If LAYOUT=index loses mailbox names, write the generated ones to index.

Previously it just kept complaining and regenerating new names, without
actually fixing up the situation.

8 years agolib-storage: Fix handling LAYOUT=index losing mailbox names
Timo Sirainen [Tue, 15 Nov 2016 22:55:38 +0000 (00:55 +0200)] 
lib-storage: Fix handling LAYOUT=index losing mailbox names

It lost all the mailbox names.

8 years agoconfig: Match local_name using dns-util
Aki Tuomi [Fri, 11 Nov 2016 11:40:55 +0000 (13:40 +0200)] 
config: Match local_name using dns-util

This way it correctly handles wildcards.

8 years agolib-dns: Add tests for dns-util
Aki Tuomi [Fri, 11 Nov 2016 11:36:23 +0000 (13:36 +0200)] 
lib-dns: Add tests for dns-util

8 years agolib-dns: Add DNS specific matching algorithms
Aki Tuomi [Fri, 11 Nov 2016 11:13:29 +0000 (13:13 +0200)] 
lib-dns: Add DNS specific matching algorithms

RFC4343 and RFCRFC4592 compare and match algorithms

8 years agomaster: Fix compiling with systemd after /dev/null changes
Timo Sirainen [Wed, 16 Nov 2016 19:36:17 +0000 (21:36 +0200)] 
master: Fix compiling with systemd after /dev/null changes

8 years agoconfigure: Removed AC_CONFIG_MACRO_DIR([m4]) for now
Timo Sirainen [Wed, 16 Nov 2016 15:36:03 +0000 (17:36 +0200)] 
configure: Removed AC_CONFIG_MACRO_DIR([m4]) for now

Fixes:
libtoolize: AC_CONFIG_MACRO_DIR([m4]) conflicts with ACLOCAL_AMFLAGS=-I ..

8 years agoimap: Use correct format specifier for highestmodseq
Aki Tuomi [Wed, 16 Nov 2016 10:47:59 +0000 (12:47 +0200)] 
imap: Use correct format specifier for highestmodseq

8 years agoMakefile: Add -I . to ACLOCAL_AMFLAGS
Timo Sirainen [Wed, 16 Nov 2016 11:45:28 +0000 (13:45 +0200)] 
Makefile: Add -I . to ACLOCAL_AMFLAGS

Without this when aclocal is automatically run it doesn't generate a working
configure.

8 years agolib-index: Fix flushing NFS if minimum wanted transaction log file is lost
Timo Sirainen [Wed, 16 Nov 2016 11:29:49 +0000 (13:29 +0200)] 
lib-index: Fix flushing NFS if minimum wanted transaction log file is lost

8 years agoimap: Add details why unhibernation failed
Aki Tuomi [Tue, 15 Nov 2016 16:55:36 +0000 (18:55 +0200)] 
imap: Add details why unhibernation failed

This can help understanding why client
failed to unhibernate.

8 years agoglobal: Use fd_close_maybe_stdio()
Timo Sirainen [Wed, 16 Nov 2016 09:41:42 +0000 (11:41 +0200)] 
global: Use fd_close_maybe_stdio()

8 years agolib: Add fd_close_maybe_stdio()
Timo Sirainen [Wed, 16 Nov 2016 09:40:35 +0000 (11:40 +0200)] 
lib: Add fd_close_maybe_stdio()

The idea is that this should be used whenever closing fds that may be 0 or
1. If they are closed normally, the following code may end up using 0/1 fd
for other purposes, which could cause problems.

8 years agoglobal: use dev_null_fd instead of opening /dev/null
Timo Sirainen [Wed, 16 Nov 2016 09:37:34 +0000 (11:37 +0200)] 
global: use dev_null_fd instead of opening /dev/null

8 years agomaster: Don't unlink login sockets at startup if someone is listening to them.
Timo Sirainen [Wed, 16 Nov 2016 09:35:42 +0000 (11:35 +0200)] 
master: Don't unlink login sockets at startup if someone is listening to them.

The original check there never worked, because null_fd was always set.

Normally the master.pid file would prevent this happening, but if it didn't
exist, the sockets would be unlinked and usually also created back.

8 years agolib-master: Revert redundant stdin/stdout/stderr fd checks
Timo Sirainen [Wed, 16 Nov 2016 09:17:27 +0000 (11:17 +0200)] 
lib-master: Revert redundant stdin/stdout/stderr fd checks

This is now done by lib_init() in a bit nicer way.

Reverts 08923d2c956ece3dc604d5842ba152c2bdb11fb9

8 years agolib: Make sure stdin/stdout/stderr have fd at startup and keep /dev/null always open
Timo Sirainen [Wed, 16 Nov 2016 09:09:01 +0000 (11:09 +0200)] 
lib: Make sure stdin/stdout/stderr have fd at startup and keep /dev/null always open

This guarantees we will always have a fd that can be used as /dev/null.
It works even inside chroots.

8 years agoFix -Wstrict-bool compiler warnings.
Timo Sirainen [Tue, 15 Nov 2016 21:56:19 +0000 (23:56 +0200)] 
Fix -Wstrict-bool compiler warnings.

8 years agodoveadm-save: Check stream errno before save
Aki Tuomi [Thu, 3 Nov 2016 13:30:58 +0000 (15:30 +0200)] 
doveadm-save: Check stream errno before save

This is to ensure the file has been really opened.

8 years agoManually cleanup OpenSSL from dovecot_openssl_common_global_unref()
Apollon Oikonomopoulos [Sun, 13 Nov 2016 18:04:27 +0000 (20:04 +0200)] 
Manually cleanup OpenSSL from dovecot_openssl_common_global_unref()

OpenSSL 1.1 features a cleanup function that is automatically run on shutdown
using atexit(3). This function frees all OpenSSL-allocated resources.

In dovecot, OpenSSL is loaded indirectly using dlopen(3) against the relevant
dovecot crypto module and is finally unloaded using dlclose(3). Until
OpenSSL 1.0.1c this worked fine, however OpenSSL 1.0.1c makes sure[1] that the
library stays loaded after the initial dlclose() so that the atexit(3)
handlers can run on shutdown. This, together with the fact that dovecot
uses custom allocation functions for OpenSSL and has already partially
free()'d some of OpenSSL's resources in module_free(), leads to a
segfault at process shutdown[2].

We fix this by explicitly calling OPENSSL_cleanup() during module unload. This
is safe to do, as long as we will never want to subsequently re-initialize
OpenSSL.

[1] https://github.com/openssl/openssl/commit/4af9f7fe79ff82b90c16969b7e5871435056377b
[2] https://buildd.debian.org/status/fetch.php?pkg=dovecot&arch=amd64&ver=1:2.2.26.0-2&stamp=1478873022

Signed-off-by: Apollon Oikonomopoulos <apoikos@debian.org>
8 years agossl: fix reference to SSLv2 and disable SSLv3
Apollon Oikonomopoulos [Tue, 15 Nov 2016 11:55:44 +0000 (12:55 +0100)] 
ssl: fix reference to SSLv2 and disable SSLv3

This is driven by the fact that OpenSSL 1.1 does not know about SSLv2 at
all and dovecot's defaults simply make OpenSSL error out with "Unknown
protocol 'SSLv2'"[1]. So we change the defaults to refer to SSLv2 iff OpenSSL
seems to know something about it.

While at it, it's also a good idea to disable SSLv3 by default as well.

[1] https://bugs.debian.org/844347

Signed-off-by: Apollon Oikonomopoulos <apoikos@debian.org>
8 years agolib-http: Use io_wait_timer for tracking wait times.
Timo Sirainen [Tue, 15 Nov 2016 10:42:47 +0000 (11:42 +0100)] 
lib-http: Use io_wait_timer for tracking wait times.

The previous code was completely incorrect, since it wasn't even tracking
the HTTP request's start usecs.

8 years agodict-client: Use io_wait_timer for tracking wait times.
Timo Sirainen [Tue, 15 Nov 2016 10:41:53 +0000 (11:41 +0100)] 
dict-client: Use io_wait_timer for tracking wait times.

This way the "dict wait" time includes all ioloop waits that wait on the
dict-client, not just in dict_wait().

8 years agolib: Added io_wait_timer
Timo Sirainen [Tue, 15 Nov 2016 10:21:56 +0000 (11:21 +0100)] 
lib: Added io_wait_timer

This allows easier tracking of how much time the io_wait_timer has been
spending on (multiple) ioloops.

8 years agolib: Code cleanup - move code to ioloop_add_wait_time()
Timo Sirainen [Tue, 15 Nov 2016 10:20:41 +0000 (11:20 +0100)] 
lib: Code cleanup - move code to ioloop_add_wait_time()

8 years agolib: Fix ioloop wait times when io_loop_time_refresh() is used
Timo Sirainen [Tue, 15 Nov 2016 10:11:37 +0000 (11:11 +0100)] 
lib: Fix ioloop wait times when io_loop_time_refresh() is used

8 years agodoveadm: Put doveadm_mail_iter_init parameters to right order
Aki Tuomi [Tue, 15 Nov 2016 18:10:43 +0000 (20:10 +0200)] 
doveadm: Put doveadm_mail_iter_init parameters to right order

8 years agolib-storage: Add vsize hdr on empty mailbox
Aki Tuomi [Tue, 15 Nov 2016 11:40:54 +0000 (13:40 +0200)] 
lib-storage: Add vsize hdr on empty mailbox

8 years agodoveadm-director: Include tag in add line
Aki Tuomi [Tue, 15 Nov 2016 11:17:05 +0000 (13:17 +0200)] 
doveadm-director: Include tag in add line

8 years agodoveadm-import: Open source boxes read-only
Aki Tuomi [Tue, 15 Nov 2016 07:33:15 +0000 (09:33 +0200)] 
doveadm-import: Open source boxes read-only

This allows importing emails from read-only locations,
such as backups.

8 years agodoveadm: Add open read-only parameter to mailbox iterator
Aki Tuomi [Tue, 15 Nov 2016 07:32:31 +0000 (09:32 +0200)] 
doveadm: Add open read-only parameter to mailbox iterator

This allows iterating mailboxes so that they
are opened for read-only.

8 years agostats: Add support for carbon-server
Aki Tuomi [Sun, 6 Nov 2016 00:50:52 +0000 (02:50 +0200)] 
stats: Add support for carbon-server

Allows admin to specify stats_carbon_server=ip:port.
Stats are delivered in "key value" format
to specified port. Can be received with e.g.
metronome.

8 years agolib: Add net_ipport2str
Aki Tuomi [Wed, 9 Nov 2016 13:17:01 +0000 (15:17 +0200)] 
lib: Add net_ipport2str

Converts struct ip_addr + port into either
127.0.0.1:6000 or [::1]:6000.

8 years agodoveadm: Fix error reporting for doveadm-dump-dcrypt
Aki Tuomi [Mon, 14 Nov 2016 08:52:22 +0000 (10:52 +0200)] 
doveadm: Fix error reporting for doveadm-dump-dcrypt

8 years agolib: Assert-crash in i_close_fd() if fd == 0
Timo Sirainen [Mon, 14 Nov 2016 13:54:37 +0000 (14:54 +0100)] 
lib: Assert-crash in i_close_fd() if fd == 0

lib-master now guarantees that fd==0 doesn't normally happen.

8 years agomaster: Remove redundant check to guarantee stdin/stdout/stderr fd existence.
Timo Sirainen [Mon, 14 Nov 2016 13:51:45 +0000 (14:51 +0100)] 
master: Remove redundant check to guarantee stdin/stdout/stderr fd existence.

The previous method also wasn't correct, since it was setting close-on-exec
flag for the fds. Although this didn't normally make any difference, since
stdin & stdout was explicitly dup2()ed to /dev/null and for all except the
log process stderr was also being dup2()ed.

8 years agolib-master: Make sure stdin/stdout/stderr fds are open.
Timo Sirainen [Mon, 14 Nov 2016 13:48:20 +0000 (14:48 +0100)] 
lib-master: Make sure stdin/stdout/stderr fds are open.

We'll just open /dev/null for them if they don't already exist.

8 years agolib: Mark istream with eof=TRUE on all errors
Aki Tuomi [Mon, 14 Nov 2016 14:45:24 +0000 (16:45 +0200)] 
lib: Mark istream with eof=TRUE on all errors

Previously only i_stream_read() did this, but i_stream_seek(), _stat(),
_get_size() and _create() didn't. This caused assert-crashes on error
conditions in code which assumed that when stream_errno != 0, eof==TRUE.

8 years agolib-program-client: Do not call callback when destroying
Aki Tuomi [Wed, 9 Nov 2016 13:40:48 +0000 (15:40 +0200)] 
lib-program-client: Do not call callback when destroying

8 years agodict-client: When dict-server times out, log ioloop/lock waits.
Timo Sirainen [Mon, 14 Nov 2016 12:22:06 +0000 (13:22 +0100)] 
dict-client: When dict-server times out, log ioloop/lock waits.

8 years agodict-client: Code cleanup to timeout handling.
Timo Sirainen [Mon, 14 Nov 2016 12:18:13 +0000 (13:18 +0100)] 
dict-client: Code cleanup to timeout handling.

No functional changes.

8 years agodict-client: Dict server timeout may have occurred too early.
Timo Sirainen [Mon, 14 Nov 2016 12:14:25 +0000 (13:14 +0100)] 
dict-client: Dict server timeout may have occurred too early.

8 years agolib-index: Improve error messages when transaction log is unexpectedly lost
Timo Sirainen [Fri, 11 Nov 2016 15:00:39 +0000 (17:00 +0200)] 
lib-index: Improve error messages when transaction log is unexpectedly lost

8 years agodict-client: Forward dict_iterate_set_limit() to dict server
Timo Sirainen [Thu, 10 Nov 2016 21:00:59 +0000 (23:00 +0200)] 
dict-client: Forward dict_iterate_set_limit() to dict server

8 years agodict-client: Code cleanup - remember all iteration flags
Timo Sirainen [Thu, 10 Nov 2016 21:23:39 +0000 (23:23 +0200)] 
dict-client: Code cleanup - remember all iteration flags

8 years agolib-dict: Fix infinite loop when row limit is reached.
Timo Sirainen [Thu, 10 Nov 2016 20:57:22 +0000 (22:57 +0200)] 
lib-dict: Fix infinite loop when row limit is reached.

If dict_iterate_has_more() keeps returning TRUE, the caller keeps calling
dict_iterate().

8 years agosdbox: Fix crash on mailbox_sync*() when mailbox auto-open fails.
Timo Sirainen [Thu, 10 Nov 2016 16:24:46 +0000 (18:24 +0200)] 
sdbox: Fix crash on mailbox_sync*() when mailbox auto-open fails.

8 years agodirector: Don't access freed memory during deinit
Timo Sirainen [Fri, 11 Nov 2016 11:06:41 +0000 (13:06 +0200)] 
director: Don't access freed memory during deinit

8 years agodirector: Fix crash when receiving USER-MOVE for nonexistent user.
Timo Sirainen [Wed, 9 Nov 2016 13:17:01 +0000 (15:17 +0200)] 
director: Fix crash when receiving USER-MOVE for nonexistent user.

8 years agoimap: Free box on error
Aki Tuomi [Tue, 8 Nov 2016 18:41:15 +0000 (20:41 +0200)] 
imap: Free box on error

Otherwise the box wil leak as it is not assigned
anywhere and can cause crash on imap exit due
to stats plugin timeout leak.

8 years agodirector: Keep per-tag directory
Aki Tuomi [Thu, 20 Oct 2016 16:06:22 +0000 (19:06 +0300)] 
director: Keep per-tag directory

8 years agodirector: Code cleanup - typedef user_free_hook
Aki Tuomi [Tue, 1 Nov 2016 12:36:19 +0000 (14:36 +0200)] 
director: Code cleanup - typedef user_free_hook

This is done because user_free_hook needs to be
also used in mail_host. If it changes, this
reduces the places that need touching.

8 years agodirector: Code cleanup - Reorder includes
Aki Tuomi [Tue, 1 Nov 2016 12:40:49 +0000 (14:40 +0200)] 
director: Code cleanup - Reorder includes

This is required to enable typedef of
user_free_hook

8 years agodirector: Code cleanup - moved username_hash generation to director.h
Timo Sirainen [Thu, 20 Oct 2016 17:31:33 +0000 (20:31 +0300)] 
director: Code cleanup - moved username_hash generation to director.h

It's not really user_directory specific. This is especially important
in the following patches that add per-tag user_directories. It's also not
always known which tag the username_hash refers to, so there can't be
different tag-specific username_hash generators.

8 years agodirector: Code cleanup - added user director_iterate_users_*() wrappers.
Timo Sirainen [Thu, 20 Oct 2016 16:38:28 +0000 (19:38 +0300)] 
director: Code cleanup - added user director_iterate_users_*() wrappers.

This will shrink the diff for the following changes.

8 years agodirector: Code cleanup - use temporary users variables
Timo Sirainen [Thu, 20 Oct 2016 16:17:11 +0000 (19:17 +0300)] 
director: Code cleanup - use temporary users variables

This will shrink the diff for the following changes.

8 years agodirector: Code cleanup - moved code to notify_update_user()
Timo Sirainen [Thu, 20 Oct 2016 13:14:36 +0000 (16:14 +0300)] 
director: Code cleanup - moved code to notify_update_user()

8 years agodirector: const mail_host in mail_host_get_tag
Aki Tuomi [Thu, 20 Oct 2016 12:13:04 +0000 (15:13 +0300)] 
director: const mail_host in mail_host_get_tag

8 years agolib: Add test vectors for message digests
Aki Tuomi [Sat, 5 Nov 2016 17:06:33 +0000 (19:06 +0200)] 
lib: Add test vectors for message digests

8 years agolib: Add SHA3 hashing methods for 256 and 512 bits
Aki Tuomi [Sat, 5 Nov 2016 09:48:27 +0000 (11:48 +0200)] 
lib: Add SHA3 hashing methods for 256 and 512 bits

8 years agolib: Move sha context and result size to new header
Aki Tuomi [Sat, 5 Nov 2016 09:47:40 +0000 (11:47 +0200)] 
lib: Move sha context and result size to new header

This is to prepare for SHA3 inclusion

8 years agolib-storage: Updated MAIL_SEARCH_ARG_FLAG_USE_TZ comment.
Timo Sirainen [Fri, 4 Nov 2016 10:18:47 +0000 (12:18 +0200)] 
lib-storage: Updated MAIL_SEARCH_ARG_FLAG_USE_TZ comment.

8 years agolib-storage: Fix doveadm search query parsing to use timezones correctly.
Timo Sirainen [Fri, 4 Nov 2016 10:04:11 +0000 (12:04 +0200)] 
lib-storage: Fix doveadm search query parsing to use timezones correctly.

When using a date string, e.g. "senton 25-Mar-2007" it should work the same
way as IMAP does and show all mails whose sent date is on 25th, ignoring
whatever the timezone is in the Date header (or in case of received/saved-date
it would be using the timestamps in server's local timezone, again just like
IMAP).

When search with an exact UNIX timestamp or a time interval (e.g.
"3 days"), it should be using UTC times for doing all comparisons.

8 years agolib-storage: Reverse MAIL_SEARCH_ARG_FLAG_USE_TZ handling again.
Timo Sirainen [Fri, 4 Nov 2016 10:03:47 +0000 (12:03 +0200)] 
lib-storage: Reverse MAIL_SEARCH_ARG_FLAG_USE_TZ handling again.

It wasn't really wrong, it was just confusing. And doveadm's tz-handling
was wrong.

Reverses 059e4ac419224598349704b74cb9f6b49278df46

8 years agolib: Define ARRAY_TYPE for uint8_t, uint16_t and uint64_t.
Timo Sirainen [Thu, 3 Nov 2016 17:16:49 +0000 (19:16 +0200)] 
lib: Define ARRAY_TYPE for uint8_t, uint16_t and uint64_t.

8 years agoauth: Use buffer_truncate_rshift_bits
Aki Tuomi [Tue, 1 Nov 2016 19:50:29 +0000 (21:50 +0200)] 
auth: Use buffer_truncate_rshift_bits

8 years agolib: Add tests for hashed var-expand
Aki Tuomi [Thu, 27 Oct 2016 13:20:20 +0000 (16:20 +0300)] 
lib: Add tests for hashed var-expand

8 years agolib: Add generic hashing support to var-expand
Aki Tuomi [Thu, 27 Oct 2016 12:37:45 +0000 (15:37 +0300)] 
lib: Add generic hashing support to var-expand

Enables use of

%{H;rounds=<rounds>,truncate=<bits>,salt=<salt>:field}

syntax in any variable expansion. H is any supported
hash algorithm or pkcs5 for PKCS#5 PBKDF2 using SHA256.

8 years agolib: var_expand() code cleanup - Moved short %v expansion to its own function.
Timo Sirainen [Mon, 31 Oct 2016 17:20:51 +0000 (19:20 +0200)] 
lib: var_expand() code cleanup - Moved short %v expansion to its own function.

8 years agolib: Add unit test for buffer truncate
Aki Tuomi [Tue, 1 Nov 2016 18:14:43 +0000 (20:14 +0200)] 
lib: Add unit test for buffer truncate

8 years agolib: Updated buffer_set_used_size() comment and added unit test.
Timo Sirainen [Mon, 16 May 2016 10:19:50 +0000 (13:19 +0300)] 
lib: Updated buffer_set_used_size() comment and added unit test.

8 years agolib: Do not consume {} inside %{}
Aki Tuomi [Thu, 27 Oct 2016 13:19:52 +0000 (16:19 +0300)] 
lib: Do not consume {} inside %{}

8 years agolib: Add buffer truncate
Aki Tuomi [Tue, 1 Nov 2016 18:06:46 +0000 (20:06 +0200)] 
lib: Add buffer truncate

8 years agoauth: Make static analyzer happier.
Timo Sirainen [Wed, 2 Nov 2016 21:00:50 +0000 (23:00 +0200)] 
auth: Make static analyzer happier.

Don't complain about uninitialized static_password being sent to
passdb_handle_credentials(). It could only happen for failures, and
passdb_handle_credentials() wouldn't have used the password then.

8 years agofts: Fix error message when syncing FTS root mailbox fails.
Timo Sirainen [Wed, 2 Nov 2016 19:59:12 +0000 (21:59 +0200)] 
fts: Fix error message when syncing FTS root mailbox fails.

8 years agolib: ioloop-notify-kqueue wasn't storing source filename.
Timo Sirainen [Wed, 2 Nov 2016 13:31:14 +0000 (15:31 +0200)] 
lib: ioloop-notify-kqueue wasn't storing source filename.

8 years agolib-http: test-http-client-errors: Add test for server that returns error status...
Stephan Bosch [Tue, 8 Nov 2016 23:48:32 +0000 (00:48 +0100)] 
lib-http: test-http-client-errors: Add test for server that returns error status early while client is still sending blocking payload.

8 years agolib-http: client: Fixed assert failure occurring when server returns error status...
Stephan Bosch [Tue, 8 Nov 2016 23:46:32 +0000 (00:46 +0100)] 
lib-http: client: Fixed assert failure occurring when server returns error status early while client is still sending blocking payload.

8 years agolib-http: Added blocking client support to test-http-client-errors.
Stephan Bosch [Tue, 8 Nov 2016 23:24:54 +0000 (00:24 +0100)] 
lib-http: Added blocking client support to test-http-client-errors.

8 years agolib-http: Fixed potential segfault problem in test-http-client-errors.
Stephan Bosch [Thu, 3 Nov 2016 20:06:27 +0000 (21:06 +0100)] 
lib-http: Fixed potential segfault problem in test-http-client-errors.

Found by Coverity.

8 years agolib-http: Added DNS-related tests to test-http-client-errors.
Stephan Bosch [Tue, 25 Oct 2016 07:56:34 +0000 (09:56 +0200)] 
lib-http: Added DNS-related tests to test-http-client-errors.

8 years agolib-http: client: Destroy host and associated queue objects after no more requests...
Stephan Bosch [Fri, 16 Sep 2016 18:29:00 +0000 (20:29 +0200)] 
lib-http: client: Destroy host and associated queue objects after no more requests remain and an idle timeout expires.

8 years agolib-http: client: Implemented host name lookup TTL.
Stephan Bosch [Fri, 16 Sep 2016 18:22:17 +0000 (20:22 +0200)] 
lib-http: client: Implemented host name lookup TTL.

Host name lookups will now be performed again when the results have expired.
Without access to TTL information from DNS lookups, all lookups will use the same default TTL for now.

8 years agolib-http: client: Added http_client_queue_requests_active().
Stephan Bosch [Thu, 15 Sep 2016 20:49:54 +0000 (22:49 +0200)] 
lib-http: client: Added http_client_queue_requests_active().

It counts how many active requests a queue has.

8 years agolib-http: client: Create queue->pending_peers array from the beginning.
Stephan Bosch [Thu, 15 Sep 2016 23:58:27 +0000 (01:58 +0200)] 
lib-http: client: Create queue->pending_peers array from the beginning.

This simplifies the code, since the pending peers array is always used.

8 years agolib-http: client: Link peers to queue earlier: during connection attempts.
Stephan Bosch [Thu, 15 Sep 2016 23:35:09 +0000 (01:35 +0200)] 
lib-http: client: Link peers to queue earlier: during connection attempts.

This makes sure that queues keep track of which peers are doing stuff on its behalf.
This is important to be able to manage the active peers when a new host name lookup was performed; if a peer is no longer listed in the returned IPs it should be dropped.

8 years agolib-http: client: Created http_client_peer_drop() function that closes a peer object...
Stephan Bosch [Thu, 15 Sep 2016 00:14:46 +0000 (02:14 +0200)] 
lib-http: client: Created http_client_peer_drop() function that closes a peer object gracefully.

It checks whether any connections are still present.
It checks whether a backoff timer is still active.
This change and subsequent changes prepare for being able to destroy a queue when it becomes unused.
All peers linked to such a queue are unlinked and dropped when inactive and unlinked.

8 years agolib-http: client/server: Enable the TCP_NODELAY option for all connections.
Stephan Bosch [Thu, 16 Jun 2016 20:02:08 +0000 (22:02 +0200)] 
lib-http: client/server: Enable the TCP_NODELAY option for all connections.

This disables the TCP Nagle algorithm. With the Nagle algorithm enabled, TCP waits a little to accumulate more data in a small segment before it is sent. For transfer of large continuous payloads, this is not useful and even harmful.
If the final remaining bit of the payload is small, the TCP layer will wait for a significant amount of time at the end of the payload. For many sequential transfers, this amounts to much waiting time.
This is particularly evident in the test-http-payload test suite tool. Setting TCP_NODELAY decreases its run time from up to 20 minutes to about half a minute my system.

8 years agolib: Created net_set_tcp_nodelay(), which enables the TCP_NODELAY socket option.
Stephan Bosch [Thu, 16 Jun 2016 20:01:06 +0000 (22:01 +0200)] 
lib: Created net_set_tcp_nodelay(), which enables the TCP_NODELAY socket option.

This disables the TCP Nagle algorithm.

8 years agolib-http: client: Improved labeling of debug messages.
Stephan Bosch [Mon, 23 May 2016 00:36:10 +0000 (02:36 +0200)] 
lib-http: client: Improved labeling of debug messages.

Request label is corrected.
Labels are now pre-composed and stored.

8 years agolib-http: server: Implemented means to gracefully shut down the server.
Stephan Bosch [Sat, 16 Apr 2016 01:54:00 +0000 (03:54 +0200)] 
lib-http: server: Implemented means to gracefully shut down the server.

While shutting down, it will not accept new requests and connections are closed once they become idle.

8 years agolib-http: client: Added ability to configure a specific proxy for individual requests.
Stephan Bosch [Wed, 27 Apr 2016 10:00:25 +0000 (12:00 +0200)] 
lib-http: client: Added ability to configure a specific proxy for individual requests.

This way, a request can be routed to a specific proxy (or origin server). The destination can also be a unix socket.

8 years agolib-http: client: Added pure attribute to some of the request property functions.
Stephan Bosch [Sat, 16 Apr 2016 00:05:28 +0000 (02:05 +0200)] 
lib-http: client: Added pure attribute to some of the request property functions.