HttpHeaderFieldStat stat;
} HttpHeaderCcFields;
-/* order must match that of enum http_hdr_cc_type */
+/* order must match that of enum http_hdr_cc_type. The constraint is verified at initialization time */
static HttpHeaderCcFields CcAttrs[CC_ENUM_END] = {
{"public", CC_PUBLIC},
{"private", CC_PRIVATE},
{"Other,", CC_OTHER} /* ',' will protect from matches */
};
+/// Map an header name to its type, to expedite parsing
typedef std::map<String,http_hdr_cc_type> HdrCcNameToIdMap_t;
static HdrCcNameToIdMap_t HdrCcNameToIdMap;
+// iterate over a table of http_header_cc_type structs
http_hdr_cc_type &operator++ (http_hdr_cc_type &aHeader)
{
int tmp = (int)aHeader;
// HdrCcNameToIdMap is self-cleaning
}
-/* implementation */
-
-HttpHdrCc *
-httpHdrCcCreate(void)
-{
- return new HttpHdrCc();
-}
-
/* creates an cc object from a 0-terminating string */
HttpHdrCc *
httpHdrCcParseCreate(const String * str)
{
- HttpHdrCc *cc = httpHdrCcCreate();
+ HttpHdrCc *cc = new HttpHdrCc();
if (!httpHdrCcParseInit(cc, str)) {
- httpHdrCcDestroy(cc);
+ delete cc;
cc = NULL;
}
HttpHdrCc *cc = hdr_in->getCc();
if (!cc)
- cc = httpHdrCcCreate();
+ cc = new HttpHdrCc();
#if 0 /* see bug 2330 */
/* Set no-cache if determined needed but not found */
reply->setHeaders(HTTP_OK, NULL, mimeGetContentType(icon), sb.st_size, sb.st_mtime, -1);
- reply->cache_control = httpHdrCcCreate();
+ reply->cache_control = new HttpHdrCc();
httpHdrCcSetMaxAge(reply->cache_control, 86400);
/* Http Cache Control Header Field */
SQUIDCEXTERN void httpHdrCcInitModule(void);
SQUIDCEXTERN void httpHdrCcCleanModule(void);
-SQUIDCEXTERN HttpHdrCc *httpHdrCcCreate(void);
SQUIDCEXTERN HttpHdrCc *httpHdrCcParseCreate(const String * str);
SQUIDCEXTERN void httpHdrCcDestroy(HttpHdrCc * cc);
SQUIDCEXTERN HttpHdrCc *httpHdrCcDup(const HttpHdrCc * cc);