gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: check rvalues from MHD_post_proce


From: gnunet
Subject: [libmicrohttpd] branch master updated: check rvalues from MHD_post_process in examples
Date: Mon, 25 Sep 2023 21:38:31 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 0ae49402 check rvalues from MHD_post_process in examples
0ae49402 is described below

commit 0ae494028bd892cdf58346f7e93310b33cd3aa09
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Sep 25 21:38:23 2023 +0200

    check rvalues from MHD_post_process in examples
---
 doc/examples/largepost.c    | 11 ++++++++---
 doc/examples/simplepost.c   |  7 +++++--
 src/examples/post_example.c | 19 +++++++++++--------
 src/examples/timeout.c      | 11 ++++++++---
 4 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c
index 45c4ad03..d52cabe0 100644
--- a/doc/examples/largepost.c
+++ b/doc/examples/largepost.c
@@ -95,9 +95,14 @@ send_page (struct MHD_Connection *connection,
   response = MHD_create_response_from_buffer_static (strlen (page), page);
   if (! response)
     return MHD_NO;
-  MHD_add_response_header (response,
-                           MHD_HTTP_HEADER_CONTENT_TYPE,
-                           "text/html");
+  if (MHD_YES !=
+      MHD_add_response_header (response,
+                               MHD_HTTP_HEADER_CONTENT_TYPE,
+                               "text/html"))
+  {
+    fprintf (stderr,
+             "Failed to set content type header!\n");
+  }
   ret = MHD_queue_response (connection,
                             status_code,
                             response);
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c
index 4d42b9a7..8706dba6 100644
--- a/doc/examples/simplepost.c
+++ b/doc/examples/simplepost.c
@@ -177,8 +177,11 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
 
     if (*upload_data_size != 0)
     {
-      MHD_post_process (con_info->postprocessor, upload_data,
-                        *upload_data_size);
+      if (MHD_YES !=
+          MHD_post_process (con_info->postprocessor,
+                            upload_data,
+                            *upload_data_size))
+        return MHD_NO;
       *upload_data_size = 0;
 
       return MHD_YES;
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 5bd88773..f6823e38 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -205,12 +205,13 @@ get_session (struct MHD_Connection *connection)
  * @param mime mime type to use
  * @param session session information
  * @param connection connection to process
- * @param MHD_YES on success, MHD_NO on failure
+ * @param #MHD_YES on success, #MHD_NO on failure
  */
-typedef enum MHD_Result (*PageHandler)(const void *cls,
-                                       const char *mime,
-                                       struct Session *session,
-                                       struct MHD_Connection *connection);
+typedef enum MHD_Result
+(*PageHandler)(const void *cls,
+               const char *mime,
+               struct Session *session,
+               struct MHD_Connection *connection);
 
 
 /**
@@ -633,9 +634,11 @@ create_response (void *cls,
   if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
   {
     /* evaluate POST data */
-    MHD_post_process (request->pp,
-                      upload_data,
-                      *upload_data_size);
+    if (MHD_YES !=
+        MHD_post_process (request->pp,
+                          upload_data,
+                          *upload_data_size))
+      return MHD_NO;
     if (0 != *upload_data_size)
     {
       *upload_data_size = 0;
diff --git a/src/examples/timeout.c b/src/examples/timeout.c
index dacc93fd..714cf074 100644
--- a/src/examples/timeout.c
+++ b/src/examples/timeout.c
@@ -53,9 +53,14 @@ answer_to_connection (void *cls,
 
   response = MHD_create_response_from_buffer_static (strlen (page),
                                                      (const void *) page);
-  MHD_add_response_header (response,
-                           MHD_HTTP_HEADER_CONTENT_TYPE,
-                           "text/html");
+  if (MHD_YES !=
+      MHD_add_response_header (response,
+                               MHD_HTTP_HEADER_CONTENT_TYPE,
+                               "text/html"))
+  {
+    fprintf (stderr,
+             "Failed to set content type header!\n");
+  }
   ret = MHD_queue_response (connection,
                             MHD_HTTP_OK,
                             response);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]