1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
diff --git a/xmrstak/http/httpd.cpp b/xmrstak/http/httpd.cpp
index b4f0f54..636891c 100644
--- a/xmrstak/http/httpd.cpp
+++ b/xmrstak/http/httpd.cpp
@@ -46,7 +46,7 @@ httpd::httpd()
{
}
-int httpd::req_handler(void* cls,
+MHD_Result httpd::req_handler(void* cls,
MHD_Connection* connection,
const char* url,
const char* method,
@@ -63,7 +63,7 @@ int httpd::req_handler(void* cls,
if(strlen(jconf::inst()->GetHttpUsername()) != 0)
{
char* username;
- int ret;
+ MHD_Result ret;
username = MHD_digest_auth_get_username(connection);
if(username == NULL)
@@ -75,7 +75,7 @@ int httpd::req_handler(void* cls,
}
free(username);
- ret = MHD_digest_auth_check(connection, sHttpAuthRealm, jconf::inst()->GetHttpUsername(), jconf::inst()->GetHttpPassword(), 300);
+ ret = static_cast<MHD_Result>(MHD_digest_auth_check(connection, sHttpAuthRealm, jconf::inst()->GetHttpUsername(), jconf::inst()->GetHttpPassword(), 300));
if(ret == MHD_INVALID_NONCE || ret == MHD_NO)
{
rsp = MHD_create_response_from_buffer(sHtmlAccessDeniedSize, (void*)sHtmlAccessDenied, MHD_RESPMEM_PERSISTENT);
@@ -95,7 +95,7 @@ int httpd::req_handler(void* cls,
{ //Cache hit
rsp = MHD_create_response_from_buffer(0, nullptr, MHD_RESPMEM_PERSISTENT);
- int ret = MHD_queue_response(connection, MHD_HTTP_NOT_MODIFIED, rsp);
+ MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_NOT_MODIFIED, rsp);
MHD_destroy_response(rsp);
return ret;
}
@@ -144,13 +144,13 @@ int httpd::req_handler(void* cls,
snprintf(loc_path, sizeof(loc_path), "/h");
rsp = MHD_create_response_from_buffer(0, nullptr, MHD_RESPMEM_PERSISTENT);
- int ret = MHD_queue_response(connection, MHD_HTTP_TEMPORARY_REDIRECT, rsp);
+ MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_TEMPORARY_REDIRECT, rsp);
MHD_add_response_header(rsp, "Location", loc_path);
MHD_destroy_response(rsp);
return ret;
}
- int ret = MHD_queue_response(connection, MHD_HTTP_OK, rsp);
+ MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_OK, rsp);
MHD_destroy_response(rsp);
return ret;
}
diff --git a/xmrstak/http/httpd.hpp b/xmrstak/http/httpd.hpp
index dfad082..c7f7584 100644
--- a/xmrstak/http/httpd.hpp
+++ b/xmrstak/http/httpd.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <stdlib.h>
+#include <microhttpd.h>
struct MHD_Daemon;
struct MHD_Connection;
@@ -21,7 +22,7 @@ class httpd
httpd();
static httpd* oInst;
- static int req_handler(void* cls,
+ static MHD_Result req_handler(void* cls,
MHD_Connection* connection,
const char* url,
const char* method,
|