]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Comment out dead code, start using LookupTable for HttpHeader lookups.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 31 Jul 2015 10:28:59 +0000 (12:28 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 31 Jul 2015 10:28:59 +0000 (12:28 +0200)
src/HttpHeader.cc
src/HttpHeaderTools.h
src/acl/HttpHeaderData.cc

index d587ccdb0b54e6bfff38f070169f9c35eba63a2b..b1267ae1d38d0b9db08aaf2bf9ada5e2b7774bc1 100644 (file)
@@ -162,7 +162,7 @@ static const HttpHeaderFieldAttrs HeadersAttrs[] = {
 /* TODO:
  * DONE 1. shift HDR_BAD_HDR to end of enum
  * 2. shift headers data array to http/RegistredHeaders.cc
- * 3. creatign LookupTable object from teh enum and array
+ * DONE 3. creatign LookupTable object from teh enum and array
  * (with HDR_BAD_HDR as invalid value)
  * 4. replacing httpHeaderIdByName() uses with the lookup table
  * 5. merge HDR_BAD_HDR and HDR_ENUM_END into one thing
@@ -1966,20 +1966,31 @@ httpHeaderIdByName(const char *name, size_t name_len, const HttpHeaderFieldInfo
     return HDR_BAD_HDR;
 }
 
+http_hdr_type
+httpHeaderIdByNameDef(const SBuf &name)
+{
+    return headerLookupTable.lookup(name);
+}
+
 http_hdr_type
 httpHeaderIdByNameDef(const char *name, int name_len)
 {
+    return headerLookupTable.lookup(SBuf(name,name_len));
+#if 0
     if (!Headers)
         Headers = httpHeaderBuildFieldsInfo(HeadersAttrs, HDR_ENUM_END);
 
     return httpHeaderIdByName(name, name_len, Headers, HDR_ENUM_END);
+#endif
 }
 
 const char *
 httpHeaderNameById(int id)
 {
+#if 0
     if (!Headers)
         Headers = httpHeaderBuildFieldsInfo(HeadersAttrs, HDR_ENUM_END);
+#endif
 
     assert(id >= 0 && id < HDR_ENUM_END);
 
index 822d93f66d3825d874b60608914e9211b8373863..1550d0fdcbaf7bfb262f945314b12792559c03f9 100644 (file)
@@ -118,6 +118,7 @@ int httpHeaderParseOffset(const char *start, int64_t * off);
 HttpHeaderFieldInfo *httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs * attrs, int count);
 void httpHeaderDestroyFieldsInfo(HttpHeaderFieldInfo * info, int count);
 http_hdr_type httpHeaderIdByName(const char *name, size_t name_len, const HttpHeaderFieldInfo * attrs, int end);
+http_hdr_type httpHeaderIdByNameDef(const SBuf &name);
 http_hdr_type httpHeaderIdByNameDef(const char *name, int name_len);
 const char *httpHeaderNameById(int id);
 int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive);
index 7b27e3f6fa2517a2bd0f86c0bbc06aa3392f116f..ff8cb14b59eafe133c29e4678acb3ad24657ae0c 100644 (file)
@@ -76,7 +76,7 @@ ACLHTTPHeaderData::parse()
     char* t = ConfigParser::strtokFile();
     assert (t != NULL);
     hdrName = t;
-    hdrId = httpHeaderIdByNameDef(hdrName.rawBuf(), hdrName.size());
+    hdrId = httpHeaderIdByNameDef(SBuf(hdrName));
     regex_rule->parse();
 }