Hello community,

here is the log from the commit of package ulfius for openSUSE:Factory checked 
in at 2019-08-16 15:51:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ulfius (Old)
 and      /work/SRC/openSUSE:Factory/.ulfius.new.22127 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ulfius"

Fri Aug 16 15:51:22 2019 rev:8 rq:724028 version:2.6.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/ulfius/ulfius.changes    2019-08-05 
10:38:28.127319447 +0200
+++ /work/SRC/openSUSE:Factory/.ulfius.new.22127/ulfius.changes 2019-08-16 
15:51:42.785568799 +0200
@@ -1,0 +2,16 @@
+Thu Aug  8 12:06:30 UTC 2019 - Martin Hauke <[email protected]>
+
+- Add "Requires: yder-devel" to ulfius-devel
+
+-------------------------------------------------------------------
+Mon Aug  5 06:24:32 UTC 2019 - Martin Hauke <[email protected]>
+
+- Update to version 2.6.3
+  * Fix warning appeared with gcc 9.1, fixes #128
+  * Make instance->mhd_response_copy_data useless if MHD>=0.9.61
+  * Fix MHD_start_daemon flag to reuse MHD_USE_THREAD_PER_CONNECTION
+    by default
+- Remove patch (fixed upstream):
+  * 0001-Cast-option-value-for-curl_easy_setopt-on-CURLOPT_PO.patch
+
+-------------------------------------------------------------------

Old:
----
  0001-Cast-option-value-for-curl_easy_setopt-on-CURLOPT_PO.patch
  ulfius-2.6.2.tar.gz

New:
----
  ulfius-2.6.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ulfius.spec ++++++
--- /var/tmp/diff_new_pack.ehtk8c/_old  2019-08-16 15:51:43.257568626 +0200
+++ /var/tmp/diff_new_pack.ehtk8c/_new  2019-08-16 15:51:43.261568624 +0200
@@ -19,14 +19,13 @@
 
 %define sover 2_6
 Name:           ulfius
-Version:        2.6.2
+Version:        2.6.3
 Release:        0
 Summary:        Web Framework for REST Applications in C
 License:        MIT
 Group:          Development/Languages/C and C++
 URL:            https://github.com/babelouest/ulfius
 Source:         
https://github.com/babelouest/ulfius/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
-Patch0:         0001-Cast-option-value-for-curl_easy_setopt-on-CURLOPT_PO.patch
 BuildRequires:  cmake
 BuildRequires:  gcc-c++
 BuildRequires:  pkgconfig
@@ -58,6 +57,7 @@
 Group:          Development/Libraries/C and C++
 Requires:       libulfius%{sover} = %{version}
 Requires:       orcania-devel
+Requires:       yder-devel
 
 %description devel
 Development and header files for libulfius.
@@ -71,7 +71,6 @@
 
 %prep
 %setup -q
-%patch0 -p1
 
 %build
 %cmake \

++++++ ulfius-2.6.2.tar.gz -> ulfius-2.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/.travis.yml new/ulfius-2.6.3/.travis.yml
--- old/ulfius-2.6.2/.travis.yml        2019-07-08 13:28:16.000000000 +0200
+++ new/ulfius-2.6.3/.travis.yml        2019-07-31 01:31:43.000000000 +0200
@@ -404,5 +404,6 @@
   - make clean debug GNUTLSFLAG=1 CURLFLAG=1
 
 # run tests with Makefile
