1 #ifndef SQUID_HTTPHEADERTOOLS_H
2 #define SQUID_HTTPHEADERTOOLS_H
4 #include "format/Format.h"
5 #include "HttpHeader.h"
18 typedef std::list
<HeaderWithAcl
> HeaderWithAclList
;
21 struct _header_mangler
{
22 acl_access
*access_list
;
25 typedef struct _header_mangler header_mangler
;
29 /// A collection of header_mangler objects for a given message kind.
36 /// returns a header mangler for field e or nil if none was specified
37 const header_mangler
*find(const HttpHeaderEntry
&e
) const;
39 /// returns a mangler for the named header (known or custom)
40 header_mangler
*track(const char *name
);
42 /// updates mangler for the named header with a replacement value
43 void setReplacement(const char *name
, const char *replacementValue
);
45 /// report the *_header_access part of the configuration
46 void dumpAccess(StoreEntry
*entry
, const char *optionName
) const;
47 /// report the *_header_replace part of the configuration
48 void dumpReplacement(StoreEntry
*entry
, const char *optionName
) const;
51 /// a name:mangler map; optimize: use unordered map or some such
52 typedef std::map
<std::string
, header_mangler
> ManglersByName
;
54 /// one mangler for each known header
55 header_mangler known
[HDR_ENUM_END
];
57 /// one mangler for each custom header
58 ManglersByName custom
;
60 /// configured if some mangling ACL applies to all header names
65 HeaderManglers(const HeaderManglers
&);
66 HeaderManglers
&operator =(const HeaderManglers
&);
73 HeaderWithAcl() : aclList(NULL
), fieldId (HDR_BAD_HDR
), quoted(false) {}
75 /// HTTP header field name
76 std::string fieldName
;
78 /// HTTP header field value, possibly with macros
79 std::string fieldValue
;
81 /// when the header field should be added (always if nil)
84 /// compiled HTTP header field value (no macros)
85 Format::Format
*valueFormat
;
87 /// internal ID for "known" headers or HDR_OTHER
88 http_hdr_type fieldId
;
90 /// whether fieldValue may contain macros
94 SQUIDCEXTERN
int httpHeaderParseOffset(const char *start
, int64_t * off
);