diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-06-25 19:08:49 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-06-25 19:08:49 +0000 |
commit | 55ecaec5a7467e251b1a6ea7a8bbaf09bd09bb40 (patch) | |
tree | bd9da68f7a085c7c9bca3237bc725cb5ec19d795 /src/examples/demo.c | |
parent | 4cdf058b25117c8f00e406dacef6e5b2f578f893 (diff) | |
download | libmicrohttpd-55ecaec5a7467e251b1a6ea7a8bbaf09bd09bb40.tar.gz libmicrohttpd-55ecaec5a7467e251b1a6ea7a8bbaf09bd09bb40.zip |
modify demo to handle HEAD requests
Diffstat (limited to 'src/examples/demo.c')
-rw-r--r-- | src/examples/demo.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/examples/demo.c b/src/examples/demo.c index 80ca09c1..7447724e 100644 --- a/src/examples/demo.c +++ b/src/examples/demo.c | |||
@@ -690,8 +690,9 @@ generate_page (void *cls, | |||
690 | ssize_t got; | 690 | ssize_t got; |
691 | const char *mime; | 691 | const char *mime; |
692 | 692 | ||
693 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) | 693 | if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) && |
694 | return MHD_NO; /* unexpected method (we're not polite...) */ | 694 | (0 != strcmp (method, MHD_HTTP_METHOD_HEAD)) ) |
695 | return MHD_NO; /* unexpected method (we're not polite...) */ | ||
695 | if ( (0 == stat (&url[1], &buf)) && | 696 | if ( (0 == stat (&url[1], &buf)) && |
696 | (NULL == strstr (&url[1], "..")) && | 697 | (NULL == strstr (&url[1], "..")) && |
697 | ('/' != url[1])) | 698 | ('/' != url[1])) |
@@ -783,7 +784,8 @@ generate_page (void *cls, | |||
783 | return return_directory_response (connection); | 784 | return return_directory_response (connection); |
784 | } | 785 | } |
785 | } | 786 | } |
786 | if (0 == strcmp (method, MHD_HTTP_METHOD_GET)) | 787 | if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || |
788 | (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) | ||
787 | { | 789 | { |
788 | return return_directory_response (connection); | 790 | return return_directory_response (connection); |
789 | } | 791 | } |