History log of /dovecot/src/lib-http/http-client-private.h
Revision Date Author Comments Expand
eaf49d968f5cbda1de3ccd45ce4d764d4bed2352 27-Feb-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Fix request statistics text to properly report send attempts. If the request was first sent in the same ioloop cycle in which the text is generated, the text would claim it was not sent at all yet. With this commit the text now explicitly makes the distinction between request attempts and actual send attempts. The number of attempts is increased at each retry, while the send attempts are increased each time the request is actually being sent to a server.

026b8778de7db026b1d42745114d8bb43c2a5d45 26-Feb-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Add event fields for the number of bytes sent and received for each request in the last attempt.

27521d4fae648249bcf9dbc83cd3b58682989755 26-Feb-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Record last status code in the request object.

fab1c263d60ee6a08f162af2146ff0ccf6b36061 26-Feb-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: Create http-common.h, which contains global definitions shared by client and server. Currently contains only the default HTTP port definitions that used to be private to the client.

5bde522a449024c667c58dc8b6f398cbb3060185 17-Feb-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Perform output stream error handling in one place.

7691bf6c1c6060fcd1e8d823bf1f80ebd6a784f5 17-Feb-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Make http_client_connection_lost() available outside http-client-connection.c.

753c65234187ca52423e7384796a8b0a2d531591 17-Feb-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Handle output stream errors in a separate function.

a68aaff537e2e30d782bb8b9d8782e1a10a17d1a 30-Jan-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Make sure all ioloop objects are created on the ioloop that the client/context is switched to.

ee90a96c4f47ff9c1e56451201386ca8a0b48124 04-Jan-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Use merged DNS settings from all clients connected to a shared context for DNS lookups.

4977156a495d44a5876be598b561bf1d9579e52e 04-Jan-2018 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Register client objects in the associated client shared context.

e8a1b62fe4a81b211dcccd1a58b44f254074eab6 13-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Made http_client record the current ioloop it is switched to. This prevents http_client_wait() from switching the client to an ioloop it was never explicitly switched to.

2d1ad5742dd723b39c51bcf64c62a600237de8ae 13-Dec-2017 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: client: Add support for event API

fd30e54bd56f0869f5c2e14b42fd53f7b36cff45 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Added identifier to client log messages.

27a2e59eaa648fef2acb2c4b852567d22e016a2d 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: shared context: Allow sharing peer state between clients.

e48102389fb49deadfc685600dc2e56177fd0d7c 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: shared context: Allow sharing host lookups between clients.

23fe024e1dfc8eb5eaefc4e57a16b4257568f510 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Avoid direct access to host object members from queue.

20493a543316e8c3acfd8ba4af257ceb658cdfce 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Moved connection pool handling from peer to separate object.

9fe6a55877bee691b32c12c7be56242054841670 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Moved connection list from client to shared context.

fab1a1c57f467c19c728d2391ff5e5025bb832f7 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Created basic shared context between clients. In this basic form it only shares default settings.

63a1359e6e7f6b1aebf58eb5d9f8187140ddcb4f 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Cosmetic changes to http-client-private.h.

8149ed57ae5abbb0c4ccfe88c1d7c58255dc85cf 07-Dec-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Created separate http_client_queue_get() function. Before, this was combined in http_client_queue_create() which caused a large code block to be indentet. Separating creation and obtaining the current instance makes the code cleaner.

4d1cc687f40dc2697005a4977e7ac40dda3d7dcf 21-Sep-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Send empty payload (Content-Length: 0) for requests that normally expect a payload. This includes the standard POST and PUT methods. Others need to use the new http_client_request_set_payload_empty() function to force sending an empty payload.

5791d02c3672f6a525f1fcf0f4f375b4be0ccf4b 25-May-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Only drop queued requests when a DNS lookup fails; not also the ones that are already in progress.

567d1c82e3e59a8e8acc2e1e01228585bab83bc6 25-May-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Explicitly destroy the response payload timeout stream when the request is destroyed while receiving payload. This way, the timeout is stopped. This caused ioloop panics.

f0452e0b310ddc74d84c2492f72fea41ffcb96a8 10-Apr-2017 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: Track request's first and last send attempt times separately.

935c09c68e944ae7f155884ed1eb77e3154cd93a 09-Apr-2017 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: Remove unnecessary enum declaration. Most of these were removed by a8fe899601735459641edae975c0fa08be8482e2

97a8fde13ea33b09163c45d978a4949043f189c5 23-Feb-2017 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Fixed i_unreached() failure occurring when a host's list of IPs changes while a connection is still pending. In that case, the IP of the pending connection may no longer be associated with that host. If the IP was not found anymore, the i_unreached() error occurred.

f17ac27e5989d6b3b3e4f4fb249bef4b06833ab7 17-Dec-2016 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Treat connections that get disconnected prematurely as connection failures. This means that the backoff time is increased when this happens. A premature disconnection happens when the connection is disconnected before any data is received from the server.

