commit ce72478435edffe1a9c6bf3b65341c59749e9178
Author: Eduard Bloch <blade@debian.org>
Date:   Thu Jun 19 23:10:28 2014 +0200

    Option to have a custom message body

Index: apt-cacher-ng-0.7.11/include/job.h
===================================================================
--- apt-cacher-ng-0.7.11.orig/include/job.h
+++ apt-cacher-ng-0.7.11/include/job.h
@@ -78,7 +78,7 @@ class job {
 
       const char * BuildAndEnqueHeader(const FiStatus &fistate, const off_t &nGooddataSize, header& respHead);
       FiStatus _SwitchToPtItem(const mstring &fileLoc);
-      void SetErrorResponse(const char * errorLine, const char *szLocation=NULL);
+      void SetErrorResponse(const char * errorLine, const char *szLocation=NULL, const char *bodytext=NULL);
       void HandleLocalDownload(const mstring &visPath,
     			const mstring &fsBase, const mstring &fsSubpath);
 
Index: apt-cacher-ng-0.7.11/source/job.cc
===================================================================
--- apt-cacher-ng-0.7.11.orig/source/job.cc
+++ apt-cacher-ng-0.7.11/source/job.cc
@@ -726,7 +726,8 @@ report_overload:
     return ;
 
 report_notallowed:
-	SetErrorResponse((tSS() << "403 Forbidden file type or location: " << sRawUriPath).c_str());
+  	SetErrorResponse((tSS() << "403 Forbidden file type or location: " << sRawUriPath).c_str(),
+			NULL, "403 Forbidden file type or location");
 //    USRDBG(5, sRawUriPath + " -- ACCESS FORBIDDEN");
     return ;
 
@@ -1151,7 +1152,7 @@ FiStatus job::_SwitchToPtItem(const MYST
 }
 
 
-void job::SetErrorResponse(const char * errorLine, const char *szLocation)
+void job::SetErrorResponse(const char * errorLine, const char *szLocation, const char *bodytext)
 {
 	LOGSTART2("job::SetErrorResponse", errorLine);
 
@@ -1161,20 +1162,21 @@ void job::SetErrorResponse(const char *
 	class erroritem: public tGeneratedFitemBase
 	{
 	public:
-		erroritem(const string &sId, const char *szError) : tGeneratedFitemBase(sId, szError)
+		erroritem(const string &sId, const char *szError, const char *bodytext) 
+       : tGeneratedFitemBase(sId, szError)
 		{
 			if(BODYFREECODE(m_head.getStatus()))
 				return;
 			// otherwise do something meaningful
 			m_data << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
-				"<html><head><title>" << szError << "</title>\n</head>\n<body><h1>"
-				<< szError << "</h1></body></html>";
+				"<html><head><title>" << (bodytext ? bodytext : szError) << "</title>\n</head>\n<body><h1>"
+				<< (bodytext ? bodytext : szError) << "</h1></body></html>";
 			m_head.set(header::CONTENT_TYPE, "text/html");
 			seal();
 		}
 	};
 
-	erroritem *p = new erroritem("noid", errorLine);
+	erroritem *p = new erroritem("noid", errorLine, bodytext);
 	p->HeadRef().set(header::LOCATION, szLocation);
 	tFileItemPtr pNew(static_cast<fileitem_base*>(p));
 	m_pItem=pNew;
