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