bad9931efd293ea9a676ce99e82c539e9d215e0d 17-Dec-2016 Stephan Bosch <stephan.bosch@dovecot.fi>

lib-http: client: Consolidated connection loss handling into a single function.

92f66f98f64ee3febbfba6618c4e144080d81a66 15-Nov-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

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.

c4b2dba355010a38f17b3cd84feb01ecb8b05a55 02-Nov-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Destroy host and associated queue objects after no more requests remain and an idle timeout expires.

1e63e30812158e6446d81cdbb2f45954794d4f8a 02-Nov-2016 Stephan Bosch <stephan@dovecot.fi>

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.

c62f15cc134cc9701c391eec8e9ef92105aa6d33 02-Nov-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Added http_client_queue_requests_active(). It counts how many active requests a queue has.

57d86b6fd46cb6d37bfc28f67ae4be80296ad35a 02-Nov-2016 Stephan Bosch <stephan@dovecot.fi>

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.

c1423bdba971228a283653222ed0367f84ab6402 02-Nov-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Unlink all queues from peer when it is disconnected. Before, queues were only destroyed when the whole client was destroyed. This change and subsequent changes prepare for being able to destroy a queue when it becomes unused.

66ea898de7face7fc9c275e01e514fa002446975 02-Nov-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Added function that counts how many connections are active within a peer.

2b9d522a3300fa84a1606e2108a159be7bb36154 02-Nov-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Added function that checks whether a connection is currently active.

c936df07cf490f090f2f336f40ca386cc953b055 02-Nov-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Improved handling of hosts with explicit IP address.

86ab71bf134573e45dd9ab6bde9d55da4c44fc48 24-Oct-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: Add ioloop and lock wait information to timeout messages. It'll now log for example: 9007 Request timed out (Request sent 7.087 secs ago, 0.076 in other ioloops, 7.012 in locks, connected 7.087 secs ago) Which points out that the problem wasn't really with the HTTP, but with locking. This likely should be fixed in some way also in lib-http so that it gives a bit of extra time for reading the request, but that's a separate fix.

5b6bfa39481f719c1fd6ed3febeaf7f0be9e8886 04-Aug-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: Support per-request timeout and max_attempts

0dffa25d211be541ee3c953b23566a1a990789df 06-Jun-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

