* local constants and vars
*/
-const LookupTable<http_hdr_type, HeaderTableRecord> headerLookupTable(HDR_BAD_HDR, headerTable);
-
// statistics counters for headers. clients must not allow HDR_BAD_HDR to be counted
std::vector<HttpHeaderFieldStat> headerStatsTable(HDR_ENUM_END);
assert(name);
/* First try the quick path */
- id = headerLookupTable.lookup(SBuf(name));
+ id = HeaderLookupTable.lookup(SBuf(name));
if (id != HDR_BAD_HDR) {
if (!has(id))
debugs(55, 9, "parsing HttpHeaderEntry: near '" << getStringPrefix(field_start, field_end-field_start) << "'");
/* is it a "known" field? */
- http_hdr_type id = headerLookupTable.lookup(SBuf(field_start,name_len));
+ http_hdr_type id = HeaderLookupTable.lookup(SBuf(field_start,name_len));
debugs(55, 9, "got hdr id hdr: " << id);
String name;
void httpHeaderInitModule(void);
void httpHeaderCleanModule(void);
-// for header string->id lookup, use headerLookupTable.lookup(hdr-as-sbuf);
-extern const LookupTable<http_hdr_type, HeaderTableRecord> headerLookupTable;
-
#endif /* SQUID_HTTPHEADER_H */
headerMangler *
HeaderManglers::track(const char *name)
{
- int id = headerLookupTable.lookup(SBuf(name));
+ int id = HeaderLookupTable.lookup(SBuf(name));
if (id == HDR_BAD_HDR) { // special keyword or a custom header
if (strcmp(name, "All") == 0)
char* t = ConfigParser::strtokFile();
assert (t != NULL);
hdrName = t;
- hdrId = headerLookupTable.lookup(SBuf(hdrName));
+ hdrId = HeaderLookupTable.lookup(SBuf(hdrName));
regex_rule->parse();
}
*
*/
-struct SBufCaseInsensitiveLess : public std::binary_function<SBuf, SBuf, bool> {
+class SBufCaseInsensitiveLess : public std::binary_function<SBuf, SBuf, bool> {
+public:
bool operator() (const SBuf &x, const SBuf &y) const {
return x.caseCmp(y) < 0;
}
};
+
template<typename EnumType, typename RecordType = LookupTableRecord<EnumType> >
class LookupTable
{
}
HeaderWithAcl hwa;
hwa.fieldName = fn;
- hwa.fieldId = headerLookupTable.lookup(SBuf(fn));
+ hwa.fieldId = HeaderLookupTable.lookup(SBuf(fn));
if (hwa.fieldId == HDR_BAD_HDR)
hwa.fieldId = HDR_OTHER;
}
format->header = xstrdup(header);
- format->header_id = headerLookupTable.lookup(SBuf(header));
+ format->header_id = HeaderLookupTable.lookup(SBuf(header));
}
void
{nullptr, HDR_BAD_HDR, field_type::ftInvalid} /* end of table */
};
+const LookupTable<http_hdr_type, HeaderTableRecord> HeaderLookupTable(HDR_BAD_HDR, headerTable);
#ifndef SQUID_HTTP_REGISTEREDHEADERS_H
#define SQUID_HTTP_REGISTEREDHEADERS_H
+#include "base/LookupTable.h"
+
/// recognized or "known" header fields; and the RFC which defines them (or not)
/// http://www.iana.org/assignments/message-headers/message-headers.xhtml
typedef enum {
field_type type;
};
-/// header name->http_hdr_type lookup table.
+/// header ID->namelookup table.
extern const HeaderTableRecord headerTable[];
+/// for header name->id lookup, use HeaderLookupTable.lookup(hdr-as-sbuf);
+extern const LookupTable<http_hdr_type, HeaderTableRecord> HeaderLookupTable;
+
#endif /* SQUID_HTTP_REGISTEREDHEADERS_H */