gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 08/10: daemon: merged processing of two similar options


From: gnunet
Subject: [libmicrohttpd] 08/10: daemon: merged processing of two similar options
Date: Thu, 13 Oct 2022 08:40:48 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 1689be3a275dd8b4bb26c2f8501bd6050ac17e98
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Oct 12 18:27:24 2022 +0300

    daemon: merged processing of two similar options
---
 src/microhttpd/daemon.c | 52 +++++++++++++++++++++----------------------------
 1 file changed, 22 insertions(+), 30 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 9135af8c..35405f9f 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -6416,26 +6416,38 @@ parse_options_va (struct MHD_Daemon *daemon,
 #endif
       break;
     case MHD_OPTION_HTTPS_PRIORITIES:
+    case MHD_OPTION_HTTPS_PRIORITIES_APPEND:
       pstr = va_arg (ap,
                      const char *);
       if (0 != (daemon->options & MHD_USE_TLS))
       {
-        int init_res;
         if (NULL != daemon->priority_cache)
           gnutls_priority_deinit (daemon->priority_cache);
-        init_res = gnutls_priority_init (&daemon->priority_cache,
-                                         pstr,
-                                         NULL);
-        if (GNUTLS_E_SUCCESS != init_res)
+
+        if (MHD_OPTION_HTTPS_PRIORITIES == opt)
         {
+          int init_res;
+          init_res = gnutls_priority_init (&daemon->priority_cache,
+                                           pstr,
+                                           NULL);
+          if (GNUTLS_E_SUCCESS != init_res)
+          {
 #ifdef HAVE_MESSAGES
-          MHD_DLOG (daemon,
-                    _ ("Setting priorities to `%s' failed: %s\n"),
-                    pstr,
-                    gnutls_strerror (init_res));
+            MHD_DLOG (daemon,
+                      _ ("Setting priorities to `%s' failed: %s\n"),
+                      pstr,
+                      gnutls_strerror (init_res));
 #endif
+            daemon->priority_cache = NULL;
+            return MHD_NO;
+          }
+        }
+        else
+        {
+          /* The cache has been deinited */
           daemon->priority_cache = NULL;
-          return MHD_NO;
+          if (! daemon_tls_priorities_init_append (daemon, pstr))
+            return MHD_NO;
         }
       }
 #ifdef HAVE_MESSAGES
@@ -6444,26 +6456,6 @@ parse_options_va (struct MHD_Daemon *daemon,
                   _ ("MHD HTTPS option %d passed to MHD but " \
                      "MHD_USE_TLS not set.\n"),
                   opt);
-#endif
-      break;
-    case MHD_OPTION_HTTPS_PRIORITIES_APPEND:
-      pstr = va_arg (ap,
-                     const char *);
-      if (0 != (daemon->options & MHD_USE_TLS))
-      {
-        if (NULL != daemon->priority_cache)
-          gnutls_priority_deinit (daemon->priority_cache);
-        daemon->priority_cache = NULL;
-        /* The next function log error messages if needed */
-        if (! daemon_tls_priorities_init_append (daemon, pstr))
-          return MHD_NO;
-      }
-#ifdef HAVE_MESSAGES
-      else
-        MHD_DLOG (daemon,
-                  _ ("MHD HTTPS option %d passed to MHD but " \
-                     "MHD_USE_TLS not set.\n"),
-                  opt);
 #endif
       break;
     case MHD_OPTION_HTTPS_CERT_CALLBACK:

-- 
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]