From 70c6dda027cc13fdd5ad8ca804f527c24518dace Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 <0xFEEDC0DE64@gmail.com> Date: Sat, 22 Sep 2018 03:07:20 +0200 Subject: [PATCH] Implemented basic example response --- proxyapplication.cpp | 12 ++++++++++++ proxyapplication.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/proxyapplication.cpp b/proxyapplication.cpp index 8241896..84f721c 100644 --- a/proxyapplication.cpp +++ b/proxyapplication.cpp @@ -1,5 +1,9 @@ #include "proxyapplication.h" +#include "httprequest.h" +#include "httpresponse.h" +#include "httpclientconnection.h" + ProxyApplication::ProxyApplication(const QJsonObject &config, QObject *parent) : WebApplication(parent) { @@ -10,3 +14,11 @@ void ProxyApplication::start() { } + +void ProxyApplication::handleRequest(HttpClientConnection *connection, const HttpRequest &request) +{ + HttpResponse response; + response.protocol = request.protocol; + response.statusCode = HttpResponse::StatusCode::OK; + connection->sendResponse(response, "Hello from ProxyApplication: " + request.path); +} diff --git a/proxyapplication.h b/proxyapplication.h index 642f870..82be796 100644 --- a/proxyapplication.h +++ b/proxyapplication.h @@ -12,4 +12,6 @@ public: ProxyApplication(const QJsonObject &config, QObject *parent = Q_NULLPTR); void start() Q_DECL_OVERRIDE; + + void handleRequest(HttpClientConnection *connection, const HttpRequest &request) Q_DECL_OVERRIDE; };