From 8088f8d0fbfc9832650192306b9ba568b7f2626a Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 20 Jan 2014 14:11:58 +1300 Subject: [PATCH] cachemgr: Enable per-report Content-Type header The default for all reports is plain text in UTF-8. NOTE: UTF-8 selected because although current reports limit themselves to ASCII character ranges, some reports may contain text pulled from the protocol transferred and UTF-8 display covers most unexpected cases. --- src/mgr/Action.cc | 2 +- src/mgr/Action.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mgr/Action.cc b/src/mgr/Action.cc index 4e1d2e6437..f350e5ef76 100644 --- a/src/mgr/Action.cc +++ b/src/mgr/Action.cc @@ -98,7 +98,7 @@ Mgr::Action::fillEntry(StoreEntry* entry, bool writeHttpHeader) if (writeHttpHeader) { HttpReply *rep = new HttpReply; - rep->setHeaders(Http::scOkay, NULL, "text/plain", -1, squid_curtime, squid_curtime); + rep->setHeaders(Http::scOkay, NULL, contentType(), -1, squid_curtime, squid_curtime); // Allow cachemgr and other XHR scripts access to our version string const ActionParams ¶ms = command().params; if (params.httpOrigin.size() > 0) { diff --git a/src/mgr/Action.h b/src/mgr/Action.h index fbc6ff1009..799810afcd 100644 --- a/src/mgr/Action.h +++ b/src/mgr/Action.h @@ -63,6 +63,9 @@ public: StoreEntry *createStoreEntry() const; ///< creates store entry from params + ///< Content-Type: header value for this report + virtual const char *contentType() const {return "text/plain;charset=utf-8";} + protected: /// calculate and keep local action-specific information virtual void collect() {} -- 2.39.5