97 lines
5.7 KiB
Diff
97 lines
5.7 KiB
Diff
--- a/libresapi/src/api/ApiServerMHD.cpp 2021-05-04 08:25:21.960601037 -0700
|
|
+++ b/libresapi/src/api/ApiServerMHD.cpp 2021-05-04 08:26:27.071424663 -0700
|
|
@@ -113,7 +113,7 @@
|
|
// return MHD_NO to terminate connection
|
|
// return MHD_YES otherwise
|
|
// this function will get called by MHD until a response was queued
|
|
- virtual int handleRequest( struct MHD_Connection *connection,
|
|
+ virtual enum MHD_Result handleRequest( struct MHD_Connection *connection,
|
|
const char *url, const char *method, const char *version,
|
|
const char *upload_data, size_t *upload_data_size) = 0;
|
|
};
|
|
@@ -125,7 +125,7 @@
|
|
MHDUploadHandler(ApiServer* s): mState(BEGIN), mApiServer(s){}
|
|
virtual ~MHDUploadHandler(){}
|
|
// return MHD_NO or MHD_YES
|
|
- virtual int handleRequest( struct MHD_Connection *connection,
|
|
+ virtual enum MHD_Result handleRequest( struct MHD_Connection *connection,
|
|
const char */*url*/, const char *method, const char */*version*/,
|
|
const char *upload_data, size_t *upload_data_size)
|
|
{
|
|
@@ -184,7 +184,7 @@
|
|
MHDApiHandler(ApiServer* s): mState(BEGIN), mApiServer(s){}
|
|
virtual ~MHDApiHandler(){}
|
|
// return MHD_NO or MHD_YES
|
|
- virtual int handleRequest( struct MHD_Connection *connection,
|
|
+ virtual enum MHD_Result handleRequest( struct MHD_Connection *connection,
|
|
const char *url, const char *method, const char */*version*/,
|
|
const char *upload_data, size_t *upload_data_size)
|
|
{
|
|
@@ -265,7 +265,7 @@
|
|
uint64_t mSize;
|
|
|
|
// return MHD_NO or MHD_YES
|
|
- virtual int handleRequest( struct MHD_Connection *connection,
|
|
+ virtual enum MHD_Result handleRequest( struct MHD_Connection *connection,
|
|
const char *url, const char */*method*/, const char */*version*/,
|
|
const char */*upload_data*/, size_t */*upload_data_size*/)
|
|
{
|
|
@@ -327,7 +327,7 @@
|
|
#endif // ENABLE_FILESTREAMER
|
|
|
|
// MHD will call this for each element of the http header
|
|
-static int _extract_host_header_it_cb(void *cls,
|
|
+static enum MHD_Result _extract_host_header_it_cb(void *cls,
|
|
enum MHD_ValueKind kind,
|
|
const char *key,
|
|
const char *value)
|
|
@@ -522,12 +522,12 @@
|
|
mDaemon = 0;
|
|
}
|
|
|
|
-int ApiServerMHD::static_acceptPolicyCallback(void *cls, const sockaddr *addr, socklen_t addrlen)
|
|
+enum MHD_Result ApiServerMHD::static_acceptPolicyCallback(void *cls, const sockaddr *addr, socklen_t addrlen)
|
|
{
|
|
return ((ApiServerMHD*)cls)->acceptPolicyCallback(addr, addrlen);
|
|
}
|
|
|
|
-int ApiServerMHD::static_accessHandlerCallback(void* cls, struct MHD_Connection * connection,
|
|
+enum MHD_Result ApiServerMHD::static_accessHandlerCallback(void* cls, struct MHD_Connection * connection,
|
|
const char *url, const char *method, const char *version,
|
|
const char *upload_data, size_t *upload_data_size,
|
|
void **con_cls)
|
|
@@ -543,13 +543,13 @@
|
|
}
|
|
|
|
|
|
-int ApiServerMHD::acceptPolicyCallback(const sockaddr* /*addr*/, socklen_t /*addrlen*/)
|
|
+enum MHD_Result ApiServerMHD::acceptPolicyCallback(const sockaddr* /*addr*/, socklen_t /*addrlen*/)
|
|
{
|
|
// accept all connetions
|
|
return MHD_YES;
|
|
}
|
|
|
|
-int ApiServerMHD::accessHandlerCallback(MHD_Connection *connection,
|
|
+enum MHD_Result ApiServerMHD::accessHandlerCallback(MHD_Connection *connection,
|
|
const char *url, const char *method, const char *version,
|
|
const char *upload_data, size_t *upload_data_size,
|
|
void **con_cls)
|
|
--- a/libresapi/src/api/ApiServerMHD.h 2021-05-04 08:25:24.368594515 -0700
|
|
+++ b/libresapi/src/api/ApiServerMHD.h 2021-05-04 08:25:25.942590251 -0700
|
|
@@ -58,11 +58,11 @@
|
|
|
|
private:
|
|
// static callbacks for libmicrohttpd, they call the members below
|
|
- static int static_acceptPolicyCallback(void* cls, const struct sockaddr * addr, socklen_t addrlen);
|
|
- static int static_accessHandlerCallback(void* cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);
|
|
+ static enum MHD_Result static_acceptPolicyCallback(void* cls, const struct sockaddr * addr, socklen_t addrlen);
|
|
+ static enum MHD_Result static_accessHandlerCallback(void* cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);
|
|
static void static_requestCompletedCallback(void *cls, struct MHD_Connection* connection, void **con_cls, enum MHD_RequestTerminationCode toe);
|
|
- int acceptPolicyCallback(const struct sockaddr * addr, socklen_t addrlen);
|
|
- int accessHandlerCallback(struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);
|
|
+ enum MHD_Result acceptPolicyCallback(const struct sockaddr * addr, socklen_t addrlen);
|
|
+ enum MHD_Result accessHandlerCallback(struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);
|
|
void requestCompletedCallback(struct MHD_Connection *connection, void **con_cls, MHD_RequestTerminationCode toe);
|
|
bool mConfigOk;
|
|
std::string mRootDir;
|