mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-26 04:09:30 +03:00
modify demo to handle HEAD requests
This commit is contained in:
+5
-3
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user