| 577 | } |
| 578 | |
| 579 | void Server::SendHttpInternalError(struct mg_connection* connection, |
| 580 | const struct mg_request_info* request_info, |
| 581 | const std::string& body) { |
| 582 | LOG(TRACE) << "Entering Server::SendHttpInternalError"; |
| 583 | |
| 584 | std::string body_to_send = body + "\r\n"; |
| 585 | |
| 586 | std::ostringstream out; |
| 587 | out << "HTTP/1.1 500 Internal Server Error\r\n" |
| 588 | << "Content-Length: " << strlen(body_to_send.c_str()) << "\r\n" |
| 589 | << "Content-Type: application/json; charset=utf-8\r\n" |
| 590 | << "Cache-Control: no-cache\r\n" |
| 591 | << "Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept\r\n" |
| 592 | << "Accept-Ranges: bytes\r\n\r\n"; |
| 593 | if (strcmp(request_info->request_method, "HEAD") != 0) { |
| 594 | out << body_to_send; |
| 595 | } |
| 596 | |
| 597 | mg_write(connection, out.str().c_str(), out.str().size()); |
| 598 | } |
| 599 | |
| 600 | void Server::SendHttpNotFound(struct mg_connection* const connection, |
| 601 | const struct mg_request_info* request_info, |
no test coverage detected