+  - sudo ldconfig
   - make clean debug check
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/API.md new/ulfius-2.6.3/API.md
--- old/ulfius-2.6.2/API.md     2019-07-08 13:28:16.000000000 +0200
+++ new/ulfius-2.6.3/API.md     2019-07-31 01:31:43.000000000 +0200
@@ -82,7 +82,9 @@
 void o_get_alloc_funcs(o_malloc_t * malloc_fn, o_realloc_t * realloc_fn, 
o_free_t * free_fn);
 ```
 
-To link your program with Orcania library, add `-lorcania` to your linking 
command.
+Accessing those functions requires you to directly link your application also 
against the Orcania library. To do so, add `-lorcania` to your linking command.
+
+If you use a version of `libmicrohttpd` older than `0.9.61`, you need to set 
the `mhd_response_copy_data = 1` in your `_u_instance` if you use a memory 
allocator whose allocated return values may not directly be passed to free() or 
if you want to make sure all free() will always go via your user-provided free 
callback.
 
 Data structures allocated have their specific cleanup functions. To free 
pointer allocated, you should use the function `u_free` that is intended to use 
your memory management functions.
 
@@ -157,7 +159,8 @@
  * websocket_handler:      handler for the websocket structure
  * file_upload_callback:   callback function to manage file upload by blocks
  * file_upload_cls:        any pointer to pass to the file_upload_callback 
function
- * mhd_response_copy_data: to choose between MHD_RESPMEM_MUST_COPY and 
MHD_RESPMEM_MUST_FREE
+ * mhd_response_copy_data: to choose between MHD_RESPMEM_MUST_COPY and 
MHD_RESPMEM_MUST_FREE, only if you use MHD < 0.9.61, 
+ *                         otherwise this option is skipped because it's 
useless
  * check_utf8:             check that all parameters values in the request 
(url, header and post_body)
  *                         are valid utf8 strings, if a parameter value has 
non utf8 character, the value
  *                         will be ignored, default 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/CHANGELOG.md 
new/ulfius-2.6.3/CHANGELOG.md
--- old/ulfius-2.6.2/CHANGELOG.md       2019-07-08 13:28:16.000000000 +0200
+++ new/ulfius-2.6.3/CHANGELOG.md       2019-07-31 01:31:43.000000000 +0200
@@ -1,5 +1,11 @@
 # Ulfius Changelog
 
+## 2.6.3
+
+- Fix warning appeared with gcc 9.1, fixes #128
+- Make `instance->mhd_response_copy_data` useless if MHD>=0.9.61
+- Fix `MHD_start_daemon` flag to reuse `MHD_USE_THREAD_PER_CONNECTION` by 
default, fix #131, thanks laf0rge!
+
 ## 2.6.2
 
 - Clean build process
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/CMakeLists.txt 
new/ulfius-2.6.3/CMakeLists.txt
--- old/ulfius-2.6.2/CMakeLists.txt     2019-07-08 13:28:16.000000000 +0200
+++ new/ulfius-2.6.3/CMakeLists.txt     2019-07-31 01:31:43.000000000 +0200
@@ -30,7 +30,7 @@
 set(PROJECT_BUGREPORT_PATH "https://github.com/babelouest/ulfius/issues";)
 set(LIBRARY_VERSION_MAJOR "2")
 set(LIBRARY_VERSION_MINOR "6")
-set(LIBRARY_VERSION_PATCH "2")
+set(LIBRARY_VERSION_PATCH "3")
 
 set(PROJECT_VERSION 
"${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
 set(LIBRARY_VERSION 
"${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/include/ulfius.h 
new/ulfius-2.6.3/include/ulfius.h
--- old/ulfius-2.6.2/include/ulfius.h   2019-07-08 13:28:16.000000000 +0200
+++ new/ulfius-2.6.3/include/ulfius.h   2019-07-31 01:31:43.000000000 +0200
@@ -313,7 +313,8 @@
  * websocket_handler:      handler for the websocket structure
  * file_upload_callback:   callback function to manage file upload by blocks
  * file_upload_cls:        any pointer to pass to the file_upload_callback 
function
- * mhd_response_copy_data: to choose between MHD_RESPMEM_MUST_COPY and 
MHD_RESPMEM_MUST_FREE
+ * mhd_response_copy_data: to choose between MHD_RESPMEM_MUST_COPY and 
MHD_RESPMEM_MUST_FREE, only if you use MHD < 0.9.61, 
+ *                         otherwise this option is skipped because it's 
useless
  * check_utf8:             check that all parameters values in the request 
(url, header and post_body)
  *                         are valid utf8 strings, if a parameter value has 
non utf8 character, the value
  *                         will be ignored, default 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/src/Makefile 
new/ulfius-2.6.3/src/Makefile
--- old/ulfius-2.6.2/src/Makefile       2019-07-08 13:28:16.000000000 +0200
+++ new/ulfius-2.6.3/src/Makefile       2019-07-31 01:31:43.000000000 +0200
@@ -38,7 +38,7 @@
 endif
 OBJECTS=ulfius.o u_map.o u_request.o u_response.o u_send_request.o 
u_websocket.o yuarel.o
 OUTPUT=libulfius.so
-VERSION=2.6.2
+VERSION=2.6.3
 
 ifndef JANSSONFLAG
 DISABLE_JANSSON=0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/src/u_send_request.c 
new/ulfius-2.6.3/src/u_send_request.c
--- old/ulfius-2.6.2/src/u_send_request.c       2019-07-08 13:28:16.000000000 
+0200
+++ new/ulfius-2.6.3/src/u_send_request.c       2019-07-31 01:31:43.000000000 
+0200
@@ -370,13 +370,13 @@
             // Set body content
             if (copy_request->binary_body_length && copy_request->binary_body 
!= NULL) {
               if (copy_request->binary_body_length < 2147483648) {
-                if (curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, 
copy_request->binary_body_length) != CURLE_OK) {
+                if (curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, 
(curl_off_t)copy_request->binary_body_length) != CURLE_OK) {
                   y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error setting 
POST fields size");
                   ret = U_ERROR_LIBCURL;
                   break;
                 }
               } else {
-                if (curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE_LARGE, 
copy_request->binary_body_length) != CURLE_OK) {
+                if (curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE_LARGE, 
(curl_off_t)copy_request->binary_body_length) != CURLE_OK) {
                   y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error setting 
POST fields size large");
                   ret = U_ERROR_LIBCURL;
                   break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/src/ulfius.c 
new/ulfius-2.6.3/src/ulfius.c
--- old/ulfius-2.6.2/src/ulfius.c       2019-07-08 13:28:16.000000000 +0200
+++ new/ulfius-2.6.3/src/ulfius.c       2019-07-31 01:31:43.000000000 +0200
@@ -341,6 +341,12 @@
   }
 }
 
+#if MHD_VERSION >= 0x00096100
+  #define MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED(len, buf, flag) 
MHD_create_response_from_buffer_with_free_callback((len), (buf), &o_free)
+#else
+  #define MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED(len, buf, flag) 
MHD_create_response_from_buffer((len), (buf), (flag))
+#endif
+
 /**
  * ulfius_webservice_dispatcher
  * function executed by libmicrohttpd every time an HTTP call is made
@@ -496,7 +502,11 @@
       }
     }
     
+#if MHD_VERSION >= 0x00096100
     mhd_response_flag = ((struct _u_instance 
*)cls)->mhd_response_copy_data?MHD_RESPMEM_MUST_COPY:MHD_RESPMEM_MUST_FREE;
+#else
+    mhd_response_flag = MHD_RESPMEM_MUST_FREE;
+#endif
     if (current_endpoint_list[0] != NULL) {
       response = o_malloc(sizeof(struct _u_response));
       if (response == NULL) {
@@ -606,7 +616,7 @@
                         mhd_ret = MHD_NO;
                       } else {
                         response_buffer_len = o_strlen(ULFIUS_HTTP_ERROR_BODY);
-                        mhd_response = MHD_create_response_from_buffer 
(response_buffer_len, response_buffer, mhd_response_flag );
+                        mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
                       }
                       websocket_has_error = 1;
                     }
@@ -619,7 +629,7 @@
                       mhd_ret = MHD_NO;
                     } else {
                       response_buffer_len = o_strlen(ULFIUS_HTTP_ERROR_BODY);
-                      mhd_response = MHD_create_response_from_buffer 
(response_buffer_len, response_buffer, mhd_response_flag );
+                      mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
                     }
                     websocket_has_error = 1;
                   }
@@ -627,7 +637,7 @@
                   response->status = MHD_HTTP_BAD_REQUEST;
                   response_buffer = msprintf("%s%s", 
(ret_protocol!=U_OK?"Error validating protocol\n":""), 
(ret_extensions!=U_OK?"Error validating extensions":""));
                   y_log_message(Y_LOG_LEVEL_DEBUG, "Ulfius - Error websocket 
connection: %s", response_buffer);
-                  mhd_response = MHD_create_response_from_buffer 
(o_strlen(response_buffer), response_buffer, mhd_response_flag );
+                  mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(o_strlen(response_buffer), response_buffer, mhd_response_flag );
                   websocket_has_error = 1;
                 }
                 o_free(protocol);
@@ -643,7 +653,7 @@
                                            
o_strcmp(con_info->request->http_verb, "GET")!=0?"Method is not GET":"");
                 response->status = MHD_HTTP_BAD_REQUEST;
                 y_log_message(Y_LOG_LEVEL_DEBUG, "Ulfius - Error websocket 
connection: %s", response_buffer);
-                mhd_response = MHD_create_response_from_buffer 
(o_strlen(response_buffer), response_buffer, mhd_response_flag );
+                mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(o_strlen(response_buffer), response_buffer, mhd_response_flag );
                 websocket_has_error = 1;
               }
             } else {
@@ -655,7 +665,7 @@
                 mhd_ret = MHD_NO;
               } else {
                 response_buffer_len = o_strlen(ULFIUS_HTTP_ERROR_BODY);
-                mhd_response = MHD_create_response_from_buffer 
(response_buffer_len, response_buffer, mhd_response_flag );
+                mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
               }
               websocket_has_error = 1;
             }
@@ -680,7 +690,7 @@
                 close_loop = 1;
                 if (ulfius_get_body_from_response(response, &response_buffer, 
&response_buffer_len) == U_OK) {
                   // Build the response binary_body
-                  mhd_response = MHD_create_response_from_buffer 
(response_buffer_len, response_buffer, mhd_response_flag );
+                  mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
                   if (mhd_response == NULL) {
                     y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error 
MHD_create_response_from_buffer");
                     mhd_ret = MHD_NO;
@@ -697,7 +707,7 @@
                     mhd_ret = MHD_NO;
                   } else {
                     response_buffer_len = o_strlen(ULFIUS_HTTP_ERROR_BODY);
-                    mhd_response = MHD_create_response_from_buffer 
(response_buffer_len, response_buffer, mhd_response_flag );
+                    mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
                   }
                 }
                 break;
@@ -705,7 +715,7 @@
                 close_loop = 1;
                 // Wrong credentials, send status 401 and realm value if set
                 if (ulfius_get_body_from_response(response, &response_buffer, 
&response_buffer_len) == U_OK) {
-                  mhd_response = MHD_create_response_from_buffer 
(response_buffer_len, response_buffer, mhd_response_flag );
+                  mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
                   if (ulfius_set_response_header(mhd_response, 
response->map_header) == -1 || ulfius_set_response_cookie(mhd_response, 
response) == -1) {
                     inner_error = U_ERROR_PARAMS;
                     y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error setting 
headers or cookies");
@@ -729,7 +739,7 @@
                     mhd_ret = MHD_NO;
                   } else {
                     response_buffer_len = o_strlen(ULFIUS_HTTP_ERROR_BODY);
-                    mhd_response = MHD_create_response_from_buffer 
(response_buffer_len, response_buffer, mhd_response_flag );
+                    mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
                     inner_error = U_CALLBACK_UNAUTHORIZED;
                   }
                 }
@@ -749,7 +759,7 @@
                   mhd_ret = MHD_NO;
                 } else {
                   response_buffer_len = o_strlen(ULFIUS_HTTP_ERROR_BODY);
-                  mhd_response = MHD_create_response_from_buffer 
(response_buffer_len, response_buffer, mhd_response_flag );
+                  mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
                 }
                 break;
             }
@@ -782,14 +792,18 @@
         mhd_ret = MHD_NO;
       } else {
         response_buffer_len = o_strlen(ULFIUS_HTTP_NOT_FOUND_BODY);
-        mhd_response = MHD_create_response_from_buffer (response_buffer_len, 
response_buffer, mhd_response_flag );
+        mhd_response = MHD_CREATE_RESPONSE_FROM_BUFFER_PIMPED 
(response_buffer_len, response_buffer, mhd_response_flag );
         mhd_ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, 
mhd_response);
         MHD_destroy_response (mhd_response);
       }
     }
+#if MHD_VERSION < 0x00096100
     if (mhd_response_flag == MHD_RESPMEM_MUST_COPY) {
       o_free(response_buffer);
     }
+#else
+    (void)mhd_response_flag;
+#endif
     for (i=0; current_endpoint_list[i] != NULL; i++) {
       ulfius_clean_endpoint(current_endpoint_list[i]);
       o_free(current_endpoint_list[i]);
@@ -806,11 +820,7 @@
  * 
  */
 static struct MHD_Daemon * ulfius_run_mhd_daemon(struct _u_instance * 
u_instance, const char * key_pem, const char * cert_pem, const char * 
root_ca_perm) {
-#if MHD_VERSION < 0x00095208
   unsigned int mhd_flags = MHD_USE_THREAD_PER_CONNECTION;
-#else
-  unsigned int mhd_flags = MHD_USE_AUTO;
-#endif
   int index;
 
 #ifdef DEBUG
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ulfius-2.6.2/test/framework.c 
new/ulfius-2.6.3/test/framework.c
--- old/ulfius-2.6.2/test/framework.c   2019-07-08 13:28:16.000000000 +0200
+++ new/ulfius-2.6.3/test/framework.c   2019-07-31 01:31:43.000000000 +0200
@@ -502,6 +502,13 @@
   return U_CALLBACK_CONTINUE;
 }
 
+int via_free_with_test = 0;
+
+void free_with_test(void * ptr) {
+  via_free_with_test++;
+  free(ptr);
+}
+
 #ifndef U_DISABLE_GNUTLS
 int callback_auth_client_cert (const struct _u_request * request, struct 
_u_response * response, void * user_data) {
   char * dn;
@@ -1119,6 +1126,33 @@
 }
 END_TEST
 
+START_TEST(test_ulfius_MHD_set_response_with_other_free)
+{
+  struct _u_instance u_instance;
+  struct _u_request request;
+  struct _u_response response;
+  
+  o_set_alloc_funcs(&malloc, &realloc, &free_with_test);
+  ck_assert_int_eq(ulfius_init_instance(&u_instance, 8080, NULL, NULL), U_OK);
+  ck_assert_int_eq(ulfius_add_endpoint_by_val(&u_instance, "GET", "/", NULL, 
0, &callback_function_return_url, NULL), U_OK);
+  ck_assert_int_eq(ulfius_start_framework(&u_instance), U_OK);
+  
+  ulfius_init_request(&request);
+  request.http_url = o_strdup("http://localhost:8080/";);
+  ulfius_init_response(&response);
+  ck_assert_int_eq(ulfius_send_http_request(&request, &response), U_OK);
+  ck_assert_int_eq(response.status, 200);
+  ulfius_clean_request(&request);
+  ulfius_clean_response(&response);
+  
+  ulfius_stop_framework(&u_instance);
+  ulfius_clean_instance(&u_instance);
+  // We can only test that via_free_with_test has been incremented.
+  // The only way to know for sure now is to verify with valgrind and the 
memory consumption
+  ck_assert_int_gt(via_free_with_test, 1);
+}
+END_TEST
+
 #define PORT 2525
 #define FROM "from"
 #define TO "to"
@@ -1239,6 +1273,7 @@
   tcase_add_test(tc_core, test_ulfius_utf8_not_ignored);
   tcase_add_test(tc_core, test_ulfius_utf8_ignored);
   tcase_add_test(tc_core, test_ulfius_endpoint_callback_position);
+  tcase_add_test(tc_core, test_ulfius_MHD_set_response_with_other_free);
   tcase_add_test(tc_core, test_ulfius_send_smtp);
 #ifndef U_DISABLE_GNUTLS
   tcase_add_test(tc_core, test_ulfius_server_ca_trust);


Reply via email to