40#define MAX_REDIRECTOR_REQUEST_STRLEN (MAX_URL + 1024)
84 debugs(61, 5,
"reply=" << reply);
100 size_t replySize = 0;
101 if (
const char *t = strchr(res,
' ')) {
103 debugs(61, (!(
warn++%50)?
DBG_CRITICAL:2),
"WARNING: UPGRADE: URL rewriter responded with garbage '" << t <<
104 "'. Future Squid will treat this as part of the URL.");
113 replyBuffer.
init(replySize, replySize);
115 char * result = replyBuffer.
content();
126 if (*result ==
'!') {
127 static int urlgroupWarning = 0;
128 if (!urlgroupWarning++)
129 debugs(85,
DBG_IMPORTANT,
"WARNING: UPGRADE: URL rewriter using obsolete Squid-2 urlgroup feature needs updating.");
130 if (
char *t = strchr(result+1,
'!')) {
132 newReply.
notes.
add(
"urlgroup", result+1);
145 if (
const char *t = strchr(result,
':')) {
147 snprintf(statusBuf,
sizeof(statusBuf),
"%3u",status);
148 newReply.
notes.
add(
"status", statusBuf);
153 debugs(85,
DBG_CRITICAL,
"ERROR: URL-rewrite produces invalid " << status <<
" redirect Location: " << result);
160 newReply.
notes.
add(
"rewrite-url", result);
184 debugs(61, 5,
"StoreId helper: reply=" << reply);
204 redirectors->packStatsInto(sentry,
"Redirector Statistics");
219 storeIds->packStatsInto(sentry,
"StoreId helper Statistics");
233 static MemBuf requestExtras;
234 requestExtras.
reset();
235 if (requestExtrasFmt)
236 requestExtrasFmt->
assemble(requestExtras, http->
al, 0);
246 debugs(61,
DBG_CRITICAL,
"ERROR: Gateway Failure. Can not build request to be passed to " << name <<
". Request ABORTED.");
276 r->handler = handler;
279 debugs(61,6,
"sending '" << buf <<
"' to the " << name <<
" helper");
290 debugs(61, 5,
"redirectStart: '" << http->
uri <<
"'");
299 bypassReply.
notes.
add(
"message",
"URL rewrite/redirect queue too long. Bypassed.");
300 handler(data, bypassReply);
316 debugs(61, 5,
"storeIdStart: '" << http->
uri <<
"'");
325 bypassReply.
notes.
add(
"message",
"StoreId helper queue too long. Bypassed.");
326 handler(data, bypassReply);
336 static bool init =
false;
void warn(char *format,...)
#define cbdataReference(var)
#define CBDATA_CLASS_INIT(type)
#define cbdataReferenceValidDone(var, ptr)
#define CBDATA_CLASS(type)
HttpRequest *const request
ConnStateData * getConn() const
const AccessLogEntry::Pointer al
access.log entry
const Auth::UserRequest::Pointer & getAuth() const
static Pointer Make(const char *name)
Helper::ResultCode result
The helper response 'result' field.
const MemBuf & other() const
Auth::UserRequest::Pointer auth_user_request
void append(const char *c, int sz) override
void init(mb_size_t szInit, mb_size_t szMax)
char * content()
start of the added data
mb_size_t contentSize() const
available data size
void append(const NotePairs *src)
Append the entries of the src NotePairs list to our list.
void add(const SBuf &key, const SBuf &value)
RedirectStateData(const char *url)
Helper::ChildConfig redirectChildren
Helper::ChildConfig storeIdChildren
struct SquidConfig::@83 Program
struct SquidConfig::@77 Timeout
struct SquidConfig::@90 onoff
struct SquidConfig::UrlHelperTimeout onUrlRewriteTimeout
void setReplyToError(err_type, Http::StatusCode, char const *, const ConnStateData *, HttpRequest *, const char *, Auth::UserRequest::Pointer)
builds error using clientBuildError() and calls setReplyToError() below
#define debugs(SECTION, LEVEL, CONTENT)
void clientStreamRead(clientStreamNode *thisObject, ClientHttpRequest *http, StoreIOBuffer readBuffer)
void HLPCB(void *, const Helper::Reply &)
void helperShutdown(const Helper::Client::Pointer &hlp)
void helperSubmit(const Helper::Client::Pointer &hlp, const char *const buf, HLPCB *const callback, void *const data)
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
static void constructHelperQuery(const char *const name, const Helper::Client::Pointer &hlp, HLPCB *const replyHandler, ClientHttpRequest *const http, HLPCB *const handler, void *const data, Format::Format *const requestExtrasFmt)
static Format::Format * redirectorExtrasFmt
static HLPCB redirectHandleReply
static Helper::Client::Pointer storeIds
static HLPCB storeIdHandleReply
void storeIdStart(ClientHttpRequest *http, HLPCB *handler, void *data)
static Format::Format * storeIdExtrasFmt
static Helper::Client::Pointer redirectors
#define MAX_REDIRECTOR_REQUEST_STRLEN
url maximum length + extra information passed to redirector
void redirectReconfigure()
void redirectStart(ClientHttpRequest *http, HLPCB *handler, void *data)
static int storeIdBypassed
static int redirectorBypassed
void redirectShutdown(void)
static OBJH redirectStats
@ toutActUseConfiguredResponse
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)