commit 55ecaec5a7467e251b1a6ea7a8bbaf09bd09bb40
parent 4cdf058b25117c8f00e406dacef6e5b2f578f893
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 25 Jun 2015 19:08:49 +0000
modify demo to handle HEAD requests
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/examples/demo.c b/src/examples/demo.c
@@ -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);
}