]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
cachemgr: Enable per-report Content-Type header
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 20 Jan 2014 01:11:58 +0000 (14:11 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 20 Jan 2014 01:11:58 +0000 (14:11 +1300)
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
src/mgr/Action.h

index 4e1d2e643700b8f88d72fc5e049a14dec238257e..f350e5ef764d45b00d6654ab561e1e0b9f1d6c78 100644 (file)
@@ -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 &params = command().params;
         if (params.httpOrigin.size() > 0) {
index fbc6ff1009ee26cbbd1e145c342e8db3a8dafe9f..799810afcdea85c3e41f598421d162f4aeedac75 100644 (file)
@@ -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() {}