[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11712 - libmicrohttpd/src/examples
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11712 - libmicrohttpd/src/examples |
Date: |
Sun, 13 Jun 2010 11:05:57 +0200 |
Author: grothoff
Date: 2010-06-13 11:05:57 +0200 (Sun, 13 Jun 2010)
New Revision: 11712
Modified:
libmicrohttpd/src/examples/https_fileserver_example.c
Log:
better
Modified: libmicrohttpd/src/examples/https_fileserver_example.c
===================================================================
--- libmicrohttpd/src/examples/https_fileserver_example.c 2010-06-13
09:04:38 UTC (rev 11711)
+++ libmicrohttpd/src/examples/https_fileserver_example.c 2010-06-13
09:05:57 UTC (rev 11712)
@@ -131,7 +131,11 @@
}
*ptr = NULL; /* reset when done */
- file = fopen (&url[1], "rb");
+ if ( (0 == stat (url, &buf)) &&
+ (S_ISREG (buf.st_mode)) )
+ file = fopen (&url[1], "rb");
+ else
+ file = NULL;
if (file == NULL)
{
response = MHD_create_response_from_data (strlen (EMPTY_PAGE),
@@ -142,11 +146,15 @@
}
else
{
- stat (url, &buf);
response = MHD_create_response_from_callback (buf.st_size, 32 * 1024,
/* 32k PAGE_NOT_FOUND size */
&file_reader, file,
(MHD_ContentReaderFreeCallback)
& fclose);
+ if (response == NULL)
+ {
+ fclose (file);
+ return MHD_NO;
+ }
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11712 - libmicrohttpd/src/examples,
gnunet <=