global: unsigned int:1 -> bool:1 perl -i -pe 's/unsigned int ([^,:;]+):1;/bool $1:1;/' **/*.[ch]

/dovecot/src/anvil/anvil-connection.c /dovecot/src/anvil/penalty.c /dovecot/src/auth/auth-client-connection.h /dovecot/src/auth/auth-master-connection.h /dovecot/src/auth/auth-penalty.c /dovecot/src/auth/auth-postfix-connection.c /dovecot/src/auth/auth-request-handler.c /dovecot/src/auth/auth-request.h /dovecot/src/auth/auth-worker-client.c /dovecot/src/auth/auth-worker-server.c /dovecot/src/auth/db-checkpassword.c /dovecot/src/auth/db-passwd-file.h /dovecot/src/auth/db-sql.h /dovecot/src/auth/mech-digest-md5.c /dovecot/src/auth/passdb-pam.c /dovecot/src/auth/userdb-passwd.c /dovecot/src/auth/userdb-sql.c /dovecot/src/auth/userdb-static.c /dovecot/src/config/config-connection.c /dovecot/src/config/config-parser-private.h /dovecot/src/config/doveconf.c /dovecot/src/dict/dict-connection.h /dovecot/src/director/director-connection.c /dovecot/src/director/director-host.h /dovecot/src/director/director.h /dovecot/src/director/doveadm-connection.c /dovecot/src/director/login-connection.c /dovecot/src/director/mail-host.h /dovecot/src/director/user-directory.h /dovecot/src/doveadm/client-connection.h /dovecot/src/doveadm/doveadm-dsync.c /dovecot/src/doveadm/doveadm-mail-index.c /dovecot/src/doveadm/doveadm-mail-mailbox-status.c /dovecot/src/doveadm/doveadm-mail.h /dovecot/src/doveadm/doveadm-print-flow.c /dovecot/src/doveadm/doveadm-print-pager.c /dovecot/src/doveadm/doveadm-print-tab.c /dovecot/src/doveadm/doveadm-print-table.c /dovecot/src/doveadm/doveadm-stats.c /dovecot/src/doveadm/dsync/dsync-brain-private.h /dovecot/src/doveadm/dsync/dsync-ibc-private.h /dovecot/src/doveadm/dsync/dsync-ibc-stream.c /dovecot/src/doveadm/dsync/dsync-mailbox-export.c /dovecot/src/doveadm/dsync/dsync-mailbox-import.c /dovecot/src/doveadm/dsync/dsync-mailbox-tree.h /dovecot/src/doveadm/server-connection.c /dovecot/src/imap-login/imap-login-client.h /dovecot/src/imap-urlauth/imap-urlauth-client.h /dovecot/src/imap-urlauth/imap-urlauth-login.c /dovecot/src/imap-urlauth/imap-urlauth-worker.c /dovecot/src/imap/cmd-append.c /dovecot/src/imap/cmd-idle.c /dovecot/src/imap/cmd-list.c /dovecot/src/imap/cmd-select.c /dovecot/src/imap/cmd-urlfetch.c /dovecot/src/imap/imap-client.h /dovecot/src/imap/imap-fetch-body.c /dovecot/src/imap/imap-fetch.h /dovecot/src/imap/imap-notify.h /dovecot/src/imap/imap-search.h /dovecot/src/imap/imap-sync.c /dovecot/src/indexer/indexer-client.c /dovecot/src/indexer/indexer-queue.h /dovecot/src/indexer/master-connection.c /dovecot/src/indexer/worker-connection.c /dovecot/src/ipc/ipc-connection.h /dovecot/src/lib-auth/auth-client-private.h /dovecot/src/lib-auth/auth-master.c /dovecot/src/lib-auth/auth-master.h /dovecot/src/lib-auth/auth-server-connection.h /dovecot/src/lib-compression/istream-bzlib.c /dovecot/src/lib-compression/istream-lz4.c /dovecot/src/lib-compression/istream-lzma.c /dovecot/src/lib-compression/istream-zlib.c /dovecot/src/lib-compression/ostream-bzlib.c /dovecot/src/lib-compression/ostream-lzma.c /dovecot/src/lib-compression/ostream-zlib.c /dovecot/src/lib-dict/dict-client.c /dovecot/src/lib-dict/dict-private.h /dovecot/src/lib-dict/dict-sql.c /dovecot/src/lib-fs/fs-api-private.h http-client-private.h http-header-parser.c http-message-parser.h http-request-parser.c http-request.h http-response.h http-server-private.h http-transfer-chunked.c http-url.c http-url.h /dovecot/src/lib-imap-client/imapc-connection.c /dovecot/src/lib-imap-storage/imap-metadata.c /dovecot/src/lib-imap-storage/imap-msgpart-url.c /dovecot/src/lib-imap-storage/imap-msgpart.c /dovecot/src/lib-imap-urlauth/imap-urlauth-connection.c /dovecot/src/lib-imap-urlauth/imap-urlauth-fetch.c /dovecot/src/lib-imap-urlauth/imap-urlauth-fetch.h /dovecot/src/lib-imap-urlauth/imap-urlauth-private.h /dovecot/src/lib-imap/imap-arg.h /dovecot/src/lib-imap/imap-parser.c /dovecot/src/lib-imap/imap-url.c /dovecot/src/lib-imap/imap-url.h /dovecot/src/lib-index/mail-cache-private.h /dovecot/src/lib-index/mail-cache-transaction.c /dovecot/src/lib-index/mail-index-private.h /dovecot/src/lib-index/mail-index-strmap.c /dovecot/src/lib-index/mail-index-sync-private.h /dovecot/src/lib-index/mail-index-sync.c /dovecot/src/lib-index/mail-index-transaction-private.h /dovecot/src/lib-index/mail-index-view-private.h /dovecot/src/lib-index/mail-index-view-sync.c /dovecot/src/lib-index/mail-index.h /dovecot/src/lib-index/mail-transaction-log-private.h /dovecot/src/lib-index/mail-transaction-log-view-private.h /dovecot/src/lib-index/mail-transaction-log.h /dovecot/src/lib-lda/duplicate.c /dovecot/src/lib-lda/lmtp-client.c /dovecot/src/lib-mail/istream-binary-converter.c /dovecot/src/lib-mail/istream-dot.c /dovecot/src/lib-mail/istream-header-filter.c /dovecot/src/lib-mail/message-decoder.c /dovecot/src/lib-mail/message-header-decode.c /dovecot/src/lib-mail/message-header-parser.c /dovecot/src/lib-mail/message-header-parser.h /dovecot/src/lib-mail/message-parser.c /dovecot/src/lib-mail/message-search.c /dovecot/src/lib-master/ipc-server.c /dovecot/src/lib-master/master-instance.c /dovecot/src/lib-master/master-login-auth.c /dovecot/src/lib-master/master-login.c /dovecot/src/lib-master/master-login.h /dovecot/src/lib-master/master-service-private.h /dovecot/src/lib-master/master-service-settings-cache.c /dovecot/src/lib-master/master-service-settings.h /dovecot/src/lib-master/master-service.h /dovecot/src/lib-master/service-settings.h /dovecot/src/lib-sql/driver-cassandra.c /dovecot/src/lib-sql/driver-mysql.c /dovecot/src/lib-sql/driver-pgsql.c /dovecot/src/lib-sql/driver-sqlite.c /dovecot/src/lib-sql/sql-api-private.h /dovecot/src/lib-ssl-iostream/iostream-openssl.h /dovecot/src/lib-storage/index/cydir/cydir-save.c /dovecot/src/lib-storage/index/dbox-common/dbox-file.h /dovecot/src/lib-storage/index/dbox-common/dbox-save.h /dovecot/src/lib-storage/index/dbox-multi/mdbox-map-private.h /dovecot/src/lib-storage/index/dbox-multi/mdbox-map.c /dovecot/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c /dovecot/src/lib-storage/index/dbox-multi/mdbox-storage.h /dovecot/src/lib-storage/index/imapc/imapc-list.h /dovecot/src/lib-storage/index/imapc/imapc-save.c /dovecot/src/lib-storage/index/imapc/imapc-storage.h /dovecot/src/lib-storage/index/imapc/imapc-sync.h /dovecot/src/lib-storage/index/index-mail.h /dovecot/src/lib-storage/index/index-rebuild.h /dovecot/src/lib-storage/index/index-search-private.h /dovecot/src/lib-storage/index/index-search.c /dovecot/src/lib-storage/index/index-sort-string.c /dovecot/src/lib-storage/index/index-thread-finish.c /dovecot/src/lib-storage/index/index-thread-private.h /dovecot/src/lib-storage/index/index-thread.c /dovecot/src/lib-storage/index/istream-mail.c /dovecot/src/lib-storage/index/maildir/maildir-copy.c /dovecot/src/lib-storage/index/maildir/maildir-keywords.c /dovecot/src/lib-storage/index/maildir/maildir-save.c /dovecot/src/lib-storage/index/maildir/maildir-storage.h /dovecot/src/lib-storage/index/maildir/maildir-sync.c /dovecot/src/lib-storage/index/maildir/maildir-uidlist.c /dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c /dovecot/src/lib-storage/index/mbox/mbox-save.c /dovecot/src/lib-storage/index/mbox/mbox-storage.h /dovecot/src/lib-storage/index/mbox/mbox-sync-private.h /dovecot/src/lib-storage/index/pop3c/pop3c-client.c /dovecot/src/lib-storage/index/pop3c/pop3c-storage.h /dovecot/src/lib-storage/index/raw/raw-storage.h /dovecot/src/lib-storage/list/mailbox-list-fs-iter.c /dovecot/src/lib-storage/list/mailbox-list-index-notify.c /dovecot/src/lib-storage/list/mailbox-list-index-sync.h /dovecot/src/lib-storage/list/mailbox-list-index.h /dovecot/src/lib-storage/list/mailbox-list-iter.c /dovecot/src/lib-storage/list/mailbox-list-none.c /dovecot/src/lib-storage/mail-namespace.h /dovecot/src/lib-storage/mail-search-register.c /dovecot/src/lib-storage/mail-search.h /dovecot/src/lib-storage/mail-storage-private.h /dovecot/src/lib-storage/mail-storage-service.c /dovecot/src/lib-storage/mail-storage-service.h /dovecot/src/lib-storage/mail-storage.h /dovecot/src/lib-storage/mail-user.h /dovecot/src/lib-storage/mailbox-list-private.h /dovecot/src/lib-storage/mailbox-search-result-private.h /dovecot/src/lib-storage/mailbox-tree.c /dovecot/src/lib/buffer.c /dovecot/src/lib/connection.h /dovecot/src/lib/file-dotlock.c /dovecot/src/lib/file-dotlock.h /dovecot/src/lib/ioloop-private.h /dovecot/src/lib/istream-crlf.c /dovecot/src/lib/istream-file-private.h /dovecot/src/lib/istream-jsonstr.c /dovecot/src/lib/istream-mmap.c /dovecot/src/lib/istream-private.h /dovecot/src/lib/istream-tee.c /dovecot/src/lib/istream.h /dovecot/src/lib/mempool.h /dovecot/src/lib/module-dir.h /dovecot/src/lib/ostream-file-private.h /dovecot/src/lib/ostream-private.h /dovecot/src/lib/ostream.h /dovecot/src/lmtp/client.h /dovecot/src/lmtp/lmtp-proxy.c /dovecot/src/log/log-connection.c /dovecot/src/login-common/client-common.h /dovecot/src/login-common/login-proxy.c /dovecot/src/login-common/ssl-proxy-openssl.c /dovecot/src/master/service-process.h /dovecot/src/master/service.h /dovecot/src/plugins/acl/acl-api-private.h /dovecot/src/plugins/acl/acl-api.h /dovecot/src/plugins/acl/acl-backend-vfile.h /dovecot/src/plugins/acl/acl-lookup-dict.c /dovecot/src/plugins/acl/acl-mailbox-list.c /dovecot/src/plugins/expire/expire-plugin.c /dovecot/src/plugins/fts-lucene/fts-backend-lucene.c /dovecot/src/plugins/fts-solr/fts-backend-solr.c /dovecot/src/plugins/fts-solr/solr-connection.c /dovecot/src/plugins/fts-squat/squat-trie-private.h /dovecot/src/plugins/fts-squat/squat-trie.c /dovecot/src/plugins/fts-squat/squat-uidlist.c /dovecot/src/plugins/fts/fts-api-private.h /dovecot/src/plugins/fts/fts-indexer.c /dovecot/src/plugins/fts/fts-storage.c /dovecot/src/plugins/fts/fts-storage.h /dovecot/src/plugins/lazy-expunge/lazy-expunge-plugin.c /dovecot/src/plugins/pop3-migration/pop3-migration-plugin.c /dovecot/src/plugins/quota/quota-fs.c /dovecot/src/plugins/quota/quota-maildir.c /dovecot/src/plugins/quota/quota-private.h /dovecot/src/plugins/quota/quota-storage.c /dovecot/src/plugins/virtual/virtual-mail.c /dovecot/src/plugins/virtual/virtual-storage.h /dovecot/src/plugins/virtual/virtual-sync.c /dovecot/src/pop3/pop3-client.h /dovecot/src/replication/replicator/dsync-client.c /dovecot/src/replication/replicator/notify-connection.c /dovecot/src/replication/replicator/replicator-brain.c /dovecot/src/replication/replicator/replicator-queue.h
57c339f4e3404355a8924103317a6158a709ecf1 26-May-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Fixed bug in handling of lost connections while returning from another ioloop. At one instance the http_client_connection_is_ready() function could have destroyed the connection while the caller still depended on it. Renamed the http_client_connection_is_ready() function to http_client_connection_check_ready(). This now returns -1 when the connection got destroyed. Before it returned a bool that just indicated whether the connection was ready or not. So, there is no need anymore to preserve a connection reference while calling this function.

8a6dc50255a27bf887bbd9ed7c3a87bf629d4179 26-May-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Reworked connection close handling. Now, the peer is immediately notified of the lost connection. Before, this step was only taken when the connection was fully dereferenced. To prevent recursive notifications between peer and connection, handling the loss of a connection is deferred to the request handler. When a peer is freed, any associated lingering connections have conn->peer set to NULL.

7abab3b191860a3d77af5192b0649833c8a0c803 26-May-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Improved labeling of debug messages. Request label is corrected. Labels are now pre-composed and stored.

6ab81c81be13f33486746deeffe02a1ef2bcc821 26-May-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Prevent useless and unexpected request callbacks during http_client_deinit(). Requests are now destroyed before queues, hosts, peers and connections. As a side-effect, requests are now removed from the client request list at http_client_request_destroy(), so that requests with lingering references will no longer make http_client_wait() hang.

ebe0f5e387744621b73c4db79d5891ccbe0a1321 26-May-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Made peer object reference-counted to prevent invalid memory access in request handling routine. Resetting the peer->handling_requests flag risked triggering a segfault, since the peer object could be deleted from within the request handler loop.

d5c665cf2989d49922b63439ac45714e9755838a 26-May-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: Changed http_client_request_error to set request to NULL It's going to internally unreference it, so the caller should be aware of it also. I also changed request state check to be an assert, since I don't think there's any safe way this could work otherwise.

9284599e2d12b08170be81441bcfc53fa5b71a73 08-May-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: If connect fails, include attempt count and total time in error. This will produce errors such as: 9002 connect(1.2.3.4:801) failed: Connection timed out in 1.001 secs (4 attempts in 4.706 secs)

93c9909f68f7d057e38cca3b4612ec8d0bf42999 22-Apr-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: Include information about number of request attempts and its timing in response reason. Because the reason is usually logged as part of the error string, this causes all of the error messages to include the attempts count and how long the requests took in total. This should make it easier to understand problems in error logs. http_client_request_set_preserve_exact_reason() can be used to disable modifying the reason string. This may also apply to other reason modifications that may be done in the future.

5a37824675033747fcae3fe3fc3c0dd7ef0ca1cd 20-Apr-2016 Stephan Bosch <stephan@dovecot.fi>

lib-http: client: Cleaned up headers and added some more documentation there.

173d53863744e8ed87e8fa4c32dfcf3759e2ceb0 24-Mar-2016 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed request timeout handling during pipelining. The timeout was not managed correctly. If an earlier request finished, it would not restart the timeout for the next pending request. Also, filling the pipeline caused the timout to be reset inappropriately, postponing its expiry.

5257840e8d31a6cb7051703b4cb0931c82aba638 25-Feb-2016 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Gave request, connect and dns timeouts defaults that make more sense.

1f1ba791ba565d4a31b031fee95617490fe96b11 25-Feb-2016 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed crash happening when connection hits an error while handling a new request. At this point the connection dies within the peer request handler loop. Before, the dying connection could free the peer when it ended up being obsolete. But because it was still in the loop, a segfault occurred as the loop continued. Fixed by deferring the the deallocation of the peer from the connection_lost() function to the request handler loop itself if it is active.

d1f964d3f1dd9c5868b134c4f44dd63f3722eef7 22-Feb-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: http_client_request_unref() now always sets *req=NULL This makes its behavior consistent with other APIs in Dovecot. Also http_client_request_finish() no longer sets req=NULL, because all of its callers already keep a reference. Instead added an assert to make sure the reference is there.

1dead6eacb9302a8419bfc8f4b571ea9a3c00296 22-Feb-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: http_client_connection_unref() now always sets *conn=NULL This makes its behavior consistent with other APIs in Dovecot.

e1d8d185fa74752ba6807e415a9c82ebfdb2082c 10-Feb-2016 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed pipelining bug: client sometimes sent new request while still waiting for 100-continue.

79f8a20424633e806447bc9375a5ab403aabc758 10-Feb-2016 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Make sure that any pending request is aborted and destroyed before connection FDs are closed. This way, any payload io struct created from the response callback can be freed before the associated FD becomes invalid. This would cause an assert failure otherwise.

47a53a80656dc400ff8effdc1432a69fbf5ae8ba 16-Jan-2016 Timo Sirainen <timo.sirainen@dovecot.fi>

lib-http: Assign an ID for each HTTP request and log it in debug lines. The ID stays the same when request is retried. Added a "Req" prefix so it's easier to search for the IDs. Based on patch by Stephan Bosch.

ede750711f27ca9d9037a7ab9f016411b57f1ad9 25-Apr-2015 Stephan Bosch <stephan@rename-it.nl>

http-client: Added support for using an HTTP proxy running on a unix socket.

3d1edb8e3a07d91860cc6b4b3cec8282caa70891 18-Aug-2015 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed handling of request timeout. It was inappropriately active when the client needed to take action. This showed particularly with large payloads sent using http_client_request_send_payload().

91a4eaad6cae9b59820a1fa3ad42ef7aea7d1e67 18-Aug-2015 Stephan Bosch <stephan@rename-it.nl>

lib-http client: Added inline function to check whether request is directed at a proxy.

30f35cf5d1e1374d7fab4231e86144fc106a8e79 18-Aug-2015 Stephan Bosch <stephan@rename-it.nl>

lib-http client: Implemented simple authentication using Basic scheme.

8aa91c0f70ea2893d82a16a8b8d0171caccce74c 18-Aug-2015 Stephan Bosch <stephan@rename-it.nl>

lib-http client: Minor whitespace cleanups in struct http_client_request.

30ccfe4fdc2212d4341fa0edd6e8e73609ef1418 25-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed handling of requests aborted while still sending payload to server.

9145c8b5eda526d05bd4a7ced20f6f6f2ff8df03 25-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed conflict between request abort and request delayed error.

0d24f1550f5f70eb199018926a7bf0a12971695c 23-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed proxied client connect timeout. Timeout didn't cause requests to be aborted with error.

94d1b08c9e20d637db568a3eab3dfc2b9e96e62a 23-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Implemented maximum for connection backoff time. Without a maximum, the backoff time grows exponentially to enormous values, because it isn't reset until the connection succeeds. This causes recovery from connection failures to become very slow. Current maximum is one minute.

a991cfe2157e58ee43bc580f517ce9ef0dfb7acf 20-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Created list of all submitted requests. Currently only needed to improve debugging of hanging requests.

e4e4b8544a492cf90bd7a93c9a26e8285fc7c00b 20-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed behavior for max_connect_attempts with fewer IPs than attempts. This was broken by earlier 'fix'.

60381d37ec7213c21bd6ada7babb769f572646f9 20-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed handling of connection timeouts. A timeout caused an assert failure, because the connection status was altered before the peer_connection_failure handler was called.

fca68889b287d8eed4babe72a231bd6079da012d 12-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Moved delayed failed requests from host to client object.

22215c2d7538f4367c93e2d8b6ec4722463ac757 04-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: Fixed detecting disconnection when ioloop is running only intermittently. This fix only applies to ioloops created and run by lib-http itself.

b66def5dadd3e7c250313a938d26ad113663f86b 04-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Added support for absolute request timeout. Requests cannot survive beyond this deadline.

9f4f35957d2839d487d14b42bcb3f1a1de098b4b 04-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed problem occuring when a nested ioloop was run inside a request callback using the same client. If requests in the nested ioloop would use the same connection as the one that called the callback, the requests would (in the best scenario) all be doomed to time out.

a40a555561b3378c12a986b27f2651c632c8afa4 01-Oct-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Fixed recovery after connection failure. If a parallel already connected connection was active, the queue wasn't notified of the failure. Only pending connections should be considered in this case and not established ones.

fe2b0e3de834dd40b698bb579adc5357d5789ec9 10-Sep-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Implemented support for connection failure backoff.

9d746c6785d17e421c3f3c74cf29d059ae2ab233 10-Sep-2014 Stephan Bosch <stephan@rename-it.nl>

lib-http: client: Added support for attempting a single IP several times. Also limits the number of attempts when there are many IPs.

31fa529029f35f65451fb1d119ed1d5435b62e46 11-Jul-2014 Timo Sirainen <tss@iki.fi>

lib-http: Debug log now includes where HTTP requests spent their time on.

93cc87bb22386e020cee1093b6bd59295e0b33f0 22-Nov-2013 Stephan Bosch <stephan@rename-it.nl>

http: Implemented delayed requests scheduling. Requests can now be (re)submitted with a delay. The request is not sent until the delay time expires. This facilitates handling the Retry-After header in responses. This can either be performed automatically if the indicated delay is not too long or explicitly by the code using lib-http.

129596c93692b21d6c6b1313b389774af24c2983 22-Nov-2013 Stephan Bosch <stephan@rename-it.nl>

http-client: Improved handing of delayed request errors. Originally each request would have its own zero timeout, but now only one timeout is put in the host object.

de96afeeaa5242cffe89f1966457e935806b5746 22-Nov-2013 Stephan Bosch <stephan@rename-it.nl>

http-client: Changed struct http_client_host_port into a struct http_client_queue object. Peer and request objects now reference the queue object directly rather than the host object. This way, there is no need to find the matching host:port in the host anymore. This makes the queueing structure more intuitive and more efficient. This is a first step towards support for connecting to HTTP services through unix sockets or directing requests at specific hosts (so not from the URL). This patch also fixes a potential timeout leak (to_connect) in http_client_host_port (now http_client_queue) and makes sure it is moved during switch_ioloop(). Finally it updates the structure comment at the top of http-client.c.

e47c2f17d8136c4d972d1074a3f84ba2ecef4fdc 12-Oct-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: http-client: Added support for tunneling SSL conntections through proxy.

a62fe4b300e2f591e939993aec4cac1e7ae30ad1 12-Oct-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: Added support for creating CONNECT tunnels through HTTP.

4219de12b28f1936219e27501b9c4b27a4f8d53c 12-Oct-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: http-client: Implemented proxy support.

50d1446e71cfbdc5b6d7bafcf91b7bff453989d3 12-Oct-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: http-client: Added request error code for broken payload input stream. This error is triggered when reading from the provided payload input stream fails while sending the request. Previously this would yield the same error code as for a failure to write to the connection output.

0252ab930ea091e4c5ff18974ea2a21df00cab52 12-Oct-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: http-client: When client request is retried based on a response received from server, return full response to caller if retry is not possible. Before, it would construct a dummy-response that basically retains only the status and reason elements. This is currently only relevant for the way a 417 Expectation Failed response from the server is handled.

b99130e4cf4af4e6b103b949456222f3a2dff424 08-Oct-2013 Timo Sirainen <tss@iki.fi>

lib-http: Added setting for User-Agent header.

87c121a4c05b9cee46f1f757ec6999d441519abf 17-Sep-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: http-client: Allow overriding all implicitly generated special headers. Which are: Connection, Content-Length, Date, Expect, Host, and Transfer-Encoding.

a4e186e3ef267fc7a6b592788067c8c9c87d0785 15-Sep-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: Added support for asynchronous payload for requests. This means that the payload stream passed to the request can be a non-blocking socket stream from some other connection (e.g. proxy client connection).

6d573191bea1a64d6046be070487a5705a2d0204 15-Sep-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: http-client: Requests now automatically generate a Date header. The used date value is normally the submission time of the request, but it can be set explicitly.

930a2323047a5f0cdcc79a090488b72205c913f3 15-Sep-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: Fixed client connection and peer log labels to show proper IPv6 peers. The labels did not put IPv6 addresses in square brackets.

3fe92243970f9c0b7c449569fbd0c805e8719384 15-Sep-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: Removed useless prev,next fields from struct http_client_request.

fc94140acba51adafedafbc8491a3223a51db7a8 15-Sep-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: http-client: Fixed request scheduling and connection management.

524d89a40565709964b7ee5e8324a400dc53656b 10-Jul-2013 Timo Sirainen <tss@iki.fi>

lib-http: Minor comment update.

b3289b68d4c2e90fc369ea41539d49a6746764de 10-Jul-2013 Timo Sirainen <tss@iki.fi>

lib-http: Fix/cleanup to handling connect failures. There was some kind of double-error handling which messed up things.

e0bbc29e16360119a6193e83bf180b140acb2268 10-Jul-2013 Timo Sirainen <tss@iki.fi>

lib-http: Fixed tracking number of pending connections to host-port.

1a64096dcbea2765f370c9d35a3480d0e60c643b 10-Jul-2013 Timo Sirainen <tss@iki.fi>

lib-http: Always try to connect to host's all IPs when connections fail. Previously this was done only when the new connections started from the first IP.

6a33d6385601c89fdaeb437537f714b3a01dcea4 27-Jun-2013 Timo Sirainen <tss@iki.fi>

lib-http: Minor code cleanup.

70505f4839520ac67895992621c97d2480c22e7f 09-Jun-2013 Timo Sirainen <tss@iki.fi>

lib-http: Added soft_connect_timeout_msecs setting to connect to multiple IPs in parallel. Based on patch by Stephan Bosch.

515bb2bea9a398cb17c34c16729bc4222881de14 05-Jun-2013 Timo Sirainen <tss@iki.fi>

lib-http: After peer has received 100 response, don't add ambiguity timeout anymore. The server should be sending the 100 responses then, and long delays shouldn't be confused with them being missing.

a8c4e79ff50fac21b05a7368b052583d410ca15c 05-Jun-2013 Timo Sirainen <tss@iki.fi>

lib-http: Added connect and request timeout settings.

e1f9521e847757342e10b3c8d330e7a47f4ce286 04-Apr-2013 Timo Sirainen <tss@iki.fi>

lib-http: Prepare for TLS SNI support.

2a889fc596b12639ac55e657816b8a4f90440f88 04-Apr-2013 Timo Sirainen <tss@iki.fi>

lib-http: Pass connect failures all the way to request callback's error string.

a321ac56cfe330e3b28a4690f285419d36c3c6f4 04-Apr-2013 Timo Sirainen <tss@iki.fi>

lib-http: Simplify error handling by delaying connect() failures.

6bc9fb43cc1ac24693d030a6cbfa43bc7cbc82cb 04-Apr-2013 Timo Sirainen <tss@iki.fi>

lib-http: If http_client_request_submit() fails, don't immediately call the callback. This simplifies the caller's error handling since there is now only one error code path instead of two.

415e16c3dc185578695b7d88e561a52de6c8b1b1 03-Apr-2013 Timo Sirainen <tss@iki.fi>

lib-http: Each peer doesn't need a separate ssl context, enough to have one for http_client. Also removed #ifdefs for building with SSL support. lib-ssl-iostream nowadays dynamically loads the SSL library when needed, and also handles failures if Dovecot was built without SSL support.

6c768e0e1ca2da178e79f7435c32ced01f6bcb24 10-Mar-2013 Timo Sirainen <tss@iki.fi>

lib-http: Callback can now request a retry with http_client_request_try_retry() This can be useful for handling "try again" errors from HTTP servers.

4d4f0aca019c31cf4b555a99d3c0b3f2c1e1e80f 10-Mar-2013 Timo Sirainen <tss@iki.fi>

lib-http: If host can't be connected to, don't keep retrying with more than one connection. This also fixes infinitely trying to reconnect to host and retry.

1d048c5050f03c24251e5af8087e640de21b2d62 10-Mar-2013 Timo Sirainen <tss@iki.fi>

lib-http: Allow caller to find out what state a request is in.

92e011227877493a1b6a5a38863aabde7e07bd76 05-Mar-2013 Timo Sirainen <tss@iki.fi>

lib-http: Avoid hanging on urgent requests. Patch by Timo & Stephan. There are still some problems though, all urgent requests don't seem to get a new connection.

99feb6521535a7dc59d8dda89981ceac084b3e88 05-Mar-2013 Timo Sirainen <tss@iki.fi>

lib-http: If we get disconnected, say exactly what the error was.

9dc01e0d10a61cab14867b26bf0d2d1dcf8ad978 26-Feb-2013 Timo Sirainen <tss@iki.fi>

lib-http: Track peers using a linked list also. Mainly because this makes it much easier to debug using gdb. The overhead isn't that much extra either.

aacf2a69acc59e9382578d6f4e030788abc79706 26-Feb-2013 Timo Sirainen <tss@iki.fi>

lib-http: Track list of hosts using a linked list also. http_client_switch_ioloop() is done very often, and scanning a few entries in a linked list is much faster than going through a hash table.

4124bebe6daab2cd05acb0416096fc47cb9abd92 04-Feb-2013 Timo Sirainen <tss@iki.fi>

lib-http: Added http_client_request_set_destroy_callback() This is useful for io_remove()ing the payload stream's fd at the right time.

eb325a5a90c1d2655e74972bde0de6a699d2c864 01-Feb-2013 Stephan Bosch <stephan@rename-it.nl>

lib-http: Various bugfixes

65c0e43da8cfc730eeb4634f8aa384081bbfa4e7 06-Jan-2013 Timo Sirainen <tss@iki.fi>

lib-http: Various fixes Patch by Stephan Bosch.

50a6d26bd9041f44b4cad0c0357c0c604c132cc8 12-Dec-2012 Stephan Bosch <stephan@rename-it.nl>

lib-http: Added support for chunked input/output streams and some bugfixes.

7384b4e78eaab44693c985192276e31322155e32 23-Nov-2012 Stephan Bosch <stephan@rename-it.nl>

lib-http: Added initial HTTP client implementation.