From c4a9875ece1f38bc7f73806950c166ee5958a817 Mon Sep 17 00:00:00 2001 From: Vitaly Lavrov Date: Wed, 21 Oct 2015 04:45:35 -0700 Subject: [PATCH] Re-assign delay pools based on HTTP reply details --- src/DelayId.cc | 6 +++++- src/DelayId.h | 6 ++++-- src/client_side_reply.cc | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/DelayId.cc b/src/DelayId.cc index 7350ad9155..4ad427ae91 100644 --- a/src/DelayId.cc +++ b/src/DelayId.cc @@ -63,7 +63,7 @@ DelayId::operator bool() const /* create a delay Id for a given request */ DelayId -DelayId::DelayClient(ClientHttpRequest * http) +DelayId::DelayClient(ClientHttpRequest * http, HttpReply *reply) { HttpRequest *r; unsigned short pool; @@ -85,6 +85,10 @@ DelayId::DelayClient(ClientHttpRequest * http) } ACLFilledChecklist ch(DelayPools::delay_data[pool].access, r, NULL); + if (reply) { + ch.reply = reply; + HTTPMSGLOCK(reply); + } #if FOLLOW_X_FORWARDED_FOR if (Config.onoff.delay_pool_uses_indirect_client) ch.src_addr = r->indirect_client_addr; diff --git a/src/DelayId.h b/src/DelayId.h index 4bafb57ab5..b8374c1e62 100644 --- a/src/DelayId.h +++ b/src/DelayId.h @@ -11,15 +11,17 @@ #if USE_DELAY_POOLS -class ClientHttpRequest; #include "DelayIdComposite.h" +class ClientHttpRequest; +class HttpReply; + /// \ingroup DelayPoolsAPI class DelayId { public: - static DelayId DelayClient (ClientHttpRequest *); + static DelayId DelayClient(ClientHttpRequest *, HttpReply *reply = nullptr); DelayId (); DelayId (unsigned short); ~DelayId (); diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index e98c6be7c5..9029510c60 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -2196,6 +2196,11 @@ clientReplyContext::sendMoreData (StoreIOBuffer result) cloneReply(); +#if USE_DELAY_POOLS + if (sc) + sc->setDelayId(DelayId::DelayClient(http,reply)); +#endif + /* handle headers */ if (Config.onoff.log_mime_hdrs) { -- 2.47.3