mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
4533b34606
* make hyperion to singelton. remove arguments for config and hyperion - both are gettable via Hyperion::getInstance * refactor hyperiond * remove qt4 comapt make zeroconf mandatory refactor hyperiond * xbmcchecker is now a singleton * cleanup in hyperiond zeroconf switchable between static and shared linking * fix xbmcchecker * extensive refactoring of hyperiond webserver: make client ip information availabel in request object - preparation for ip filters proto/json server, use hyperion::getInstance instead of hyperion argument * move creation of hyperion core into hyperionDeamon class cleanup
70 lines
1.7 KiB
C++
70 lines
1.7 KiB
C++
|
|
#include "QtHttpRequest.h"
|
|
#include "QtHttpHeader.h"
|
|
#include "QtHttpServer.h"
|
|
|
|
QtHttpRequest::QtHttpRequest (QtHttpServer * parent)
|
|
: QObject (parent)
|
|
, m_url (QUrl ())
|
|
, m_command (QString ())
|
|
, m_data (QByteArray ())
|
|
, m_serverHandle (parent)
|
|
{
|
|
// set some additional headers
|
|
addHeader (QtHttpHeader::ContentLength, QByteArrayLiteral ("0"));
|
|
addHeader (QtHttpHeader::Connection, QByteArrayLiteral ("Keep-Alive"));
|
|
}
|
|
|
|
QUrl QtHttpRequest::getUrl (void) const {
|
|
return m_url;
|
|
}
|
|
|
|
QString QtHttpRequest::getCommand (void) const {
|
|
return m_command;
|
|
}
|
|
|
|
QtHttpRequest::ClientInfo QtHttpRequest::getClientInfo (void) const {
|
|
return m_clientInfo;
|
|
}
|
|
|
|
int QtHttpRequest::getRawDataSize (void) const {
|
|
return m_data.size ();
|
|
}
|
|
|
|
|
|
QByteArray QtHttpRequest::getRawData (void) const {
|
|
return m_data;
|
|
}
|
|
|
|
QList<QByteArray> QtHttpRequest::getHeadersList (void) const {
|
|
return m_headersHash.keys ();
|
|
}
|
|
|
|
QByteArray QtHttpRequest::getHeader (const QByteArray & header) const {
|
|
return m_headersHash.value (header, QByteArray ());
|
|
}
|
|
|
|
void QtHttpRequest::setUrl (const QUrl & url) {
|
|
m_url = url;
|
|
}
|
|
|
|
void QtHttpRequest::setCommand (const QString & command) {
|
|
m_command = command;
|
|
}
|
|
|
|
void QtHttpRequest::setClientInfo (const QHostAddress & server, const QHostAddress & client) {
|
|
m_clientInfo.serverAddress = server;
|
|
m_clientInfo.clientAddress = client;
|
|
}
|
|
|
|
void QtHttpRequest::addHeader (const QByteArray & header, const QByteArray & value) {
|
|
QByteArray key = header.trimmed ();
|
|
if (!key.isEmpty ()) {
|
|
m_headersHash.insert (key, value);
|
|
}
|
|
}
|
|
|
|
void QtHttpRequest::appendRawData (const QByteArray & data) {
|
|
m_data.append (data);
|
|
}
|