MythTV  master
mythhttpserver.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QDirIterator>
3 #include <QNetworkInterface>
4 #include <QCoreApplication>
5 #include <QSslKey>
6 #include <QSslCipher>
7 #include <QSslCertificate>
8 
9 // MythTV
10 #include "mythversion.h"
11 #include "mythdirs.h"
12 #include "mythcorecontext.h"
13 #include "mythlogging.h"
15 #ifdef USING_LIBDNS_SD
16 #include "bonjourregister.h"
17 #endif
18 #include "http/mythhttpsocket.h"
19 #include "http/mythhttpresponse.h"
20 #include "http/mythhttpthread.h"
21 #include "http/mythhttps.h"
22 #include "http/mythhttpserver.h"
23 
24 // Std
25 #ifndef _WIN32
26 #include <sys/utsname.h>
27 #endif
28 
29 #define LOC QString("HTTPServer: ")
30 
32 {
33  // Join the dots
35  connect(this, &MythHTTPServer::AddPaths, this, &MythHTTPServer::NewPaths);
45 
46  // Find our static content
48  while (m_config.m_rootDir.endsWith("/"))
49  m_config.m_rootDir.chop(1);
50  m_config.m_rootDir.append(QStringLiteral("/html"));
51 
52  // Add our default paths (mostly static js, css, images etc).
53  // We need to pass individual directories to the threads, so inspect the
54  // the paths we want for sub-directories
55  static const QStringList s_dirs = { "/assets/", "/3rdParty/", "/css/", "/images/", "/js/", "/misc/", "/apps/", "/xslt/" };
56  m_config.m_filePaths.clear();
57  QStringList dirs;
58  for (const auto & dir : s_dirs)
59  {
60  dirs.append(dir);
61  QDirIterator it(m_config.m_rootDir + dir, QDir::Dirs | QDir::Readable | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
62  while (it.hasNext())
63  dirs.append(it.next().remove(m_config.m_rootDir) + "/");
64  }
65 
66  // And finally the root handler
67  dirs.append("/");
68  NewPaths(dirs);
69 }
70 
72 {
73  Stopped();
74 }
75 
77 {
78  if (Enable && !isListening())
79  {
80  Init();
81  bool tcp = m_config.m_port != 0;
82  bool ssl = m_config.m_sslPort != 0;
83 
84  if (tcp)
85  {
86  tcp = listen(m_config.m_port);
87  // ServerPool as written will overwrite the port setting if we listen
88  // on an additional port (i.e. SSL). So check which port is in use before
89  // continuing
90  if (m_config.m_port != serverPort())
91  {
92  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Server is using port %1 - expected %2")
93  .arg(serverPort()).arg(m_config.m_port));
95  }
96  if (m_config.m_port_2)
98  }
99 
100  if (ssl)
101  {
102  ssl = listen(m_config.m_sslPort, true, kSSLServer);
103  if (m_config.m_sslPort != serverPort())
104  {
105  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Server is using port %1 - expected %2")
106  .arg(serverPort()).arg(m_config.m_sslPort));
108  }
109  }
110 
111  Started(tcp, ssl);
112  }
113  else if (!Enable && isListening())
114  {
115  close();
116  Stopped();
117  }
118 }
119 
126 {
127  // Just in case we get in a mess
128  Stopped();
129 
130  // Decide on the ports to use
131  if (gCoreContext->IsFrontend())
132  {
133  m_config.m_port = XmlConfiguration().GetValue("UPnP/MythFrontend/ServicePort", 6547);
134  // I don't think there is an existing setting for this
135  m_config.m_sslPort = static_cast<uint16_t>(gCoreContext->GetNumSetting("FrontendSSLPort", m_config.m_port + 10));
136 
137  }
138  else if (gCoreContext->IsBackend())
139  {
141  // Additional port, may be removed later
143  m_config.m_sslPort = static_cast<uint16_t>(gCoreContext->GetNumSetting("BackendSSLPort", m_config.m_port + 10));
144  }
145  else
146  {
147  // N.B. This assumes only the frontend and backend use HTTP...
148  m_config.m_port = 0;
149  m_config.m_sslPort = 0;
150  }
151 
152  // If this fails, unset the SSL port
153 #ifndef QT_NO_OPENSSL
155 #endif
156  {
157  m_config.m_sslPort = 0;
158  }
159 
160  if (m_config.m_sslPort == 0)
161  LOG(VB_HTTP, LOG_INFO, LOC + "SSL is disabled");
162 
163  // Set the server ident
164  QString version = GetMythSourceVersion();
165  if (version.startsWith("v"))
166  version = version.right(version.length() - 1);
167 
168 #ifdef _WIN32
169  QString server = QStringLiteral("Windows");
170 #else
171  struct utsname uname_info {};
172  uname(&uname_info);
173  QString server = QStringLiteral("%1/%2").arg(uname_info.sysname, uname_info.release);
174 #endif
175  m_config.m_serverName = QString("MythTV/%1 %2 UPnP/1.0").arg(version, server);
176 
177  // Retrieve language
178  m_config.m_language = gCoreContext->GetLanguageAndVariant().replace("_", "-");
179 
180  // Get master backend details for Origin checks
184 
185  // Get keep alive timeout
186  auto timeout = gCoreContext->GetNumSetting("HTTP/KeepAliveTimeoutSecs", HTTP_SOCKET_TIMEOUT_MS / 1000);
187  m_config.m_timeout = static_cast<std::chrono::milliseconds>(timeout * 1000);
188 }
189 
190 void MythHTTPServer::Started([[maybe_unused]] bool Tcp,
191  [[maybe_unused]] bool Ssl)
192 {
193 #ifdef USING_LIBDNS_SD
194  // Advertise our webserver
195  delete m_bonjour;
196  delete m_bonjourSSL;
197  m_bonjour = nullptr;
198  m_bonjourSSL = nullptr;
199  if (!(Tcp || Ssl))
200  return;
201 
202  auto host = QHostInfo::localHostName();
203  if (host.isEmpty())
204  host = tr("Unknown");
205 
206  if (Tcp)
207  {
208  m_bonjour = new BonjourRegister();
209  m_bonjour->Register(m_config.m_port, QByteArrayLiteral("_http._tcp"),
210  QStringLiteral("%1 on %2").arg(QCoreApplication::applicationName(), host).toLatin1().constData(), {});
211  }
212 
213  if (Ssl)
214  {
215  m_bonjourSSL = new BonjourRegister();
216  m_bonjourSSL->Register(m_config.m_sslPort, QByteArrayLiteral("_https._tcp"),
217  QStringLiteral("%1 on %2").arg(QCoreApplication::applicationName(), host).toLatin1().constData(), {});
218  }
219 #endif
220 
221  // Build our list of hosts and allowed origins.
222  BuildHosts();
223  BuildOrigins();
224 }
225 
227 {
228  // Clear allowed origins
229  m_config.m_hosts.clear();
230  m_config.m_allowedOrigins.clear();
231 
232 #ifdef USING_LIBDNS_SD
233  // Stop advertising
234  delete m_bonjour;
235  delete m_bonjourSSL;
236  m_bonjour = nullptr;
237  m_bonjourSSL = nullptr;
238 #endif
239 }
240 
242 {
243  if (!m_connectionQueue.empty())
244  {
245  emit ProcessTCPQueue();
246  }
247 }
248 
250 {
251  if (AvailableThreads() > 0)
252  {
253  auto Socket = m_connectionQueue.dequeue();
254  auto * server = qobject_cast<PrivTcpServer*>(QObject::sender());
255  auto ssl = server ? server->GetServerType() == kSSLServer : false;
257  auto name = QString("HTTP%1%2").arg(ssl ? "S" : "").arg(m_threadNum++);
258  auto * newthread = new MythHTTPThread(this, m_config, name, Socket, ssl);
259  AddThread(newthread);
260  connect(newthread->qthread(), &QThread::finished, this, &MythHTTPThreadPool::ThreadFinished);
261  connect(newthread->qthread(), &QThread::finished, this, &MythHTTPServer::ThreadFinished);
262  newthread->start();
263  return;
264  }
265 }
266 
268 {
269  if (!Socket)
270  return;
271 
272  m_connectionQueue.enqueue(Socket);
273  emit ProcessTCPQueue();
274 }
275 
276 bool MythHTTPServer::ReservedPath(const QString& Path)
277 {
278  static const QStringList s_reservedPaths { HTTP_SERVICES_DIR };
279  if (s_reservedPaths.contains(Path, Qt::CaseInsensitive))
280  {
281  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Server path '%1' is reserved - ignoring").arg(Path));
282  return true;
283  }
284  return false;
285 }
286 
308 void MythHTTPServer::NewPaths(const QStringList &Paths)
309 {
310  if (Paths.isEmpty())
311  return;
312  for (const auto & path : std::as_const(Paths))
313  {
314  if (ReservedPath(path))
315  continue;
316  if (m_config.m_filePaths.contains(path))
317  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("'%1' is already registered").arg(path));
318  else
319  LOG(VB_HTTP, LOG_INFO, LOC + QString("Adding path: '%1'").arg(path));
320  m_config.m_filePaths.append(path);
321  }
323 }
324 
325 void MythHTTPServer::StalePaths(const QStringList& Paths)
326 {
327  if (Paths.isEmpty())
328  return;
329  for (const auto & path : std::as_const(Paths))
330  {
331  if (m_config.m_filePaths.contains(path))
332  {
333  LOG(VB_HTTP, LOG_INFO, LOC + QString("Removing path: '%1'").arg(path));
334  m_config.m_filePaths.removeOne(path);
335  }
336  }
338 }
339 
362 {
363  bool newhandlers = false;
364  for (const auto & handler : std::as_const(Handlers))
365  {
366  if (ReservedPath(handler.first))
367  continue;
368  if (!std::any_of(m_config.m_handlers.cbegin(), m_config.m_handlers.cend(),
369  [&handler](const HTTPHandler& Handler) { return Handler.first == handler.first; }))
370  {
371  LOG(VB_HTTP, LOG_INFO, LOC + QString("Adding handler for '%1'").arg(handler.first));
372  m_config.m_handlers.push_back(handler);
373  newhandlers = true;
374  }
375  else
376  {
377  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Handler '%1' already registered - ignoring")
378  .arg(handler.first));
379  }
380  }
381  if (newhandlers)
383 }
384 
386 {
387  bool stalehandlers = false;
388  for (const auto & handler : std::as_const(Handlers))
389  {
390  auto found = std::find_if(m_config.m_handlers.begin(), m_config.m_handlers.end(),
391  [&handler](const HTTPHandler& Handler) { return Handler.first == handler.first; });
392  if (found != m_config.m_handlers.end())
393  {
394  m_config.m_handlers.erase(found);
395  stalehandlers = true;
396  }
397  }
398  if (stalehandlers)
400 }
401 
403 {
404  bool newservices = false;
405  for (const auto & service : std::as_const(Services))
406  {
407  if (ReservedPath(service.first))
408  continue;
409  if (!std::any_of(m_config.m_services.cbegin(), m_config.m_services.cend(),
410  [&service](const HTTPService& Service) { return Service.first == service.first; }))
411  {
412  LOG(VB_HTTP, LOG_INFO, LOC + QString("Adding service for '%1'").arg(service.first));
413  m_config.m_services.push_back(service);
414  newservices = true;
415  }
416  else
417  {
418  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Service '%1' already registered - ignoring")
419  .arg(service.first));
420  }
421  }
422  if (newservices)
424 }
425 
427 {
428  bool staleservices = false;
429  for (const auto & service : std::as_const(Services))
430  {
431  auto found = std::find_if(m_config.m_services.begin(), m_config.m_services.end(),
432  [&service](const HTTPService& Service) { return Service.first == service.first; });
433  if (found != m_config.m_services.end())
434  {
435  m_config.m_services.erase(found);
436  staleservices = true;
437  }
438  }
439  if (staleservices)
441 }
442 
451 {
452  LOG(VB_HTTP, LOG_INFO, LOC + QString("Adding error page handler"));
453  m_config.m_errorPageHandler = Handler;
455 }
456 
458 {
459  m_config.m_hosts.clear();
460 
461  // Iterate over the addresses ServerPool was asked to listen on. This should
462  // pick up all variations of localhost and external IP etc
463  QStringList lookups;
464  auto defaults = DefaultListen();
465  bool allipv4 = false;
466  bool allipv6 = false;
467  for (const auto & address : std::as_const(defaults))
468  {
469  if (address == QHostAddress::AnyIPv4)
470  allipv4 |= true;
471  else if (address == QHostAddress::AnyIPv6)
472  allipv6 |= true;
473  else
474  lookups.append(address.toString());
475  }
476 
477  // 'Any address' (0.0.0.0) is in use. Retrieve the complete list of avaible
478  // addresses and filter as required.
479  if (allipv4 || allipv6)
480  {
481  auto addresses = QNetworkInterface::allAddresses();
482  for (const auto & address : std::as_const(addresses))
483  {
484  if ((allipv4 && address.protocol() == QAbstractSocket::IPv4Protocol) ||
485  (allipv6 && address.protocol() == QAbstractSocket::IPv6Protocol))
486  {
487  lookups.append(address.toString());
488  }
489  }
490  }
491 
492  lookups.removeDuplicates();
493 
494  // Trigger reverse lookups
495  for (const auto & address : lookups)
496  {
497  m_hostLookups++;
498  QHostInfo::lookupHost(address, this, &MythHTTPServer::HostResolved);
499  }
500 }
501 
514 {
515  m_config.m_allowedOrigins.clear();
516 
517  // Add master backend. We need to resolve this separately to handle both status
518  // and SSL ports
519  m_originLookups++;
520  QHostInfo::lookupHost(m_masterIPAddress, this, &MythHTTPServer::MasterResolved);
521 
522  // Add configured overrides - are these still needed?
523  QStringList extras = gCoreContext->GetSetting("AllowedOriginsList", QString(
524  "https://chromecast.mythtv.org"
525  )).split(",");
526  for (const auto & extra : std::as_const(extras))
527  {
528  QString clean = extra.trimmed();
529  if (clean.startsWith("http://") || clean.startsWith("https://"))
530  m_config.m_allowedOrigins.append(clean);
531  }
532 }
533 
534 QStringList MythHTTPServer::BuildAddressList(QHostInfo& Info)
535 {
536  bool addhostname = true;
537  QString hostname = Info.hostName();
538  QStringList results;
539  auto ipaddresses = Info.addresses();
540  for(auto & address : ipaddresses)
541  {
542  QString result = MythHTTP::AddressToString(address);
543  // This filters out IPv6 addresses that are passed back as host names
544  if (result.contains(hostname))
545  addhostname = false;
546  results.append(result.toLower());
547  }
548  if (addhostname)
549  results.append(hostname.toLower());
550  return results;
551 }
552 
558 void MythHTTPServer::ResolveMaster(QHostInfo Info)
559 {
560  auto addresses = BuildAddressList(Info);
561 
562  // Add status and SSL addressed for each
563  for (const auto & address : std::as_const(addresses))
564  {
565  m_config.m_allowedOrigins.append(QString("http://%1").arg(address));
566  m_config.m_allowedOrigins.append(QString("http://%1:%2").arg(address).arg(m_masterStatusPort));
567  if (m_masterSSLPort != 0)
568  {
569  m_config.m_allowedOrigins.append(QString("https://%1").arg(address));
570  m_config.m_allowedOrigins.append(QString("https://%1:%2").arg(address).arg(m_masterSSLPort));
571  }
572  }
573  m_config.m_allowedOrigins.removeDuplicates();
574  if (--m_originLookups == 0)
575  DebugOrigins();
577 }
578 
580 {
581  if (VERBOSE_LEVEL_CHECK(VB_HTTP, LOG_INFO))
582  {
583  LOG(VB_GENERAL, LOG_INFO, LOC +
584  QString("Name resolution complete: %1 'Origins' found").arg(m_config.m_allowedOrigins.size()));
585  for (const auto & address : std::as_const(m_config.m_allowedOrigins))
586  LOG(VB_GENERAL, LOG_INFO, LOC + QString("Allowed origin: %1").arg(address));
587  }
588 }
589 
592 void MythHTTPServer::ResolveHost(QHostInfo Info)
593 {
594  auto addresses = BuildAddressList(Info);
595  for (const auto & address : std::as_const(addresses))
596  {
597  // The port is optional - so just add both to our list to simplify the
598  // checks when a request is received
599  m_config.m_hosts.append(QString("%1").arg(address));
600  if (m_config.m_port != 0)
601  m_config.m_hosts.append(QString("%1:%2").arg(address).arg(m_config.m_port));
602  if (m_config.m_sslPort != 0)
603  m_config.m_hosts.append(QString("%1:%2").arg(address).arg(m_config.m_sslPort));
604  }
605  m_config.m_hosts.removeDuplicates();
606  if (--m_hostLookups == 0)
607  DebugHosts();
609 }
610 
612 {
613  if (VERBOSE_LEVEL_CHECK(VB_HTTP, LOG_INFO))
614  {
615  LOG(VB_GENERAL, LOG_INFO, LOC +
616  QString("Name resolution complete: %1 'Hosts' found").arg(m_config.m_hosts.size()));
617  for (const auto & address : std::as_const(m_config.m_hosts))
618  LOG(VB_GENERAL, LOG_INFO, LOC + QString("Host: %1").arg(address));
619  }
620 }
MythHTTPServer::ProcessTCPQueue
void ProcessTCPQueue()
MythHTTPServer::~MythHTTPServer
~MythHTTPServer() override
Definition: mythhttpserver.cpp:71
MythHTTPServer::StaleServices
void StaleServices(const HTTPServices &Services)
Definition: mythhttpserver.cpp:426
MythHTTPServer::HostsChanged
void HostsChanged(const QStringList &Hosts)
MythHTTPServer::BuildHosts
void BuildHosts()
Definition: mythhttpserver.cpp:457
kSSLServer
@ kSSLServer
Definition: serverpool.h:33
hardwareprofile.smolt.timeout
float timeout
Definition: smolt.py:102
MythHTTPConfig::m_allowedOrigins
QStringList m_allowedOrigins
Definition: mythhttptypes.h:71
LOC
#define LOC
Definition: mythhttpserver.cpp:29
MythHTTPConfig::m_timeout
std::chrono::milliseconds m_timeout
Definition: mythhttptypes.h:68
MythHTTPServer::newTcpConnection
void newTcpConnection(qintptr socket) override
Definition: mythhttpserver.cpp:267
ServerPool::close
void close(void)
Definition: serverpool.cpp:370
MythHTTPServer::m_originLookups
int m_originLookups
Definition: mythhttpserver.h:77
MythHTTPS::InitSSLServer
static bool InitSSLServer(QSslConfiguration &Config)
Definition: mythhttps.cpp:13
mythhttpthread.h
ServerPool::isListening
bool isListening(void) const
Definition: serverpool.h:92
MythCoreContext::GetBackendStatusPort
int GetBackendStatusPort(void)
Returns the locally defined backend status port.
Definition: mythcorecontext.cpp:1092
MythHTTPConfig::m_sslPort
quint16 m_sslPort
Definition: mythhttptypes.h:65
MythHTTPServer::EnableHTTP
void EnableHTTP(bool Enable)
GetMythSourceVersion
const char * GetMythSourceVersion()
Definition: mythversion.cpp:5
mythhttps.h
VERBOSE_LEVEL_CHECK
static bool VERBOSE_LEVEL_CHECK(uint64_t mask, LogLevel_t level)
Definition: mythlogging.h:29
MythHTTPConfig::m_language
QString m_language
Definition: mythhttptypes.h:69
MythHTTPConfig::m_errorPageHandler
HTTPHandler m_errorPageHandler
Definition: mythhttptypes.h:75
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
BonjourRegister
Definition: bonjourregister.h:11
MythHTTPServer::ReservedPath
static bool ReservedPath(const QString &Path)
Definition: mythhttpserver.cpp:276
MythHTTPServer::RemovePaths
void RemovePaths(const QStringList &Paths)
MythHTTPServer::AddErrorPageHandler
void AddErrorPageHandler(const HTTPHandler &Handler)
mythhttpsocket.h
MythHTTPThreadPool::AvailableThreads
size_t AvailableThreads() const
Definition: mythhttpthreadpool.cpp:29
mythdirs.h
MythHTTPConfig::m_sslConfig
QSslConfiguration m_sslConfig
Definition: mythhttptypes.h:77
MythHTTPServer::m_masterIPAddress
QString m_masterIPAddress
Definition: mythhttpserver.h:82
MythCoreContext::GetMasterServerStatusPort
int GetMasterServerStatusPort(void)
Returns the Master Backend status port If no master server status port has been defined in the databa...
Definition: mythcorecontext.cpp:993
MythHTTPServer::AddHandlers
void AddHandlers(const HTTPHandlers &Handlers)
XmlConfiguration
Definition: configuration.h:38
MythHTTPServer::NewHandlers
void NewHandlers(const HTTPHandlers &Handlers)
Add new handlers.
Definition: mythhttpserver.cpp:361
MythHTTPServer::AddPaths
void AddPaths(const QStringList &Paths)
MythHTTPServer::ServicesChanged
void ServicesChanged(const HTTPServices &Services)
MythHTTPServer::m_threadNum
int m_threadNum
Definition: mythhttpserver.h:84
hardwareprofile.os_detect.results
results
Definition: os_detect.py:295
MythHTTPServer::ResolveMaster
void ResolveMaster(QHostInfo Info)
Add master backend addresses to the allowed Origins list.
Definition: mythhttpserver.cpp:558
MythHTTPServer::m_masterSSLPort
int m_masterSSLPort
Definition: mythhttpserver.h:81
MythHTTPServer::NewServices
void NewServices(const HTTPServices &Services)
Definition: mythhttpserver.cpp:402
MythHTTPServer::ResolveHost
void ResolveHost(QHostInfo Info)
Add the results of a reverse lookup to our allowed list.
Definition: mythhttpserver.cpp:592
mythlogging.h
MythHTTPServer::ProcessTCPQueueHandler
void ProcessTCPQueueHandler()
Definition: mythhttpserver.cpp:249
MythHTTPServer::DebugHosts
void DebugHosts()
Definition: mythhttpserver.cpp:611
MythHTTPServer::StalePaths
void StalePaths(const QStringList &Paths)
Definition: mythhttpserver.cpp:325
MythHTTPThreadPool::MaxThreads
size_t MaxThreads() const
Definition: mythhttpthreadpool.cpp:36
MythHTTPServer::Started
void Started(bool Tcp, bool Ssl)
Definition: mythhttpserver.cpp:190
Service
Definition: service.h:42
MythCoreContext::GetMasterServerIP
QString GetMasterServerIP(void)
Returns the Master Backend IP address If the address is an IPv6 address, the scope Id is removed.
Definition: mythcorecontext.cpp:966
MythHTTPConfig::m_filePaths
QStringList m_filePaths
Definition: mythhttptypes.h:72
MythHTTPServer::Stopped
void Stopped()
Definition: mythhttpserver.cpp:226
MythHTTPServer::HostResolved
void HostResolved(QHostInfo Info)
MythHTTPConfig::m_port
quint16 m_port
Definition: mythhttptypes.h:63
bonjourregister.h
GetShareDir
QString GetShareDir(void)
Definition: mythdirs.cpp:254
MythCoreContext::IsFrontend
bool IsFrontend(void) const
is this process a frontend process
Definition: mythcorecontext.cpp:654
MythHTTPConfig::m_handlers
HTTPHandlers m_handlers
Definition: mythhttptypes.h:73
ServerPool::DefaultListen
static QList< QHostAddress > DefaultListen(void)
Definition: serverpool.cpp:301
mythhttpresponse.h
MythHTTP::AddressToString
static QString AddressToString(QHostAddress &Address)
Definition: mythhttptypes.h:332
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
MythHTTPServer::m_connectionQueue
QQueue< qintptr > m_connectionQueue
Definition: mythhttpserver.h:83
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:912
MythHTTPServer::MasterResolved
void MasterResolved(QHostInfo Info)
MythHTTPThread
Definition: mythhttpthread.h:12
MythHTTPServer::MythHTTPServer
MythHTTPServer()
Definition: mythhttpserver.cpp:31
MythHTTPServer::BuildAddressList
static QStringList BuildAddressList(QHostInfo &Info)
Definition: mythhttpserver.cpp:534
MythHTTPThreadPool::ThreadFinished
void ThreadFinished()
Definition: mythhttpthreadpool.cpp:52
MythHTTPServer::HandlersChanged
void HandlersChanged(const HTTPHandlers &Handlers)
HTTP_SOCKET_TIMEOUT_MS
#define HTTP_SOCKET_TIMEOUT_MS
Definition: mythhttptypes.h:24
mythhttpserver.h
MythHTTPServer::NewErrorPageHandler
void NewErrorPageHandler(const HTTPHandler &Handler)
Add new error page handler.
Definition: mythhttpserver.cpp:450
MythHTTPConfig::m_rootDir
QString m_rootDir
Definition: mythhttptypes.h:66
XmlConfiguration::GetValue
QString GetValue(const QString &setting)
Definition: configuration.cpp:185
HTTP_SERVICES_DIR
#define HTTP_SERVICES_DIR
Definition: mythhttptypes.h:25
MythHTTPServer::m_config
MythHTTPConfig m_config
Definition: mythhttpserver.h:79
mythcorecontext.h
MythCoreContext::IsBackend
bool IsBackend(void) const
is this process a backend process
Definition: mythcorecontext.cpp:644
MythHTTPServer::RemoveHandlers
void RemoveHandlers(const HTTPHandlers &Handlers)
MythHTTPConfig::m_hosts
QStringList m_hosts
Definition: mythhttptypes.h:70
MythHTTPServer::StaleHandlers
void StaleHandlers(const HTTPHandlers &Handlers)
Definition: mythhttpserver.cpp:385
MythCoreContext::GetLanguageAndVariant
QString GetLanguageAndVariant(void)
Returns the user-set language and variant.
Definition: mythcorecontext.cpp:1779
MythHTTPServer::ErrorHandlerChanged
void ErrorHandlerChanged(const HTTPHandler &Handler)
configuration.h
MythHTTPThreadPool::AddThread
void AddThread(MythHTTPThread *Thread)
Definition: mythhttpthreadpool.cpp:46
MythHTTPConfig::m_services
HTTPServices m_services
Definition: mythhttptypes.h:74
MythHTTPServer::EnableDisable
void EnableDisable(bool Enable)
Definition: mythhttpserver.cpp:76
MythHTTPServer::NewPaths
void NewPaths(const QStringList &Paths)
Add new paths that will serve simple files.
Definition: mythhttpserver.cpp:308
MythHTTPConfig::m_port_2
quint16 m_port_2
Definition: mythhttptypes.h:64
ServerPool::listen
bool listen(QList< QHostAddress > addrs, quint16 port, bool requireall=true, PoolServerType type=kTCPServer)
Definition: serverpool.cpp:391
uint16_t
unsigned short uint16_t
Definition: iso6937tables.h:3
MythHTTPServer::m_masterStatusPort
int m_masterStatusPort
Definition: mythhttpserver.h:80
MythHTTPServer::AddServices
void AddServices(const HTTPServices &Services)
HTTPServices
std::vector< HTTPService > HTTPServices
Definition: mythhttptypes.h:54
MythHTTPServer::RemoveServices
void RemoveServices(const HTTPServices &Services)
ServerPool::serverPort
quint16 serverPort(void) const
Definition: serverpool.h:95
MythHTTPServer::PathsChanged
void PathsChanged(const QStringList &Paths)
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
MythHTTPServer::DebugOrigins
void DebugOrigins()
Definition: mythhttpserver.cpp:579
HTTPHandler
std::pair< QString, HTTPFunction > HTTPHandler
Definition: mythhttptypes.h:46
MythHTTPServer::m_hostLookups
int m_hostLookups
Definition: mythhttpserver.h:78
nv_python_libs.bbciplayer.bbciplayer_api.version
string version
Definition: bbciplayer_api.py:77
MythHTTPServer::ThreadFinished
void ThreadFinished()
Definition: mythhttpserver.cpp:241
MythHTTPServer::OriginsChanged
void OriginsChanged(const QStringList &Origins)
MythHTTPServer::BuildOrigins
void BuildOrigins()
Generate a list of allowed 'Origins' for validating CORS requests.
Definition: mythhttpserver.cpp:513
HTTPService
std::pair< QString, HTTPServiceCtor > HTTPService
Definition: mythhttptypes.h:53
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:898
HTTPHandlers
std::vector< HTTPHandler > HTTPHandlers
Definition: mythhttptypes.h:47
MythHTTPServer::Init
void Init()
Initialise server configuration.
Definition: mythhttpserver.cpp:125
MythHTTPConfig::m_serverName
QString m_serverName
Definition: mythhttptypes.h:67