| 619 | } |
| 620 | |
| 621 | void Server::SendHttpMethodNotAllowed( |
| 622 | struct mg_connection* connection, |
| 623 | const struct mg_request_info* request_info, |
| 624 | const std::string& allowed_methods, |
| 625 | const std::string& body) { |
| 626 | LOG(TRACE) << "Entering Server::SendHttpMethodNotAllowed"; |
| 627 | |
| 628 | std::string body_to_send = body + "\r\n"; |
| 629 | |
| 630 | std::ostringstream out; |
| 631 | out << "HTTP/1.1 405 Method Not Allowed\r\n" |
| 632 | << "Content-Type: text/html\r\n" |
| 633 | << "Content-Length: " << strlen(body_to_send.c_str()) << "\r\n" |
| 634 | << "Allow: " << allowed_methods << "\r\n\r\n"; |
| 635 | if (strcmp(request_info->request_method, "HEAD") != 0) { |
| 636 | out << body_to_send; |
| 637 | } |
| 638 | |
| 639 | mg_write(connection, out.str().c_str(), out.str().size()); |
| 640 | } |
| 641 | |
| 642 | void Server::SendHttpTimeout(struct mg_connection* connection, |
| 643 | const struct mg_request_info* request_info, |
no test coverage detected