| 598 | } |
| 599 | |
| 600 | void Server::SendHttpNotFound(struct mg_connection* const connection, |
| 601 | const struct mg_request_info* request_info, |
| 602 | const std::string& body) { |
| 603 | LOG(TRACE) << "Entering Server::SendHttpNotFound"; |
| 604 | |
| 605 | std::string body_to_send = body + "\r\n"; |
| 606 | |
| 607 | std::ostringstream out; |
| 608 | out << "HTTP/1.1 404 Not Found\r\n" |
| 609 | << "Content-Length: " << strlen(body_to_send.c_str()) << "\r\n" |
| 610 | << "Content-Type: application/json; charset=utf-8\r\n" |
| 611 | << "Cache-Control: no-cache\r\n" |
| 612 | << "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept\r\n" |
| 613 | << "Accept-Ranges: bytes\r\n\r\n"; |
| 614 | if (strcmp(request_info->request_method, "HEAD") != 0) { |
| 615 | out << body_to_send; |
| 616 | } |
| 617 | |
| 618 | mg_printf(connection, "%s", out.str().c_str()); |
| 619 | } |
| 620 | |
| 621 | void Server::SendHttpMethodNotAllowed( |
| 622 | struct mg_connection* connection, |
no test coverage detected