HttpHeaderFieldAttrs("Other:", HDR_OTHER, ftStr) /* ':' will not allow matches */
};
+/* 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
+ * (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
+ * 6. replacing httpHeaderNameById with direct array lookups
+ * 7. being looking at the other arrays removal
+ */
+
struct HeaderTableRecord {
const char *name;
http_hdr_type id;
{"FTP-Pre", HDR_FTP_PRE, ftStr},
{"FTP-Status", HDR_FTP_STATUS, ftInt},
{"FTP-Reason", HDR_FTP_REASON, ftStr},
- {nullptr, HDR_OTHER} /* ':' will not allow matches */
+ {"Other:", HDR_OTHER, ftStr}, /* ':' will not allow matches */
+ {nullptr, HDR_BAD_HDR} /* ':' will not allow matches */
};
static HttpHeaderFieldInfo *Headers = NULL;
-LookupTable<http_hdr_type, HeaderTableRecord> headerLookupTable(HDR_OTHER, headerTable);
-std::vector<HttpHeaderFieldStat> headerStatsTable(HDR_OTHER);
+LookupTable<http_hdr_type, HeaderTableRecord> headerLookupTable(HDR_BAD_HDR, headerTable);
+std::vector<HttpHeaderFieldStat> headerStatsTable(HDR_OTHER+1);
http_hdr_type &operator++ (http_hdr_type &aHeader)
{
/* is it a "known" field? */
http_hdr_type id = httpHeaderIdByName(field_start, name_len, Headers, HDR_ENUM_END);
+ http_hdr_type id2 = headerLookupTable.lookup(SBuf(field_start,name_len));
+ debugs(55, 9, "got hdr id hdr: " << id << ", new hdr: " << id2);
+ assert(id == id2);
String name;
/// 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 {
- HDR_BAD_HDR = -1,
HDR_ACCEPT = 0, /**< RFC 7231 */
HDR_ACCEPT_CHARSET, /**< RFC 7231 */
HDR_ACCEPT_ENCODING, /**< RFC 7231 */
HDR_FTP_STATUS, /**< Internal header for FTP reply status */
HDR_FTP_REASON, /**< Internal header for FTP reply reason */
HDR_OTHER, /**< internal tag value for "unknown" headers */
- HDR_ENUM_END
+ HDR_ENUM_END,
+ HDR_BAD_HDR = -1
} http_hdr_type;
#endif /* SQUID_HTTP_REGISTEREDHEADERS_H */