mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
use untranslated file input mode, important on Windows
This commit is contained in:
@@ -225,7 +225,7 @@ take this as the name the file will be stored on the server and make sure no fil
|
||||
@verbatim
|
||||
if (!con_info->fp)
|
||||
{
|
||||
if (NULL != (fp = fopen (filename, "r")) )
|
||||
if (NULL != (fp = fopen (filename, "rb")) )
|
||||
{
|
||||
fclose (fp);
|
||||
con_info->answerstring = fileexistspage;
|
||||
|
||||
@@ -80,7 +80,7 @@ iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key,
|
||||
|
||||
if (!con_info->fp)
|
||||
{
|
||||
if (NULL != (fp = fopen (filename, "r")))
|
||||
if (NULL != (fp = fopen (filename, "rb")))
|
||||
{
|
||||
fclose (fp);
|
||||
con_info->answerstring = fileexistspage;
|
||||
|
||||
@@ -62,7 +62,7 @@ ahc_echo (void *cls,
|
||||
return MHD_YES;
|
||||
}
|
||||
*ptr = NULL; /* reset when done */
|
||||
file = fopen (&url[1], "r");
|
||||
file = fopen (&url[1], "rb");
|
||||
if (file == NULL)
|
||||
{
|
||||
response = MHD_create_response_from_data (strlen (PAGE),
|
||||
|
||||
@@ -55,7 +55,7 @@ dir_reader (void *cls, uint64_t pos, char *buf, int max)
|
||||
return snprintf (buf, max,
|
||||
"<a href=\"/%s\">%s</a><br>",
|
||||
e->d_name,
|
||||
e->d_name);
|
||||
e->d_name);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,9 +83,9 @@ ahc_echo (void *cls,
|
||||
return MHD_YES;
|
||||
}
|
||||
*ptr = NULL; /* reset when done */
|
||||
file = fopen (&url[1], "r");
|
||||
file = fopen (&url[1], "rb");
|
||||
if (file == NULL)
|
||||
{
|
||||
{
|
||||
response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN,
|
||||
32 * 1024,
|
||||
&dir_reader,
|
||||
|
||||
@@ -62,7 +62,7 @@ ahc_echo (void *cls,
|
||||
return MHD_YES;
|
||||
}
|
||||
*ptr = NULL; /* reset when done */
|
||||
file = fopen (&url[1], "r");
|
||||
file = fopen (&url[1], "rb");
|
||||
if (file == NULL)
|
||||
{
|
||||
response = MHD_create_response_from_data (strlen (PAGE),
|
||||
|
||||
@@ -131,7 +131,7 @@ http_ahc (void *cls,
|
||||
}
|
||||
*ptr = NULL; /* reset when done */
|
||||
|
||||
file = fopen (&url[1], "r");
|
||||
file = fopen (url, "rb");
|
||||
if (file == NULL)
|
||||
{
|
||||
response = MHD_create_response_from_data (strlen (EMPTY_PAGE),
|
||||
@@ -142,7 +142,7 @@ http_ahc (void *cls,
|
||||
}
|
||||
else
|
||||
{
|
||||
stat (&url[1], &buf);
|
||||
stat (url, &buf);
|
||||
response = MHD_create_response_from_callback (buf.st_size, 32 * 1024, /* 32k PAGE_NOT_FOUND size */
|
||||
&file_reader, file,
|
||||
(MHD_ContentReaderFreeCallback)
|
||||
|
||||
@@ -174,7 +174,7 @@ setup_ca_cert ()
|
||||
{
|
||||
FILE *cert_fd;
|
||||
|
||||
if (NULL == (cert_fd = fopen (ca_cert_file_name, "w+")))
|
||||
if (NULL == (cert_fd = fopen (ca_cert_file_name, "wb+")))
|
||||
{
|
||||
fprintf (stderr, "Error: failed to open `%s': %s\n",
|
||||
ca_cert_file_name, strerror (errno));
|
||||
|
||||
@@ -87,7 +87,7 @@ http_ahc (void *cls, struct MHD_Connection *connection,
|
||||
}
|
||||
*ptr = NULL; /* reset when done */
|
||||
|
||||
file = fopen (url, "r");
|
||||
file = fopen (url, "rb");
|
||||
if (file == NULL)
|
||||
{
|
||||
response = MHD_create_response_from_data (strlen (PAGE_NOT_FOUND),
|
||||
@@ -290,7 +290,7 @@ setup_test_file ()
|
||||
{
|
||||
FILE *test_fd;
|
||||
|
||||
if (NULL == (test_fd = fopen (TEST_FILE_NAME, "w+")))
|
||||
if (NULL == (test_fd = fopen (TEST_FILE_NAME, "wb+")))
|
||||
{
|
||||
fprintf (stderr, "Error: failed to open `%s': %s\n",
|
||||
TEST_FILE_NAME, strerror (errno));
|
||||
|
||||
Reference in New Issue
Block a user