Adapted response logging as NONE/307

Asked by John Jacob

I am facing some difficulty with access.log file (host is squid 3.3.12) entry when the reqFilter adapter is returning a new response (aimed to redirect to a predifned url if matches some condition) , formed inside the start method. The access log is logging the transaction as log type NONE/307 rather than TCP_MISS/307.

Please find below the code I am using to form the response inside the reqFilter .

if(some condition){

libecap::shared_ptr < libecap::Message > adapted =libecap::MyHost().newResponse();
Must(adapted != 0);

libecap::StatusLine &statusLine =dynamic_cast<libecap::StatusLine&>(adapted->firstLine());
statusLine.statusCode(307);
statusLine.reasonPhrase(libecap::Area::FromTempString("Temporary Redirect "));

adapted->header().removeAny(libecap::headerContentLength);

// add a custom header
static const libecap::Name name("Location");

string redirectUrl;
// code to form the redirect url

const libecap::Header::Value value = libecap::Area::FromTempString(redirectUrl);
adapted->header().add(name, value);

hostx->useAdapted(adapted);
return;
}

Is there any way to make sure that the squid access log file logs the transaction with log type TCP_MISS/307?

Thanks in Advance,
John

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alex Rousskov (rousskov) said :
#1

This is a question about Squid, not eCAP, but Squid actions appear to be correct in your case: In pre-cache REQMOD request satisfaction mode, Squid has not checked its cache so TCP_MISS would be as misleading as TCP_HIT while NONE is pretty accurate.

Until/unless Squid adds support for post-cache REQMOD, there will be no way to log request satisfaction responses with TCP_MISS. You could place your adapter at pre-cache RESPMOD vectoring point (and adapt the response instead), but that would mean going to the origin server first, which, I assume, you do not want.

Revision history for this message
qianguozheng (guozhengqian0825) said :
#2

Hi Alex:

libecap::shared_ptr < libecap::Message > adapted =libecap::MyHost().newResponse();

where can I find the libecap::MyHost() implementation ?

Revision history for this message
qianguozheng (guozhengqian0825) said :
#3

Found that

Revision history for this message
Alex Rousskov (rousskov) said :
#4

For the record, MyHost() implementation is in libecap sources (src/libecap/common/registry.cc). The function simply returns the libecap::host::Host pointer registered by the host application.

Can you help with this problem?

Provide an answer of your own, or ask John Jacob for more information if necessary.

To post a message you must log in.