Added basic webserver functionality

This commit is contained in:
0xFEEDC0DE64
2018-05-03 14:36:02 +02:00
parent e611bcf762
commit 187c655b8d
6 changed files with 177 additions and 29 deletions
+20
View File
@@ -0,0 +1,20 @@
#include "streamingwebserver.h"
#include "httpclientconnection.h"
#include "httpcontainers.h"
StreamingWebserver::StreamingWebserver(QObject *parent) :
HttpServer(parent)
{
}
void StreamingWebserver::handleRequest(HttpClientConnection *connection, const HttpRequest &request)
{
HttpResponse response;
response.protocol = request.protocol;
response.statusCode = HttpResponse::StatusCode::NotFound;
response.headers.insert(QStringLiteral("Server"), QStringLiteral("Hatschi Server 1.0"));
response.headers.insert(QStringLiteral("Content-Type"), QStringLiteral("text/html"));
connection->sendResponse(response, tr("Not Found"));
}