15#define LOC QString("HTTPFile: ")
19 return std::shared_ptr<MythHTTPFile>(
new MythHTTPFile(ShortName, FullName));
49 LOG(VB_HTTP, LOG_INFO,
LOC + QString(
"Looking for '%1'").arg(
file));
53 LOG(VB_HTTP, LOG_INFO,
LOC + QString(
"Failed to find '%1'").arg(
file));
60 if (!httpfile->open(QIODevice::ReadOnly))
62 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"Failed to open '%1'").arg(
file));
68 static const std::vector<const char *> s_exts = {
".json",
".js",
".html",
".css" };
70 if (std::ranges::any_of(s_exts,
71 [&](
const char * value) {
return file.endsWith(value); }))
76 httpfile->m_lastModified = QFileInfo(
file).lastModified();
78 LOG(VB_HTTP, LOG_DEBUG,
LOC + QString(
"Last modified: %2")
83 QString mime = httpfile->m_mimeType.Name();
84 LOG(VB_HTTP, LOG_INFO,
LOC + QString(
"mimetype '%1'").arg(mime));
static HTTPFile Create(const QString &ShortName, const QString &FullName)
MythHTTPFile(const QString &ShortName, const QString &FullName)
Default constructor.
static HTTPResponse ProcessFile(const HTTPRequest2 &Request)
static HTTPResponse FileResponse(const HTTPRequest2 &Request, const HTTPFile &File)
static HTTPResponse HandleOptions(const HTTPRequest2 &Request)
static HTTPResponse ErrorResponse(MythHTTPStatus Status, const QString &ServerName)
std::shared_ptr< MythHTTPFile > HTTPFile
std::shared_ptr< MythHTTPRequest > HTTPRequest2
std::shared_ptr< MythHTTPResponse > HTTPResponse
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
@ kOverrideUTC
Present date/time in UTC.
@ kRFC822
HTTP Date format.