/* packs all the entries using supplied packer */
void
-HttpHeader::packInto(Packer * p) const
+HttpHeader::packInto(Packer * p, bool mask_sensitive_info) const
{
HttpHeaderPos pos = HttpHeaderInitPos;
const HttpHeaderEntry *e;
assert(p);
debugs(55, 7, "packing hdr: (" << this << ")");
/* pack all entries one by one */
- while ((e = getEntry(&pos)))
- e->packInto(p);
-
+ while ((e = getEntry(&pos))) {
+ if (!mask_sensitive_info) {
+ e->packInto(p);
+ continue;
+ }
+ switch (e->id) {
+ case HDR_AUTHORIZATION:
+ case HDR_PROXY_AUTHORIZATION:
+ packerAppend(p, e->name.rawBuf(), e->name.size());
+ packerAppend(p, ": ** NOT DISPLAYED **\r\n", 23);
+ break;
+ default:
+ e->packInto(p);
+ break;
+ }
+ }
/* Pack in the "special" entries */
/* Cache-Control */
void compact();
int reset();
int parse(const char *header_start, const char *header_end);
- void packInto(Packer * p) const;
+ void packInto(Packer * p, bool mask_sensitive_info=false) const;
HttpHeaderEntry *getEntry(HttpHeaderPos * pos) const;
HttpHeaderEntry *findEntry(http_hdr_type id) const;
int delByName(const char *name);
SQUIDSTRINGPRINT(urlpath_or_slash),
request->http_ver.major, request->http_ver.minor);
packerToMemInit(&pck, &mb);
- request->header.packInto(&pck);
+ request->header.packInto(&pck, true); //hide authorization data
packerClean(&pck);
} else if (request_hdrs) {
p = request_hdrs;