Torc
0.1
|
An HTTP server. More...
#include <torchttpserver.h>
Classes | |
class | Status |
Public Slots | |
void | NewConnection (qintptr SocketDescriptor) |
Signals | |
void | HandlersChanged (void) |
Public Member Functions | |
virtual | ~TorcHTTPServer () |
Static Public Member Functions | |
static QString | ServerDescription (void) |
static Status | GetStatus (void) |
static void | Authorise (const QString &Host, TorcHTTPRequest &Request, bool ForceCheck) |
Ensures remote user is authorised to access this request. More... | |
static void | AuthenticateUser (TorcHTTPRequest &Request) |
static void | AddAuthenticationHeader (TorcHTTPRequest &Request) |
static void | ValidateOrigin (TorcHTTPRequest &Request) |
Check the Origin header for validity and respond appropriately. More... | |
static void | RegisterHandler (TorcHTTPHandler *Handler) |
static void | DeregisterHandler (TorcHTTPHandler *Handler) |
static void | HandleRequest (const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) |
static QVariantMap | HandleRequest (const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) |
Process an incoming RPC request. More... | |
static QVariantMap | GetServiceHandlers (void) |
static QVariantMap | GetServiceDescription (const QString &Service) |
static TorcWebSocketThread * | TakeSocket (TorcWebSocketThread *Socket) |
static QString | PlatformName (void) |
Protected Slots | |
void | PortChanged (int Port) |
void | SecureChanged (bool Secure) |
void | UPnPChanged (bool UPnP) |
void | UPnPSearchChanged (bool Search) |
void | UPnPAdvertChanged (bool Advert) |
void | BonjourChanged (bool Bonjour) |
void | BonjourSearchChanged (bool Search) |
void | BonjourAdvertChanged (bool Advert) |
void | IPv6Changed (bool IPv6) |
void | Restart (void) |
Protected Member Functions | |
TorcHTTPServer () | |
bool | event (QEvent *Event) overridefinal |
bool | Open (void) |
void | Close (void) |
TorcWebSocketThread * | TakeSocketPriv (TorcWebSocketThread *Socket) |
Static Protected Attributes | |
static TorcHTTPServer * | gWebServer = nullptr |
static Status | gWebServerStatus = TorcHTTPServer::Status() |
static QMutex | gWebServerLock |
static QString | gPlatform = QStringLiteral("") |
static QString | gOriginWhitelist = QStringLiteral("") |
static QReadWriteLock | gOriginWhitelistLock |
Friends | |
class | TorcHTTPServerObject |
An HTTP server.
TorcHTTPServer listens for incoming TCP connections. The default port is 4840 though any available port may be used if the default is unavailable. New connections are passed to TorcWebSocketPool.
Register new content handlers with RegisterHandler and remove them with DeregisterHandler. These can then be used with the static HandleRequest methods.
Definition at line 25 of file torchttpserver.h.
|
virtual |
Definition at line 399 of file torchttpserver.cpp.
|
protected |
Definition at line 273 of file torchttpserver.cpp.
|
static |
Definition at line 546 of file torchttpserver.cpp.
|
static |
Definition at line 588 of file torchttpserver.cpp.
|
static |
Ensures remote user is authorised to access this request.
The 'Authorization' header is used for standard HTTP requests.
Authentication credentials supplied via the url are used for WebSocket upgrade requests - and it is assumed the if the initial request is authenticated, the entire socket is then authenticated for that user.
Definition at line 495 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 729 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 719 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 738 of file torchttpserver.cpp.
|
protected |
Definition at line 811 of file torchttpserver.cpp.
|
static |
Definition at line 98 of file torchttpserver.cpp.
|
finaloverrideprotected |
Definition at line 932 of file torchttpserver.cpp.
|
static |
Definition at line 221 of file torchttpserver.cpp.
|
static |
Definition at line 200 of file torchttpserver.cpp.
|
static |
Definition at line 239 of file torchttpserver.cpp.
|
static |
Definition at line 127 of file torchttpserver.cpp.
|
static |
Process an incoming RPC request.
Remote procedure calls are only allowed for 'service' directories and will be ignored for anything else (e.g. attempts to retrieve static content and other files).
Definition at line 172 of file torchttpserver.cpp.
|
signal |
|
protectedslot |
Definition at line 747 of file torchttpserver.cpp.
|
slot |
Definition at line 969 of file torchttpserver.cpp.
|
protected |
Definition at line 758 of file torchttpserver.cpp.
|
static |
Definition at line 246 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 828 of file torchttpserver.cpp.
|
static |
Definition at line 66 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 926 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 839 of file torchttpserver.cpp.
|
static |
Definition at line 803 of file torchttpserver.cpp.
|
static |
Definition at line 480 of file torchttpserver.cpp.
|
protected |
Definition at line 964 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 894 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 884 of file torchttpserver.cpp.
|
protectedslot |
Definition at line 910 of file torchttpserver.cpp.
|
static |
Check the Origin header for validity and respond appropriately.
Cross domain requests are not common from well behaved clients/browsers. There can however be confusion when the IP address is a localhost (IPv4 or IPv6) and we can never guarantee that the domain will 'look' equivalent. So validate the incoming origin (which is good practice anyway) and set the outgoing headers as necessary. Override CORS behaviour using TorcHTTPRequest::SetAllowCors (e.g. MPEG-DASH players)
Definition at line 569 of file torchttpserver.cpp.
|
friend |
Definition at line 29 of file torchttpserver.h.
|
staticprotected |
Definition at line 93 of file torchttpserver.h.
|
staticprotected |
Definition at line 94 of file torchttpserver.h.
|
staticprotected |
Definition at line 92 of file torchttpserver.h.
|
staticprotected |
Definition at line 89 of file torchttpserver.h.
|
staticprotected |
Definition at line 91 of file torchttpserver.h.
|
staticprotected |
Definition at line 90 of file torchttpserver.h.