Timo Sirainen [Fri, 20 Jan 2017 15:34:50 +0000 (17:34 +0200)]
lib-mail: istream-header-filter - Fix header read() when max_buffer_size=0
If the buffer was too small to read anything into it, read_header() returned
-2, but then it continued reading the header as if it was the body already.
This should instead be an error situation - max buffer size just shouldn't be
0 at this point.
Timo Sirainen [Mon, 30 Oct 2017 11:58:54 +0000 (13:58 +0200)]
imap: Set max buffer size for CATENATE istream-chain
This fixes a crash with mbox when nonexistent CATENATE URL is attempted to
be used. The istream doesn't get any size, and istream-header-filter panics
due to having reached the maximum buffer size (0), even though the stream is
empty and there's nothing to read.
Timo Sirainen [Tue, 31 Oct 2017 18:05:19 +0000 (20:05 +0200)]
doveadm-server: Deinitialize log proxying before closing SSL iostream
Otherwise the SSL iostream destroying may trigger debug/error logging,
which attempts to proxy logs when the stream is already closed. This
caused a panic.
Timo Sirainen [Tue, 31 Oct 2017 15:24:06 +0000 (17:24 +0200)]
lib-mail: ostream-dot - Set o_stream_set_finish_also_parent(FALSE) by default
ostream-dot is always used inside another ostream to implement some kind of
data escaping. The ostream-dot always has to be finished to write the "."
line, but the caller never wants it to finish the parent stream.
Timo Sirainen [Tue, 31 Oct 2017 15:09:47 +0000 (17:09 +0200)]
lib: connection - Use o_stream_set_finish_via_child(FALSE)
This allows o_stream_finish() calls on child streams without closing this
parent stream. Since the stream has no error checking by default anyway,
this allows the connection stream to be used more easily.
Timo Sirainen [Tue, 31 Oct 2017 15:07:44 +0000 (17:07 +0200)]
lib: Add o_stream_set_finish_also_parent() and _finish_via_child()
These allow controlling on both directions whether o_stream_finish() should
be finishing the parent stream. If either one is set to FALSE, the parent
stream isn't finished. Which one of these to use depends on the situation.
Timo Sirainen [Fri, 27 Oct 2017 23:09:58 +0000 (02:09 +0300)]
lib-compression: ostream-zlib - Require o_stream_finish() to write the trailer
It's now possible to call o_stream_flush() without the trailer getting
written.
It's also now required to call o_stream_finish() to write the trailer before
closing the ostream. This guarantees that the caller checks that the
trailer was successfully written. This isn't needed if the ostream already
failed before writing the trailer.
Timo Sirainen [Fri, 27 Oct 2017 22:15:14 +0000 (01:15 +0300)]
lib: Add o_stream_finish()
This marks the ostream as fully finished, with no further writes coming to
it. Otherwise it behaves like o_stream_flush().
The ostream.flush() methods are supposed to write their trailer (if the
ostream has one) when they see that ostream.finished is set. These will be
implemented by the following commits.
Timo Sirainen [Fri, 27 Oct 2017 21:54:37 +0000 (00:54 +0300)]
imap: Make sure long COPY commands send "* OK Hang in there" packets
o_stream_nflush() already flushed the writes to kernel, and Linux should
have sent them after 200ms delay, so this probably doesn't fix anything.
Using uncork+cork is a bit clearer way to indicate that the data really
is wanted to be sent now.
Timo Sirainen [Fri, 27 Oct 2017 21:48:01 +0000 (00:48 +0300)]
lib-imap: When sending "+ OK" to client, uncork ostream immediately
This makes sure that it's sent to the client as soon as possible.
Also removed o_stream_nflush(), since uncorking does that already.
If there is no corking, the "+ OK" was already attempted to be sent
by the o_stream_nsend() call and a flush is unlikely to help.
Timo Sirainen [Fri, 27 Oct 2017 20:31:56 +0000 (23:31 +0300)]
lib: o_stream_uncork() - call o_stream_nflush() instead of o_stream_flush()
Otherwise flush errors may be unintentionally ignored. This change requires
that all the o_stream_uncork() callers must call o_stream_nfinish()
afterwards, unless the ostream is set to ignore errors.
Stephan Bosch [Tue, 17 Oct 2017 16:03:59 +0000 (18:03 +0200)]
doveadm-server: http: Mark the HTTP request for connection closure right away.
This means that the connection is closed once the request finishes.
Before, each response did that individually.
Once connection reuse is implemented/needed this can now be turned off at one place.
Stephan Bosch [Fri, 27 Oct 2017 07:36:39 +0000 (09:36 +0200)]
doveadm-server: http: Changed request parse error into an assertion.
The condition can never occur when json-parser and the request parsing state machine are behaving correctly.
At that point only an object key can be returned; the client cannot cause it to return anything else.