diff --git a/include/CivetServer.h b/include/CivetServer.h index 42c6c66b..156592ee 100644 --- a/include/CivetServer.h +++ b/include/CivetServer.h @@ -60,6 +60,15 @@ class CIVETWEB_API CivetHandler */ virtual bool handlePost(CivetServer *server, struct mg_connection *conn); + /** + * Callback method for HEAD request. + * + * @param server - the calling server + * @param conn - the connection information + * @returns true if implemented, false otherwise + */ + virtual bool handleHead(CivetServer *server, struct mg_connection *conn); + /** * Callback method for PUT request. * diff --git a/src/CivetServer.cpp b/src/CivetServer.cpp index 405c2889..84d5f9eb 100644 --- a/src/CivetServer.cpp +++ b/src/CivetServer.cpp @@ -31,6 +31,14 @@ CivetHandler::handlePost(CivetServer *server, struct mg_connection *conn) return false; } +bool +CivetHandler::handleHead(CivetServer *server, struct mg_connection *conn) +{ + UNUSED_PARAMETER(server); + UNUSED_PARAMETER(conn); + return false; +} + bool CivetHandler::handlePut(CivetServer *server, struct mg_connection *conn) { @@ -128,6 +136,8 @@ CivetServer::requestHandler(struct mg_connection *conn, void *cbdata) return handler->handleGet(me, conn) ? 1 : 0; } else if (strcmp(request_info->request_method, "POST") == 0) { return handler->handlePost(me, conn) ? 1 : 0; + } else if (strcmp(request_info->request_method, "HEAD") == 0) { + return handler->handleHead(me, conn) ? 1 : 0; } else if (strcmp(request_info->request_method, "PUT") == 0) { return handler->handlePut(me, conn) ? 1 : 0; } else if (strcmp(request_info->request_method, "DELETE") == 0) {