summaryrefslogtreecommitdiffstats
path: root/httpd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'httpd.cpp')
-rw-r--r--httpd.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/httpd.cpp b/httpd.cpp
index 7c94f76..c52b936 100644
--- a/httpd.cpp
+++ b/httpd.cpp
@@ -84,6 +84,13 @@ int httpd::req_handler(void * cls,
MHD_add_response_header(rsp, "ETag", sHtmlCssEtag);
MHD_add_response_header(rsp, "Content-Type", "text/css; charset=utf-8");
}
+ else if(strcasecmp(url, "/api.json") == 0)
+ {
+ executor::inst()->get_http_report(EV_HTML_JSON, str);
+
+ rsp = MHD_create_response_from_buffer(str.size(), (void*)str.c_str(), MHD_RESPMEM_MUST_COPY);
+ MHD_add_response_header(rsp, "Content-Type", "application/json; charset=utf-8");
+ }
else if(strcasecmp(url, "/h") == 0 || strcasecmp(url, "/hashrate") == 0)
{
executor::inst()->get_http_report(EV_HTML_HASHRATE, str);
OpenPOWER on IntegriCloud