Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libupnp for openSUSE:Factory checked in at 2024-10-08 17:16:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libupnp (Old) and /work/SRC/openSUSE:Factory/.libupnp.new.19354 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libupnp" Tue Oct 8 17:16:54 2024 rev:37 rq:1206272 version:1.14.20 Changes: -------- --- /work/SRC/openSUSE:Factory/libupnp/libupnp.changes 2024-04-26 23:26:36.767505166 +0200 +++ /work/SRC/openSUSE:Factory/.libupnp.new.19354/libupnp.changes 2024-10-08 17:17:03.542656798 +0200 @@ -1,0 +2,8 @@ +Tue Oct 8 08:51:04 UTC 2024 - Jan Engelhardt <jeng...@inai.de> + +- Update to release 1.14.20 + * Add CORS header to avoid browser warnings + * Implement setting allow-origin in header + * Allow setting MaxJobsTotal for ThreadPools + +------------------------------------------------------------------- Old: ---- libupnp-1.14.19.tar.bz2 New: ---- _scmsync.obsinfo build.specials.obscpio libupnp-1.14.20.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libupnp.spec ++++++ --- /var/tmp/diff_new_pack.AlgJos/_old 2024-10-08 17:17:04.094679895 +0200 +++ /var/tmp/diff_new_pack.AlgJos/_new 2024-10-08 17:17:04.094679895 +0200 @@ -20,7 +20,7 @@ %define pnpver 17 %define ixmlver 11 Name: libupnp -Version: 1.14.19 +Version: 1.14.20 Release: 0 Summary: An implementation of Universal Plug and Play (UPnP) License: BSD-3-Clause ++++++ _scmsync.obsinfo ++++++ mtime: 1728377855 commit: 00d1ecd9106189fa4f71f17629eefe37acee255a8a80ec6179b8c28e20a1ca57 url: https://src.opensuse.org/jengelh/libupnp revision: master ++++++ libupnp-1.14.19.tar.bz2 -> libupnp-1.14.20.tar.bz2 ++++++ ++++ 7902 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/ChangeLog new/libupnp-1.14.20/ChangeLog --- old/libupnp-1.14.19/ChangeLog 2024-04-22 20:38:20.000000000 +0200 +++ new/libupnp-1.14.20/ChangeLog 2024-10-07 23:29:24.000000000 +0200 @@ -9,6 +9,35 @@ Aborted. ******************************************************************************* +Version 1.14.20 +******************************************************************************* + +2024-10-03 Vollstrecker <werner(at)vollstreckernet.de> + + - ixml has its own version + +2024-07-09 Karlchen <k_straussberger(at)netzland.net> + + - Add CORS header to avoid browser warnings + - Add new API call + - Add internal function + - Implement setting allow-origin in header + - Implement new API call + - Headers do not have to be quoted + - Allow setting MaxJobsTotal for ThreadPools + +2024-06-29 Rosen Penev <rosenp(at)gmail.com> + + - fix formats under newer newer MSVC + - fix 32-bit format warnings + +2024-04-25 Marcelo Roberto Jimenez <mroberto(at)users.sourceforge.net> + + - Fixes broken cmake regex + - Fixes cmake redefinition warnings + + +******************************************************************************* Version 1.14.19 ******************************************************************************* @@ -63,7 +92,7 @@ 1- When sending Action(Ex)Async The ActionRequest document was not released nor was the ActionResult. - I initially tought that this should be done in + I initially thought that this should be done in UpnpActionComplete::UpnpActionComplete_delete() but I was wrong because ActionRequest and ActionResult do not "belong" to the Evt object. The sets methods only set a pointer and modifying generator.c is not the @@ -125,7 +154,7 @@ don't use strxxx_s on Windows The use of these fails as 2nd argument is the same as 4th argument. - Reading the cpp_reference defintions of these, it can't be right. + Reading the cpp_reference definitions of these, it can't be right. 2022-09-20 Rex Cheung <93339127+rexcheung21(at)users.noreply.github.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/README.md new/libupnp-1.14.20/README.md --- old/libupnp-1.14.19/README.md 2024-04-22 20:43:56.000000000 +0200 +++ new/libupnp-1.14.20/README.md 2024-10-07 23:11:48.000000000 +0200 @@ -102,7 +102,8 @@ | -------------- | ---------- | ---------------------------------------- | | 1.18.0 | TBA ? | [Portable UPnP SDK][Portable UPnP SDK] | | 1.16.0 | aborted | [Portable UPnP SDK][Portable UPnP SDK] | -| 1.14.20 | TBA | [Portable UPnP SDK][Portable UPnP SDK] | +| 1.14.21 | TBA | [Portable UPnP SDK][Portable UPnP SDK] | +| 1.14.20 | 2024-10-07 | [Portable UPnP SDK][Portable UPnP SDK] | | 1.14.19 | 2024-04-22 | [Portable UPnP SDK][Portable UPnP SDK] | | 1.14.18 | 2023-08-21 | [Portable UPnP SDK][Portable UPnP SDK] | | 1.14.17 | 2023-04-30 | [Portable UPnP SDK][Portable UPnP SDK] | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/UPNP.cmake.in new/libupnp-1.14.20/UPNP.cmake.in --- old/libupnp-1.14.19/UPNP.cmake.in 2022-08-03 16:14:24.000000000 +0200 +++ new/libupnp-1.14.20/UPNP.cmake.in 2024-10-06 00:15:12.000000000 +0200 @@ -2,7 +2,7 @@ INCLUDE (CMakeFindDependencyMacro) CHECK_REQUIRED_COMPONENTS (UPNP) -FIND_DEPENDENCY (IXML @PUPNP_VERSION_STRING@) +FIND_DEPENDENCY (IXML @IXML_VERSION_STRING@) INCLUDE (${CMAKE_CURRENT_LIST_DIR}/UPNP.cmake) SET (UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS @UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS@ CACHE INTERNAL "see.upnpconfig.h") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/autoconfig.h.in new/libupnp-1.14.20/autoconfig.h.in --- old/libupnp-1.14.19/autoconfig.h.in 2024-04-22 20:45:06.000000000 +0200 +++ new/libupnp-1.14.20/autoconfig.h.in 2024-10-07 23:38:00.000000000 +0200 @@ -12,13 +12,13 @@ /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* Define to 1 if you don't have 'vprintf' but do have '_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +/* Define to 1 if fseeko (and ftello) are declared in stdio.h. */ #undef HAVE_FSEEKO /* Define to 1 if you have the <inttypes.h> header file. */ @@ -81,7 +81,7 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* Define to 1 if you have the `vprintf' function. */ +/* Define to 1 if you have the 'vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if you have the <ws2tcpip.h> header file. */ @@ -125,7 +125,7 @@ your system. */ #undef PTHREAD_CREATE_JOINABLE -/* Define to 1 if all of the C90 standard headers exist (not just the ones +/* Define to 1 if all of the C89 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS @@ -212,16 +212,22 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* Define to 1 if necessary to make fseeko visible. */ #undef _LARGEFILE_SOURCE -/* Define for large files, on AIX-style hosts. */ +/* Define to 1 on platforms where this makes off_t a 64-bit type. */ #undef _LARGE_FILES -/* Define to empty if `const' does not conform to ANSI C. */ +/* Number of bits in time_t, on hosts where this is settable. */ +#undef _TIME_BITS + +/* Define to 1 on platforms where this makes time_t a 64-bit type. */ +#undef __MINGW_USE_VC2005_COMPAT + +/* Define to empty if 'const' does not conform to ANSI C. */ #undef const -/* Define to `unsigned int' if <sys/types.h> does not define. */ +/* Define as 'unsigned int' if <stddef.h> doesn't define. */ #undef size_t /* Type for storing the length of struct sockaddr */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/cmake/autoheader.cmake new/libupnp-1.14.20/cmake/autoheader.cmake --- old/libupnp-1.14.19/cmake/autoheader.cmake 2022-08-03 16:14:24.000000000 +0200 +++ new/libupnp-1.14.20/cmake/autoheader.cmake 2024-04-26 22:53:14.000000000 +0200 @@ -18,9 +18,11 @@ string (REGEX REPLACE ";" "" line ${line}) string (REGEX REPLACE "[ \t\r\n] *" " " line ${line}) - if (line MATCHES "AC_INIT.* ([0-9]*\\.[0-9]*\\.[0-9]*).*") - message (STATUS "Setting package-version to ${CMAKE_MATCH_1}") - set (PUPNP_VERSION_STRING ${CMAKE_MATCH_1} CACHE STRING "Version of the whole package" FORCE) + if (line MATCHES "AC_INIT\\\(([^,]*),([0-9]+\.[0-9]+\.[0-9]+)([^\)]*)\\\)") + message (STATUS "Setting package-version to ${CMAKE_MATCH_2}") + set (PUPNP_VERSION_STRING ${CMAKE_MATCH_2} CACHE STRING "Version of the whole package" FORCE) + #message (STATUS "Extracted package name is ${CMAKE_MATCH_1}") + #message (STATUS "Left from parsing: ${CMAKE_MATCH_3}") elseif (line MATCHES "[. \t]*AC_DEFINE_UNQUOTED *\\(([^,]*), *([^,]*), *([^\\)]*)") set (SAVED_MATCH ${CMAKE_MATCH_1}) @@ -76,3 +78,4 @@ endforeach() endforeach() endif() +message (STATUS "package-version is ${PUPNP_VERSION_STRING}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/configure.ac new/libupnp-1.14.20/configure.ac --- old/libupnp-1.14.19/configure.ac 2024-02-13 17:40:23.000000000 +0100 +++ new/libupnp-1.14.20/configure.ac 2024-07-09 21:56:42.000000000 +0200 @@ -9,7 +9,7 @@ AC_PREREQ([2.60]) -AC_INIT([libupnp],[1.14.19],[mrobe...@users.sourceforge.net]) +AC_INIT([libupnp],[1.14.20],[mrobe...@users.sourceforge.net]) dnl ############################################################################ dnl # *Independently* of the above libupnp package version, the libtool version dnl # of the 3 libraries need to be updated whenever there is a change released: @@ -249,8 +249,22 @@ dnl #AC_SUBST([LT_VERSION_UPNP], [18:10:1]) dnl # dnl ############################################################################ +dnl # Release 1.14.20 +dnl # "current:revision:age" +dnl # +dnl # - Code has changed in upnp +dnl # revision: 10 -> 11 +dnl # - interfaces changed/added/removed: current++ and revision=0 +dnl # current: 18 -> 19 +dnl # revision 11 -> 0 +dnl # - interfaces added: age++ +dnl # age: 1 -> 2 +dnl #AC_SUBST([LT_VERSION_IXML], [12:2:1]) +dnl #AC_SUBST([LT_VERSION_UPNP], [18:11:1]) +dnl # +dnl ############################################################################ AC_SUBST([LT_VERSION_IXML], [12:2:1]) -AC_SUBST([LT_VERSION_UPNP], [18:10:1]) +AC_SUBST([LT_VERSION_UPNP], [19:0:2]) dnl ############################################################################ dnl # Repeating the algorithm to place it closer to the modificatin place: dnl # - library code modified: revision++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/docs/Doxyfile new/libupnp-1.14.20/docs/Doxyfile --- old/libupnp-1.14.19/docs/Doxyfile 2023-08-21 23:46:18.000000000 +0200 +++ new/libupnp-1.14.20/docs/Doxyfile 2024-04-22 20:54:10.000000000 +0200 @@ -38,7 +38,7 @@ # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.14.19 +PROJECT_NUMBER = 1.14.20 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/libupnp.spec new/libupnp-1.14.20/libupnp.spec --- old/libupnp-1.14.19/libupnp.spec 2023-08-21 23:46:33.000000000 +0200 +++ new/libupnp-1.14.20/libupnp.spec 2024-04-22 20:54:20.000000000 +0200 @@ -1,4 +1,4 @@ -Version: 1.14.19 +Version: 1.14.20 Summary: Universal Plug and Play (UPnP) SDK Name: libupnp-1.14 Release: 1%{?dist} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/inc/UpnpGlobal.h new/libupnp-1.14.20/upnp/inc/UpnpGlobal.h --- old/libupnp-1.14.19/upnp/inc/UpnpGlobal.h 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/inc/UpnpGlobal.h 2024-07-08 02:29:08.000000000 +0200 @@ -44,12 +44,19 @@ * PRIzx */ #ifdef UPNP_USE_MSVCPP - /* define some things the M$ VC++ doesn't know */ - #define UPNP_INLINE _inline + #if _MSC_VER > 1900 + #define UPNP_INLINE inline + #define PRIzd "zd" + #define PRIzu "zu" + #define PRIzx "zx" + #else + /* define some things the M$ VC++ doesn't know */ + #define UPNP_INLINE _inline typedef __int64 int64_t; - #define PRIzd "ld" - #define PRIzu "lu" - #define PRIzx "lx" + #define PRIzd "ld" + #define PRIzu "lu" + #define PRIzx "lx" + #endif #endif /* UPNP_USE_MSVCPP */ #ifdef UPNP_USE_BCBPP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/inc/upnp.h new/libupnp-1.14.20/upnp/inc/upnp.h --- old/libupnp-1.14.19/upnp/inc/upnp.h 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/inc/upnp.h 2024-07-09 21:44:56.000000000 +0200 @@ -2804,6 +2804,21 @@ UPNP_EXPORT_SPEC void UpnpSetAllowLiteralHostRedirection(int enable); /*! + * \brief Assign the Access-Control-Allow-Origin specfied by the input + * const char* cors_string parameterto the global CORS string + * + * \note This function is not available when the web server is not compiled + * into the UPnP Library. + * + * \return An integer representing one of the following: + * \li \c UPNP_E_SUCCESS: The operation completed successfully. + * \li \c UPNP_E_INVALID_ARGUMENT: \b rootDir is an invalid directory. + */ +UPNP_EXPORT_SPEC int UpnpSetWebServerCorsString( + /*! [in] String having the Access-Control-Allow-Origin string. */ + const char *corsString); + +/*! * \brief Adds a virtual directory mapping. * * All webserver requests containing the given directory are read using diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/inc/upnpconfig.h.cm new/libupnp-1.14.20/upnp/inc/upnpconfig.h.cm --- old/libupnp-1.14.19/upnp/inc/upnpconfig.h.cm 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/inc/upnpconfig.h.cm 2024-04-26 23:08:01.000000000 +0200 @@ -38,18 +38,22 @@ ***************************************************************************/ /** The library version (string) e.g. "1.3.0" */ +#undef UPNP_VERSION_STRING #cmakedefine UPNP_VERSION_STRING "${UPNP_VERSION_STRING}" /** Major version of the library */ +#undef UPNP_VERSION_MAJOR #cmakedefine UPNP_VERSION_MAJOR ${UPNP_VERSION_MAJOR} /** Minor version of the library */ +#undef UPNP_VERSION_MINOR #cmakedefine UPNP_VERSION_MINOR ${UPNP_VERSION_MINOR} #ifndef UPNP_VERSION_MINOR # define UPNP_VERSION_MINOR 0 #endif /** Patch version of the library */ +#undef UPNP_VERSION_PATCH #cmakedefine UPNP_VERSION_PATCH ${UPNP_VERSION_PATCH} #ifndef UPNP_VERSION_PATCH # define UPNP_VERSION_PATCH 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/inc/upnptools.h new/libupnp-1.14.20/upnp/inc/upnptools.h --- old/libupnp-1.14.19/upnp/inc/upnptools.h 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/inc/upnptools.h 2024-10-06 00:23:23.000000000 +0200 @@ -57,6 +57,13 @@ #endif /*! + * \brief Sets the maximum number of jobs in the internal thread pool. + * This option is intended for server applications to avoid an overflow of + * jobs when serving e.g. many web requests. + */ +UPNP_EXPORT_SPEC void UpnpSetMaxJobsTotal(int mjt); + +/*! * \brief Converts an SDK error code into a string error message suitable for * display. The memory returned from this function should NOT be freed. * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/api/upnpapi.c new/libupnp-1.14.20/upnp/src/api/upnpapi.c --- old/libupnp-1.14.19/upnp/src/api/upnpapi.c 2024-02-23 23:06:14.000000000 +0100 +++ new/libupnp-1.14.20/upnp/src/api/upnpapi.c 2024-10-06 00:23:23.000000000 +0200 @@ -190,6 +190,9 @@ /*! a local dir which serves as webserver root */ extern membuffer gDocumentRootDir; +/*! a string which is set in the header field */ +extern membuffer gWebserverCorsString; + /*! Maximum content-length (in bytes) that the SDK will process on an incoming * packet. Content-Length exceeding this size will be not processed and * error 413 (HTTP Error Code) will be returned to the remote end point. */ @@ -361,7 +364,7 @@ TPAttrSetStackSize(&attr, THREAD_STACK_SIZE); TPAttrSetJobsPerThread(&attr, JOBS_PER_THREAD); TPAttrSetIdleTime(&attr, THREAD_IDLE_TIME); - TPAttrSetMaxJobsTotal(&attr, MAX_JOBS_TOTAL); + TPAttrSetMaxJobsTotal(&attr, maxJobsTotal); if (ThreadPoolInit(&gSendThreadPool, &attr) != UPNP_E_SUCCESS) { ret = UPNP_E_INIT_FAILED; @@ -516,6 +519,7 @@ #if EXCLUDE_WEB_SERVER == 0 membuffer_init(&gDocumentRootDir); + membuffer_init(&gWebserverCorsString); retVal = UpnpEnableWebserver(WEB_SERVER_ENABLED); if (retVal != UPNP_E_SUCCESS) { UpnpFinish(); @@ -4319,6 +4323,19 @@ return web_server_set_root_dir(rootDir); } + +int UpnpSetWebServerCorsString(const char *corsString) +{ + if (UpnpSdkInit == 0) + return UPNP_E_FINISH; + if ((corsString == NULL) || (strlen(corsString) == 0)) { + return UPNP_E_INVALID_PARAM; + } + + membuffer_destroy(&gWebserverCorsString); + + return web_server_set_cors(corsString); +} #endif /* INTERNAL_WEB_SERVER */ int UpnpAddVirtualDir( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/api/upnptools.c new/libupnp-1.14.20/upnp/src/api/upnptools.c --- old/libupnp-1.14.19/upnp/src/api/upnptools.c 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/src/api/upnptools.c 2024-10-06 00:23:23.000000000 +0200 @@ -40,6 +40,8 @@ #include "upnp.h" #include "upnptools.h" + #include "ThreadPool.h" + #include "uri.h" #include <stdarg.h> @@ -125,6 +127,8 @@ return "Unknown error code"; } +void UpnpSetMaxJobsTotal(int mjt) { TPSetMaxJobsTotal(mjt); } + /*! * \todo There is some unnecessary allocation and deallocation going on here * because of the way resolve_rel_url() was originally written and used. In the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/gena/gena_device.c new/libupnp-1.14.20/upnp/src/gena/gena_device.c --- old/libupnp-1.14.19/upnp/src/gena/gena_device.c 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/src/gena/gena_device.c 2024-07-08 02:29:08.000000000 +0200 @@ -449,7 +449,7 @@ "%s%s%" PRIzu "%s%s%s", HEADER_LINE_1, HEADER_LINE_2A, - (unsigned long)strlen(propertySet) + 2, + strlen(propertySet) + 2, HEADER_LINE_2B, HEADER_LINE_3, HEADER_LINE_4); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/genlib/net/http/httpreadwrite.c new/libupnp-1.14.20/upnp/src/genlib/net/http/httpreadwrite.c --- old/libupnp-1.14.19/upnp/src/genlib/net/http/httpreadwrite.c 2024-04-22 20:26:46.000000000 +0200 +++ new/libupnp-1.14.20/upnp/src/genlib/net/http/httpreadwrite.c 2024-07-09 21:44:56.000000000 +0200 @@ -630,7 +630,7 @@ rc = snprintf(Chunk_Header, sizeof(Chunk_Header), "%" PRIzx "\r\n", - (unsigned long)num_read); + num_read); if (rc < 0 || (unsigned int)rc >= sizeof(Chunk_Header)) { @@ -1734,9 +1734,24 @@ goto error_handler; } else if (c == 'K') { /* Add Chunky header */ - if (membuffer_append(buf, - "TRANSFER-ENCODING: chunked\r\n", - strlen("Transfer-Encoding: chunked\r\n"))) + if (membuffer_append_str( + buf, "TRANSFER-ENCODING: chunked\r\n")) + goto error_handler; + } else if (c == 'A') { + /* Add Access-Control-Allow-Origin header only if + * set by UpnpSetWebServerCorsString */ + struct SendInstruction *RespInstr; + RespInstr = (struct SendInstruction *)va_arg( + argp, struct SendInstruction *); + assert(RespInstr); + if (RespInstr->CorsHeader && + strcmp(RespInstr->CorsHeader, "") && + http_MakeMessage(buf, + http_major_version, + http_minor_version, + "ssc", + "Access-Control-Allow-Origin: ", + RespInstr->CorsHeader) != 0) goto error_handler; } else if (c == 'G') { /* Add Range header */ @@ -1769,10 +1784,7 @@ } else if (c == 'd') { /* integer */ num = (size_t)va_arg(argp, int); - rc = snprintf(tempbuf, - sizeof(tempbuf), - "%" PRIzu, - (unsigned long)num); + rc = snprintf(tempbuf, sizeof(tempbuf), "%" PRIzu, num); if (rc < 0 || (unsigned int)rc >= sizeof(tempbuf) || membuffer_append(buf, tempbuf, strlen(tempbuf))) goto error_handler; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/genlib/net/http/webserver.c new/libupnp-1.14.20/upnp/src/genlib/net/http/webserver.c --- old/libupnp-1.14.19/upnp/src/genlib/net/http/webserver.c 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/src/genlib/net/http/webserver.c 2024-07-09 21:44:56.000000000 +0200 @@ -231,6 +231,8 @@ /*! Global variable. A local dir which serves as webserver root. */ membuffer gDocumentRootDir; +/*! Global variable. A string which is set in the header field. */ +membuffer gWebserverCorsString; /*! XML document. */ static struct xml_alias_t gAliasDoc; @@ -475,6 +477,7 @@ /* decode media list */ media_list_init(); membuffer_init(&gDocumentRootDir); + membuffer_init(&gWebserverCorsString); glob_alias_init(); pVirtualDirList = NULL; @@ -499,6 +502,7 @@ { if (bWebServerState == WEB_SERVER_ENABLED) { membuffer_destroy(&gDocumentRootDir); + membuffer_destroy(&gWebserverCorsString); alias_release(&gAliasDoc); ithread_mutex_lock(&gWebMutex); @@ -606,6 +610,17 @@ return 0; } +int web_server_set_cors(const char *cors_string) +{ + int ret; + + ret = membuffer_assign_str(&gWebserverCorsString, cors_string); + if (ret != 0) + return ret; + + return 0; +} + /*! * \brief Compare the files names between the one on the XML alias the one * passed in as the input parameter. If equal extract file information. @@ -1367,6 +1382,9 @@ /* goto error_handler; */ /* } */ } + RespInstr->CorsHeader = (gWebserverCorsString.length > 0) + ? gWebserverCorsString.buf + : NULL; RespInstr->ReadSendSize = UpnpFileInfo_get_FileLength(finfo); /* Check other header field. */ code = CheckOtherHTTPHeaders( @@ -1405,7 +1423,7 @@ resp_minor, "R" "T" - "GKLD" + "GKLAD" "s" "tcS" "Xc" @@ -1415,6 +1433,7 @@ finfo), /* content type */ RespInstr, /* range info */ RespInstr, /* language info */ + RespInstr, /* Access-Control-Allow-Origin */ "LAST-MODIFIED: ", &aux_LastModified, X_USER_AGENT, @@ -1429,7 +1448,7 @@ "R" "N" "T" - "GLD" + "GLAD" "s" "tcS" "Xc" @@ -1440,6 +1459,7 @@ finfo), /* content type */ RespInstr, /* range info */ RespInstr, /* language info */ + RespInstr, /* Access-Control-Allow-Origin */ "LAST-MODIFIED: ", &aux_LastModified, X_USER_AGENT, @@ -1452,7 +1472,7 @@ resp_major, resp_minor, "RK" - "TLD" + "TLAD" "s" "tcS" "Xc" @@ -1461,6 +1481,7 @@ UpnpFileInfo_get_ContentType( finfo), /* content type */ RespInstr, /* language info */ + RespInstr, /* Access-Control-Allow-Origin */ "LAST-MODIFIED: ", &aux_LastModified, X_USER_AGENT, @@ -1475,7 +1496,7 @@ resp_minor, "R" "N" - "TLD" + "TLAD" "s" "tcS" "Xc" @@ -1486,6 +1507,7 @@ UpnpFileInfo_get_ContentType( finfo), /* content type */ RespInstr, /* language info */ + RespInstr, /* Access-Control-Allow-Origin */ "LAST-MODIFIED: ", &aux_LastModified, X_USER_AGENT, @@ -1498,7 +1520,7 @@ resp_major, resp_minor, "R" - "TLD" + "TLAD" "s" "tcS" "Xc" @@ -1507,6 +1529,7 @@ UpnpFileInfo_get_ContentType( finfo), /* content type */ RespInstr, /* language info */ + RespInstr, /* Access-Control-Allow-Origin */ "LAST-MODIFIED: ", &aux_LastModified, X_USER_AGENT, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/inc/webserver.h new/libupnp-1.14.20/upnp/src/inc/webserver.h --- old/libupnp-1.14.19/upnp/src/inc/webserver.h 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/src/inc/webserver.h 2024-07-09 21:44:56.000000000 +0200 @@ -53,6 +53,8 @@ off_t ReadSendSize; /*! Recv from the network and write into local file. */ long RecvWriteSize; + /*! CorsHeader. */ + const void *CorsHeader; /*! Cookie associated with the virtualDir. */ const void *Cookie; /*! Cookie associated with the request. */ @@ -116,6 +118,16 @@ const char *root_dir); /*! + * \brief Assign the Access-Control-Allow-Origin specfied by the input + * const char* cors_string parameterto the global CORS string + * + * \return Integer. + */ +int web_server_set_cors( + /*! [in] String having the Access-Control-Allow-Origin string. */ + const char *cors_string); + +/*! * \brief Main entry point into web server; Handles HTTP GET and HEAD * requests. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/soap/soap_device.c new/libupnp-1.14.20/upnp/src/soap/soap_device.c --- old/libupnp-1.14.19/upnp/src/soap/soap_device.c 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/src/soap/soap_device.c 2024-07-09 22:09:43.000000000 +0200 @@ -613,9 +613,10 @@ /* check service type */ if (value.buf[0] != '\"') { - goto error_handler; + serv_type = &value.buf[0]; + } else { + serv_type = &value.buf[1]; } - serv_type = &value.buf[1]; col_pos1 = strrchr(serv_type, ':'); if (NULL == col_pos1) { goto error_handler; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/threadutil/ThreadPool.c new/libupnp-1.14.20/upnp/src/threadutil/ThreadPool.c --- old/libupnp-1.14.19/upnp/src/threadutil/ThreadPool.c 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/src/threadutil/ThreadPool.c 2024-10-06 00:23:23.000000000 +0200 @@ -1067,6 +1067,10 @@ return 0; } +int maxJobsTotal = DEFAULT_MAX_JOBS_TOTAL; + +void TPSetMaxJobsTotal(int mjt) { maxJobsTotal = mjt; } + int TPAttrInit(ThreadPoolAttr *attr) { if (!attr) @@ -1078,7 +1082,7 @@ attr->stackSize = DEFAULT_STACK_SIZE; attr->schedPolicy = DEFAULT_POLICY; attr->starvationTime = DEFAULT_STARVATION_TIME; - attr->maxJobsTotal = DEFAULT_MAX_JOBS_TOTAL; + attr->maxJobsTotal = maxJobsTotal; return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libupnp-1.14.19/upnp/src/threadutil/ThreadPool.h new/libupnp-1.14.20/upnp/src/threadutil/ThreadPool.h --- old/libupnp-1.14.19/upnp/src/threadutil/ThreadPool.h 2024-02-19 20:47:15.000000000 +0100 +++ new/libupnp-1.14.20/upnp/src/threadutil/ThreadPool.h 2024-10-06 00:23:23.000000000 +0200 @@ -120,6 +120,7 @@ /*! default max jobs used TPAttrInit */ #define DEFAULT_MAX_JOBS_TOTAL 100 +extern int maxJobsTotal; /*! * \brief Statistics. @@ -250,6 +251,13 @@ } ThreadPool; /*! + * \brief Sets the maximum number of jobs in the thread pool. + * This option is intended for server applications to avoid an overflow of + * jobs when serving e.g. many web requests. + */ +void TPSetMaxJobsTotal(int mjt); + +/*! * \brief Initializes and starts ThreadPool. Must be called first and * only once for ThreadPool. *