Re: Modifying Set-Cookie header in Squid 3.3.9

From: Peter Belau <pbelau1_at_yahoo.com>
Date: Fri, 25 Apr 2014 02:19:34 -0700 (PDT)

Alex, clientReplyContext::buildReplyHeader() did the trick, thank you. Also, just for my own understanding, what's fundamentally wrong with modifying the StoreEntry? On Thursday, April 24, 2014 7:20 AM, Alex Rousskov <rousskov_at_measurement-factory.com> wrote: On 04/24/2014 04:33 AM, Peter Belau wrote: > I'm trying to modify the Set-Cookie header from within > client_side_reply.cc. Currently my code looks like this: >    HttpReply *rep = http->storeEntry()->getReply()->clone(); >    http->storeEntry()->releaseRequest(); >    rep->header.putStr(HDR_SET_COOKIE, "FOO=bar"); >    http->storeEntry()->replaceHttpReply(rep); >    http->storeEntry()->complete(); > This seems to corrupt storeEntry in ways that I don't understand. I > imagine that I'm missing something fundamental here. If someone could > point me in the right direct, I would much appreciate it. Hi Peter,     There are at least two fundamental problems here: * As Eliezer has already noted, you should be using one of the many available adaptation interfaces instead of modifying sources directly. If the available interfaces do not do what you want, they usually can be enhanced (or new interfaces can be added). As you said, we all have specific reasons for doing the wrong thing, of course. * If you want to adjust each response, including HIT responses, you should be modifying the response as it goes out, not the Store entry itself. See clientReplyContext::buildReplyHeader(). If you want to adjust the response before it may be cached (so that a cached response is adjusted just once and served many times), then you should be doing that in http.cc instead. HTH, Alex.
Received on Fri Apr 25 2014 - 09:19:50 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 25 2014 - 12:00:16 MDT