MythTV
master
|
#include <mythhttpsocket.h>
Public Slots | |
void | PathsChanged (const QStringList &Paths) |
Update our list of recognised file paths. More... | |
void | HandlersChanged (const HTTPHandlers &Handlers) |
void | ServicesChanged (const HTTPServices &Services) |
void | HostsChanged (const QStringList &Hosts) |
void | OriginsChanged (const QStringList &Origins) |
Update the list of allowed Origins. More... | |
void | NewTextMessage (const StringPayload &Text) |
void | NewRawTextMessage (const DataPayloads &Payloads) |
static void | NewBinaryMessage (const DataPayloads &Payloads) |
Signals | |
void | Finish () |
void | UpdateServices (const HTTPServices &Services) |
void | ThreadUpgraded (QThread *Thread) |
Public Member Functions | |
MythHTTPSocket (qintptr Socket, bool SSL, MythHTTPConfig Config) | |
~MythHTTPSocket () override | |
void | Respond (const HTTPResponse &Response) |
Send response to client. More... | |
Static Public Member Functions | |
static void | RespondDirect (qintptr Socket, const HTTPResponse &Response, const MythHTTPConfig &Config) |
Send an (error) response directly without creating a thread. More... | |
Protected Slots | |
void | Disconnected () |
The socket was disconnected. More... | |
void | Timeout () |
Close the socket after a period of inactivity. More... | |
void | Read () |
Read data from the socket which is parsed by MythHTTPParser. More... | |
void | Stop () |
Close the socket and quit the thread. More... | |
void | Write (int64_t Written=0) |
void | Error (QAbstractSocket::SocketError Error) |
Private Member Functions | |
void | SetupWebSocket () |
Transition socket to a WebSocket. More... | |
Private Attributes | |
qintptr | m_socketFD { 0 } |
MythHTTPConfig | m_config |
HTTPServicePtrs | m_activeServices |
bool | m_stopping { false } |
QTcpSocket * | m_socket { nullptr } |
MythWebSocket * | m_websocket { nullptr } |
QString | m_peer |
QTimer | m_timer |
MythHTTPParser | m_parser |
HTTPQueue | m_queue |
int64_t | m_totalToSend { 0 } |
int64_t | m_totalWritten { 0 } |
int64_t | m_totalSent { 0 } |
QElapsedTimer | m_writeTime |
HTTPData | m_writeBuffer { nullptr } |
MythHTTPConnection | m_nextConnection { HTTPConnectionClose } |
MythSocketProtocol | m_protocol { ProtHTTP } |
bool | m_testSocket { false } |
MythWebSocketEvent * | m_websocketevent { nullptr } |
Definition at line 18 of file mythhttpsocket.h.
|
explicit |
Definition at line 28 of file mythhttpsocket.cpp.
|
override |
Definition at line 95 of file mythhttpsocket.cpp.
|
signal |
Referenced by MythHTTPSocket(), and MythHTTPThread::Quit().
|
signal |
Referenced by MythHTTPSocket(), and ServicesChanged().
|
signal |
Referenced by MythHTTPThread::run(), and SetupWebSocket().
|
slot |
Update our list of recognised file paths.
The initial set of paths is passed in via the constructor. Any changes are notified using this slot.
Definition at line 109 of file mythhttpsocket.cpp.
Referenced by MythHTTPThread::run().
|
slot |
Definition at line 114 of file mythhttpsocket.cpp.
Referenced by MythHTTPThread::run().
|
slot |
Definition at line 119 of file mythhttpsocket.cpp.
Referenced by MythHTTPThread::run().
|
slot |
Definition at line 135 of file mythhttpsocket.cpp.
Referenced by MythHTTPThread::run().
|
slot |
Update the list of allowed Origins.
The initial list is passed in via the constructor and any changes are notified via this slot.
Definition at line 130 of file mythhttpsocket.cpp.
Referenced by MythHTTPThread::run().
|
slot |
Definition at line 635 of file mythhttpsocket.cpp.
Referenced by SetupWebSocket().
|
slot |
Definition at line 642 of file mythhttpsocket.cpp.
Referenced by SetupWebSocket().
|
staticslot |
Definition at line 649 of file mythhttpsocket.cpp.
Referenced by SetupWebSocket().
void MythHTTPSocket::Respond | ( | const HTTPResponse & | Response | ) |
Send response to client.
Queue headers, queue content, signal whether to close the socket and push first data to start the write.
Definition at line 358 of file mythhttpsocket.cpp.
|
static |
Send an (error) response directly without creating a thread.
This is used to send 503 Service Unavailable
Definition at line 418 of file mythhttpsocket.cpp.
|
protectedslot |
The socket was disconnected.
The QTcpSocket::disconnected signal is also connected to our QThread::quit slot, so the thread will be closed once the socket is disconnected.
Definition at line 145 of file mythhttpsocket.cpp.
Referenced by MythHTTPSocket().
|
protectedslot |
Close the socket after a period of inactivity.
This ensures we recycle unused threads for new connections.
Definition at line 160 of file mythhttpsocket.cpp.
Referenced by MythHTTPSocket().
|
protectedslot |
Read data from the socket which is parsed by MythHTTPParser.
If a complete request is received, move on to ProcessRequest.
Definition at line 209 of file mythhttpsocket.cpp.
Referenced by MythHTTPSocket(), and SetupWebSocket().
|
protectedslot |
Close the socket and quit the thread.
This is triggered by the activity timeout, invalid requests, if signalled by the parent server (i.e. closing down) or when the connection is closed after a request.
Definition at line 189 of file mythhttpsocket.cpp.
Referenced by MythHTTPSocket(), Read(), SetupWebSocket(), Timeout(), and Write().
|
protectedslot |
Definition at line 433 of file mythhttpsocket.cpp.
Referenced by MythHTTPSocket(), Respond(), and SetupWebSocket().
|
protectedslot |
Definition at line 150 of file mythhttpsocket.cpp.
Referenced by MythHTTPSocket().
|
private |
Transition socket to a WebSocket.
Definition at line 595 of file mythhttpsocket.cpp.
Referenced by Write().
|
private |
Definition at line 55 of file mythhttpsocket.h.
Referenced by MythHTTPSocket().
|
private |
Definition at line 56 of file mythhttpsocket.h.
Referenced by HandlersChanged(), HostsChanged(), MythHTTPSocket(), OriginsChanged(), PathsChanged(), Read(), Respond(), ServicesChanged(), Timeout(), and Write().
|
private |
Definition at line 57 of file mythhttpsocket.h.
Referenced by MythHTTPSocket(), and Read().
Definition at line 58 of file mythhttpsocket.h.
|
private |
Definition at line 59 of file mythhttpsocket.h.
Referenced by Error(), MythHTTPSocket(), Read(), Respond(), SetupWebSocket(), Timeout(), Write(), and ~MythHTTPSocket().
|
private |
Definition at line 60 of file mythhttpsocket.h.
Referenced by SetupWebSocket(), Stop(), and ~MythHTTPSocket().
|
private |
Definition at line 61 of file mythhttpsocket.h.
Referenced by MythHTTPSocket().
|
private |
Definition at line 62 of file mythhttpsocket.h.
Referenced by MythHTTPSocket(), Read(), SetupWebSocket(), Stop(), and Write().
|
private |
Definition at line 63 of file mythhttpsocket.h.
Referenced by Read().
|
private |
|
private |
Definition at line 65 of file mythhttpsocket.h.
|
private |
Definition at line 66 of file mythhttpsocket.h.
|
private |
Definition at line 67 of file mythhttpsocket.h.
|
private |
Definition at line 68 of file mythhttpsocket.h.
|
private |
Definition at line 69 of file mythhttpsocket.h.
|
private |
Definition at line 70 of file mythhttpsocket.h.
|
private |
Definition at line 71 of file mythhttpsocket.h.
Referenced by Read(), and SetupWebSocket().
Definition at line 73 of file mythhttpsocket.h.
Referenced by Read(), and SetupWebSocket().
|
private |
Definition at line 74 of file mythhttpsocket.h.
Referenced by NewRawTextMessage(), NewTextMessage(), SetupWebSocket(), and ~MythHTTPSocket().