| 103 | } |
| 104 | |
| 105 | bool HttpServer::SendResponse(const string &response, void *addInfo) { |
| 106 | struct mhd_coninfo *client_connection = static_cast<struct mhd_coninfo *>(addInfo); |
| 107 | struct MHD_Response *result = MHD_create_response_from_buffer(response.size(), (void *)response.c_str(), MHD_RESPMEM_MUST_COPY); |
| 108 | |
| 109 | MHD_add_response_header(result, "Content-Type", "application/json"); |
| 110 | MHD_add_response_header(result, "Access-Control-Allow-Origin", "*"); |
| 111 | |
| 112 | int ret = MHD_queue_response(client_connection->connection, client_connection->code, result); |
| 113 | MHD_destroy_response(result); |
| 114 | return ret == MHD_YES; |
| 115 | } |
| 116 | |
| 117 | bool HttpServer::SendOptionsResponse(void *addInfo) { |
| 118 | struct mhd_coninfo *client_connection = static_cast<struct mhd_coninfo *>(addInfo); |