mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
Still there is an issue with re-open a file. Patch applied below to
avoid it. Also iterate_post() always returns MHD_OK, because the app's logic driven from the value of con_info->answercode(). And in case if fwrite() fails we also update the answer code & page and MHD_post_process() overwrite them (fileioerror becomes postprocerror).
This commit is contained in:
@@ -138,6 +138,8 @@ iterate_post (void *coninfo_cls,
|
||||
|
||||
if (! con_info->fp)
|
||||
{
|
||||
if (0 != con_info->answercode) /* something went wrong */
|
||||
return MHD_YES;
|
||||
if (NULL != (fp = fopen (filename, "rb")))
|
||||
{
|
||||
fclose (fp);
|
||||
@@ -161,7 +163,7 @@ iterate_post (void *coninfo_cls,
|
||||
{
|
||||
con_info->answerstring = fileioerror;
|
||||
con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
|
||||
return MHD_NO;
|
||||
return MHD_YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +327,11 @@ main ()
|
||||
MHD_OPTION_NOTIFY_COMPLETED, &request_completed, NULL,
|
||||
MHD_OPTION_END);
|
||||
if (NULL == daemon)
|
||||
return 1;
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to start daemon\n");
|
||||
return 1;
|
||||
}
|
||||
(void) getchar ();
|
||||
MHD_stop_daemon (daemon);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user