Stephan Bosch [Sun, 25 Nov 2018 20:24:07 +0000 (21:24 +0100)]
lib: Create wrapper output stream.
This allows creating the stream before the actual output is available, thereby
wrapping the whole process of making a connection, doing protocol handshakes,
and submitting the request. Once there's an actual output stream, data from the
wrapper stream can be sent. Until that time, the wrapper will block or return 0
(based on whether it is blocking or not).
The wrapper stream is a partial implementation that needs to be completed (by in
heritance) by the respective protocol implementation.
Stephan Bosch [Fri, 13 Mar 2020 22:55:50 +0000 (23:55 +0100)]
lib-http: http-server-request - Add http_server_request_immune_ref/unref() and use the new API.
Makes the request immune to http_server_request_destroy() until the last immune
reference is dropped. The destruction is only delayed, so destroy is implicit
once the last immune reference is dropped.
Stephan Bosch [Sat, 9 Nov 2019 11:52:41 +0000 (12:52 +0100)]
lib-http: http-server-response - Restructure initialization of response payload sending.
Divided it into three phases: determination of the type of payload, the
initialization of the payload output stream and the construction of the message
header.
The new structure allows for adding new payload APIs more easily.
Stephan Bosch [Thu, 5 Jul 2018 22:01:14 +0000 (00:01 +0200)]
lib-http: http-server-response - Prevent response content stream from finishing the connection output stream.
This is not supposed to happen ever, because the connection output stream needs
to be available for several responses. This was at some point a problem in some
of the test with the new ostream payload API.
Stephan Bosch [Thu, 5 Jul 2018 21:52:51 +0000 (23:52 +0200)]
lib-http: http-client-request - Prevent request content stream from finishing the connection output stream.
This is not supposed to happen ever, because the connection output stream needs
to be available for several requests. This was at some point a problem in some
of the test with the new ostream payload API.
Stephan Bosch [Fri, 8 Nov 2019 16:11:36 +0000 (17:11 +0100)]
lib-http: http-server - Implement support for dynamically adding resources.
Before, the application would get all requests through a single main callback
and the application was always responsible for mapping request targets to a
particular application-defined HTTP resource. Now, an application can receive
requests for a certain HTTP resource through a separately-registered resource
object, which allows dynamic configuration of server resources. This way, e.g.
a generic HTTP service with several separate 'drivers' or plugin support for an
HTTP service can be implemented more easily.
Timo Sirainen [Thu, 16 Apr 2020 12:59:24 +0000 (15:59 +0300)]
lib-index: Fix cache purging when index is being rebuilt
All the messages until trans->first_new_seq no longer exist after reset.
At best they cause confusion and are ignored. They could also point to
high UIDs that the rebuilding removes, causing further corruption errors.
Timo Sirainen [Sun, 5 Apr 2020 15:36:44 +0000 (18:36 +0300)]
lib-index: Cache purging shouldn't always change YES decisions to TEMP
Previously every purging changed YES decision to be changed to TEMP.
This behaved rather badly if a cache file was purged twice within short
time period, because the clients might not have had time to access the
mailbox and change the decision back to YES. That in turn could have
dropped old mails' cached fields even though the client might still want
to use them. (A workaround for this has been to list all useful fields in
mail_always_cache_fields setting.)
The new behavior is to update the last_used field for a YES decision only
when the YES decision has been confirmed. If it's not confirmed for 30
days (mail_cache_unaccessed_field_drop) then its decision is changed to
TEMP on the next purge.
The new behavior also doubles the time when unaccessed field is dropped
from 30 days to 60 days (2*mail_cache_unaccessed_field_drop). This is
needed so that the field isn't dropped too early after YES -> TEMP
decision is changed.
Timo Sirainen [Sun, 5 Apr 2020 20:30:41 +0000 (23:30 +0300)]
lib-storage: Initialize new cache hdr.* fields with NO decision
Calling mail_cache_add() afterwards will change their decision to TEMP.
Or if it's not called, it probably wasn't wanted to be cached anyway.
Most importantly this change will cause mail_cache_decision event to be
triggered for these newly cached headers.