47 : m_signature(Signature),
55 LOG(VB_GENERAL, LOG_DEBUG, QStringLiteral(
"Not registering '%1' as a handler").arg(
m_signature));
114 if (QFile::exists(Filename))
116 if ((QFile::permissions(Filename) & QFile::ReadOther))
118 QFileInfo fileinfo(Filename);
119 if (fileinfo.size() > 0)
121 QDateTime modified = fileinfo.lastModified();
138 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"'%1' is empty - ignoring").arg(Filename));
144 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"'%1' is not readable").arg(Filename));
150 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"Failed to find '%1'").arg(Filename));
void SetAllowed(int Allowed)
virtual QVariantMap ProcessRequest(const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated)
A class to encapsulate an incoming HTTP request.
QString Signature(void) const
static void AddAuthenticationHeader(TorcHTTPRequest &Request)
bool Unmodified(const QDateTime &LastModified)
Return true if the resource is unmodified.
HTTPAuthorisation IsAuthorised(void) const
bool GetRecursive(void) const
static void RegisterHandler(TorcHTTPHandler *Handler)
void SetCache(int Cache, const QString &Tag=QStringLiteral(""))
Set the caching behaviour for this response.
static void HandleOptions(TorcHTTPRequest &Request, int Allowed)
void SetResponseContent(const QByteArray &Content)
TorcHTTPHandler(const QString &Signature, const QString &Name)
void SetAllowGZip(bool Allowed)
Allow gzip compression for the contents of this request.
static void HandleFile(TorcHTTPRequest &Request, const QString &Filename, int Cache)
static void DeregisterHandler(TorcHTTPHandler *Handler)
void SetStatus(HTTPStatus Status)
#define LOG(_MASK_, _LEVEL_, _STRING_)
static bool MethodIsAuthorised(TorcHTTPRequest &Request, int Allowed)
Check the current request is authorised and set the authentication header if not. ...
void SetResponseFile(const QString &File)
void SetResponseType(HTTPResponseType Type)
virtual ~TorcHTTPHandler()