Fixed issue with responses not getting sent
This commit is contained in:
parent
978472ed21
commit
2ed31347db
@ -114,7 +114,7 @@ void updateUtilization(){
|
||||
}
|
||||
|
||||
enum MHD_Result sendPage(struct MHD_Connection *connection, char* page, char *mimetype){
|
||||
struct MHD_Response *response = MHD_create_response_from_buffer(strlen(page), (void *) page, MHD_RESPMEM_PERSISTENT);
|
||||
struct MHD_Response *response = MHD_create_response_from_buffer(strlen(page), (void *) page, MHD_RESPMEM_MUST_COPY);
|
||||
MHD_add_response_header(response, "Content-Type", mimetype);
|
||||
MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
|
||||
enum MHD_Result result = MHD_queue_response(connection, MHD_HTTP_OK, response);
|
||||
@ -123,7 +123,6 @@ enum MHD_Result sendPage(struct MHD_Connection *connection, char* page, char *mi
|
||||
}
|
||||
|
||||
int answerConnection(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *uploadData, size_t *uploadDataSize, void **con_ls){
|
||||
if (strcmp(url, "/server") == 0){
|
||||
cJSON *response = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(response, "uptime", uptime);
|
||||
cJSON_AddNumberToObject(response, "cpuCount", coreCount);
|
||||
@ -142,8 +141,6 @@ int answerConnection(void *cls, struct MHD_Connection *connection, const char *u
|
||||
|
||||
cJSON_Delete(response);
|
||||
return result;
|
||||
}
|
||||
return MHD_NO;
|
||||
}
|
||||
|
||||
void readConfig(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user