1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Web API: send API documentation if path is invalid

This commit is contained in:
f4exb
2017-11-20 18:38:26 +01:00
parent 7fa26835bd
commit 1b5f944302
9 changed files with 9091 additions and 5 deletions
+2
View File
@@ -8,6 +8,8 @@
#ifndef HTTPSERVER_HTTPDOCROOTSETTINGS_H_
#define HTTPSERVER_HTTPDOCROOTSETTINGS_H_
#include <QString>
namespace qtwebapp {
struct HttpDocrootSettings
+9 -2
View File
@@ -61,7 +61,13 @@ StaticFileController::StaticFileController(const HttpDocrootSettings& settings,
void StaticFileController::service(HttpRequest& request, HttpResponse& response)
{
QByteArray path=request.getPath();
QByteArray path = request.getPath();
service(path, response);
}
void StaticFileController::service(QByteArray& path, HttpResponse& response)
{
//QByteArray path=request.getPath();
// Check if we have the file in cache
qint64 now=QDateTime::currentMSecsSinceEpoch();
mutex.lock();
@@ -114,7 +120,8 @@ void StaticFileController::service(HttpRequest& request, HttpResponse& response)
entry->created=now;
entry->filename=path;
mutex.lock();
cache.insert(request.getPath(),entry,entry->document.size());
//cache.insert(request.getPath(),entry,entry->document.size());
cache.insert(path,entry,entry->document.size());
mutex.unlock();
}
else
+4 -1
View File
@@ -55,9 +55,12 @@ public:
/** Constructor with settings structure */
StaticFileController(const HttpDocrootSettings& settings, QObject* parent = NULL);
/** Generates the response */
/** Generates the response from HTTP request */
void service(HttpRequest& request, HttpResponse& response);
/** Generates the response directly from the path */
void service(QByteArray& path, HttpResponse& response);
private:
/** Encoding of text files */