18 error(
"unconfigured"),
48 if (theTransfers.preview.matches(urlPath))
51 if (theTransfers.complete.matches(urlPath))
54 if (theTransfers.ignore.matches(urlPath))
57 debugs(93,7,
"url " << urlPath <<
" matches no extensions; " <<
58 "using default: " << theTransfers.byDefault->name);
59 return theTransfers.byDefault->kind;
81 return theTimestamp + ttl();
91 error =
"unsupported status code of OPTIONS response";
95 cfgMethod(ICAP::methodReqmod);
98 cfgMethod(ICAP::methodRespmod);
109 "OPTIONS body; type: " << h->
getByName(
"Opt-body-type"));
113 cfgIntHeader(h,
"Max-Connections", max_connections);
114 if (max_connections == 0)
117 cfgIntHeader(h,
"Options-TTL", theTTL);
121 if (theTimestamp < 0)
130 cfgIntHeader(h,
"Preview", preview);
132 cfgTransferList(h, theTransfers.preview);
133 cfgTransferList(h, theTransfers.ignore);
134 cfgTransferList(h, theTransfers.complete);
139 Must(m != ICAP::methodNone);
140 methods.push_back(m);
153 debugs(93,5,
"int header: " << fname <<
": " << value);
159 bool foundStar =
false;
160 list.
parse(buf, foundStar);
163 theTransfers.byDefault = &list;
164 debugs(93,5,
"set default transfer to " << list.
name);
167 list.
report(5,
"Adaptation::Icap::Options::cfgTransferList: ");
192 const size_t eLen = strlen(e->key);
196 const size_t eOff = urlLen - eLen;
198 if (urlPath[eOff-1] ==
'.' && urlPath.
substr(eOff).
cmp(e->key, eLen) == 0) {
199 debugs(93,7,
"url " << urlPath <<
" matches " << name <<
" extension " << e->key);
204 debugs(93,8,
"url " << urlPath <<
" matches no " << name <<
" extensions");
213 const char *pos =
nullptr;
216 if (ilen == 1 && *item ==
'*')
219 const char *tmp =
xstrndup(item, ilen+1);
230 debugs(93,level, prefix << name <<
": " << e->key);
232 debugs(93,level, prefix <<
"no " << name <<
" extensions");
int strListGetItem(const String *str, char del, const char **item, int *ilen, const char **pos)
void error(char *format,...)
void parse(const String &buf, bool &foundStar)
void add(const char *extension)
void report(int level, const char *prefix) const
bool matches(const SBuf &urlPath) const
struct Adaptation::Icap::Options::Transfers theTransfers
void cfgIntHeader(const HttpHeader *h, const char *fname, int &value)
void cfgTransferList(const HttpHeader *h, TransferList &l)
void configure(const HttpReply *reply)
void cfgMethod(ICAP::Method m)
TransferKind transferKind(const SBuf &urlPath) const
Http::StatusCode status() const
retrieve the status code for this status line
size_type length() const
Returns the number of bytes stored in SBuf.
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
SBuf substr(size_type pos, size_type n=npos) const
MemBlob::size_type size_type
char const * termedBuf() const
#define debugs(SECTION, LEVEL, CONTENT)
const char * wordlistAdd(wordlist **list, const char *key)
void wordlistDestroy(wordlist **list)
destroy a wordlist
char * xstrndup(const char *s, size_t n)