modify demo to handle HEAD requests

This commit is contained in:
Christian Grothoff
2015-06-25 19:08:49 +00:00
parent 4cdf058b25
commit 55ecaec5a7
+5 -3
View File
@@ -690,8 +690,9 @@ generate_page (void *cls,
ssize_t got;
const char *mime;
if (0 != strcmp (method, MHD_HTTP_METHOD_GET))
return MHD_NO; /* unexpected method (we're not polite...) */
if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) &&
(0 != strcmp (method, MHD_HTTP_METHOD_HEAD)) )
return MHD_NO; /* unexpected method (we're not polite...) */
if ( (0 == stat (&url[1], &buf)) &&
(NULL == strstr (&url[1], "..")) &&
('/' != url[1]))
@@ -783,7 +784,8 @@ generate_page (void *cls,
return return_directory_response (connection);
}
}
if (0 == strcmp (method, MHD_HTTP_METHOD_GET))
if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) ||
(0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) )
{
return return_directory_response (connection);
}