]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Re-assign delay pools based on HTTP reply details
authorVitaly Lavrov <vel21ripn@gmail.com>
Wed, 21 Oct 2015 11:45:35 +0000 (04:45 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 21 Oct 2015 11:45:35 +0000 (04:45 -0700)
src/DelayId.cc
src/DelayId.h
src/client_side_reply.cc

index 7350ad915585947240144338c6b9c76a166f6c19..4ad427ae9138f7b5d1bb89308f83515fa7ff1168 100644 (file)
@@ -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;
index 4bafb57ab5de5e9f7acfdbc7a1b02f42b8ab92ff..b8374c1e626de7c3cead29ce9425c7bd59f99e91 100644 (file)
 
 #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 ();
index e98c6be7c55fd1fa2b68fdc112c41a2f3f7ca088..9029510c60e65d1903ccf3c10abf6dec1ef918eb 100644 (file)
@@ -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) {