| 64 | } |
| 65 | |
| 66 | std::size_t HttpServer::readFile(const char *filePath, std::string &data) const { |
| 67 | std::ifstream file; |
| 68 | file.open(filePath); |
| 69 | if (file.is_open()) { |
| 70 | data = std::string((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>()); |
| 71 | file.close(); |
| 72 | return data.size(); |
| 73 | } |
| 74 | SI_LOG_ERROR("Unable to read from File: %s", filePath); |
| 75 | return 0; |
| 76 | } |
| 77 | |
| 78 | bool HttpServer::methodPost(SocketClient &client) { |
| 79 | const std::string content = StringConverter::getContentFrom(client.getMessage()); |