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:
@@ -8,6 +8,8 @@
|
||||
#ifndef HTTPSERVER_HTTPDOCROOTSETTINGS_H_
|
||||
#define HTTPSERVER_HTTPDOCROOTSETTINGS_H_
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace qtwebapp {
|
||||
|
||||
struct HttpDocrootSettings
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user