If header with the same key already exists, just replace the value.
HTTP supports having multiple headers with the same key only when they
can be rewritten into a single comma-separated header. So practically
there's no reason for lib-http to need to support adding multiple
headers. Replacing an existing value is more useful generally.
Aki Tuomi [Fri, 19 Apr 2019 17:39:32 +0000 (20:39 +0300)]
lib-dict: dict-sql - Add username as parameter
SQL statement caching works better when the username is provided
as parameter instead of part of the query, since the caching
can now cache same statements despite username changes.
The previous code always assumed it would be called from another thread, but
due to race conditions this wasn't true always. The lookup could have
already finished by the time cass_future_set_callback() was called, in which
case it called the callback immediately.
If the callback was called from the main thread, it still wrote to the
fd_pipe. Because this was a blocking write, it was possible that the pipe
ended becoming full, which caused the whole dict process to hang.
The core event exporter feature. It extends the metric { } config blocks
and adds new event_exporter { } blocks.
event_exporter EXNAME {
format = FMT # required, see below
format_args = FMTARGS # optional, see below
transport = TRANSPORT # required, see below
transport_args = TRANSPORTARGS # optional, see below
}
metric METNAME {
... normal metric fields ...
exporter = EXNAME # required to make export happen
exporter_include = INCS # optional, see below
}
FMT is a string identifying which format to serialize the event into. As of
this commit, the only valid value is "none" (always the empty string).
FMTARGS is a set of tokens that tweak how certain data types are encoded. If
not specified, the format's default is used ("none" always emits empty strings
so it doesn't care what this is set to, future formats will make use of this
setting). Currently the only possible tokens are: "time-rfc3339" and
"time-unix" - as their names imply, they format all timestamps as either
RFC3339 or Unix-style seconds since 1970-01-01 00:00:00 UTC.
TRANSPORT is a string identifying how to transport the serialized event. As
of this commit, the only valid value is "drop" which simply drops the event.
TRANSPORTARGS is a string used by the transport to tweak its behavior. The
drop transport ignores the args.
INCS is a string made up of tokens ("name", "hostname", "timestamps",
"categories", and "fields") which control what parts of an event are
exported. It can be set to any set of those (including empty set) and the
order doesn't matter. It defaults to all 5 tokens.
At times, we want to simplify the structure of events before sending them to
the stats process thereby minimizing the amount of data transfered and the
amount of work the stats process has to do. This simplification before
sending allows us to incur the CPU penalty in the (many) sending processes
instead of in the (sole & single-threaded) stats process.
Unlike the code in lib-master, this implementation flattens part of the
parent chain backwards so that parents' fields are properly overridden by
their children. It exists in lib because it shares code with the recently
added event_flatten().
Timo Sirainen [Fri, 10 May 2019 15:06:46 +0000 (18:06 +0300)]
lib: Make sure uncorking ostream-file flushes network output immediately
TCP_CORK and TCP_NODELAY are separate things, but we'll treat them similarly
for our ostream corking API. It was always intended that all data written
inside corking would be delayed until uncork, and immediately sent
afterwards.
This change removes unnecessary extra 40ms delays, which may happen when
proxying.
Aki Tuomi [Fri, 10 May 2019 12:55:22 +0000 (15:55 +0300)]
doveadm-dsync: Always cleanup after connection
Go through the same error handling path every time. Fixes
Panic: file ioloop.c: line 826 (io_loop_destroy): assertion failed: (ioloop == current_ioloop)
This happened because the ioloop wasn't destroyed
on error.
Timo Sirainen [Fri, 10 May 2019 16:16:07 +0000 (19:16 +0300)]
lib-storage: Attachment flag detection shouldn't cause mail body to be opened
Fetching cached mail headers with
mail_attachment_detection_options=add-flags-on-save caued IMAP BODYSTRUCTURE
to be fetched as well. If it wasn't already cached, this caused opening the
mail body to generate it. Also the result wasn't added to cache, so the
inefficient behavior continued.
Timo Sirainen [Thu, 9 May 2019 16:48:43 +0000 (19:48 +0300)]
doveadm dict: Make it clear that *iter_flags can't dereference NULL pointer
It's not possible to dereference it anyway, because only "doveadm dict iter"
has these iter parameters. This change fixes warnings from static analyzers.
Timo Sirainen [Thu, 9 May 2019 12:29:34 +0000 (15:29 +0300)]
global: Change CALLBACK_TYPECHECK() to used with subtraction
This is because clang's -Wstring-plus-int gave warnings when using
"string" + CALLBACK_TYPECHECK(), but there are no warnings when using
"string" - CALLBACK_TYPECHECK(). It would have been enough to change
only the string parameters to use "-", but for consistency this commit
changes all of them.
John Fawcett [Wed, 24 Apr 2019 07:37:55 +0000 (10:37 +0300)]
fts-solr: Add soft_commit setting
soft_commit=yes|no: send softCommit to the solr server, default yes is backwards compatible behaviour
If setting to no autoSoftCommit on solr should be set to something reasonable (e.g. 60 seconds)
in file solrconfig.xml
Stephan Bosch [Tue, 29 Jan 2019 21:16:26 +0000 (22:16 +0100)]
lib-http: client: Fix segfault occurring when an idle host times out.
This is most visible when the host is associated with an invalid host name: in
that case the idle timeout is only 100ms. For valid hosts, this problem can only
appear after 30 minutes idle time (default).
Problem is caused by the session host object starting a new idle timeout in the
shared host, while the shared and session host objects are both being destroyed.
Stephan Bosch [Thu, 25 Apr 2019 07:51:32 +0000 (09:51 +0200)]
lib-smtp: smtp-server-cmd-auth - Fix AUTH response error handling so that it stops reading more input.
Otherwise, it may try to read more data from the stream as the next AUTH
response, which causes an assert crash in the command parser later on. Even when
the parser finds no input from the stream, it will advance its state
towards AUTH response parsing, which is a problem when the next command is
subsequently being parsed.
Aki Tuomi [Tue, 16 Apr 2019 08:42:56 +0000 (11:42 +0300)]
mail-lua: Implement mailbox metadata API
Adds methods for accessing and manipulating mailbox metadata
* user:metadata_get("key", "key", ..) - returns value for keys
* user:metadata_set("key", "value") - sets value for key
* user:metadata_unset("key", "value") - unsets key
* user:metadata_list("prefix", "prefix", ...) - lists keys in dict for prefixes
* mailbox:metadata_get("key", "key", ..) - returns value for keys
* mailbox:metadata_set("key", "value") - sets value for key
* mailbox:metadata_unset("key", "value") - unsets key
* mailbox:metadata_list("prefix", "prefix", ...) - lists keys in dict for prefixes
User metadata is stored under /(private|shared)/vendor/vendor.dovecot/pvt/server to
mailbox INBOX, and is accessible with mailbox metadata methods with INBOX.