aboutsummaryrefslogtreecommitdiff
path: root/src/examples/demo_https.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/demo_https.c')
-rw-r--r--src/examples/demo_https.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index f34a715c..c74a0252 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -693,12 +693,19 @@ generate_page (void *cls,
693 693
694 if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) 694 if (0 != strcmp (method, MHD_HTTP_METHOD_GET))
695 return MHD_NO; /* unexpected method (we're not polite...) */ 695 return MHD_NO; /* unexpected method (we're not polite...) */
696 if ( (0 == stat (&url[1], &buf)) && 696 fd = -1;
697 (NULL == strstr (&url[1], "..")) && 697
698 ('/' != url[1])) 698 if ( (NULL == strstr (&url[1], "..")) &&
699 fd = open (&url[1], O_RDONLY); 699 ('/' != url[1]) )
700 else 700 {
701 fd = -1; 701 fd = open (&url[1], O_RDONLY);
702 if ( (0 != fstat (fd, &buf)) ||
703 (! S_ISREG (buf.st_mode)) )
704 {
705 (void) close (fd);
706 fd = -1;
707 }
708 }
702 if (-1 == fd) 709 if (-1 == fd)
703 return MHD_queue_response (connection, 710 return MHD_queue_response (connection,
704 MHD_HTTP_NOT_FOUND, 711 MHD_HTTP_NOT_FOUND,