* [Buildroot] [PATCH 2/5] package/kodi: fix build with libmicrohttpd 0.9.71
2020-07-05 10:12 [Buildroot] [PATCH 1/5] package/libhttpserver: bump version to 0.18.1 Bernd Kuhls
@ 2020-07-05 10:12 ` Bernd Kuhls
2020-07-20 6:46 ` Peter Korsgaard
2020-07-05 10:12 ` [Buildroot] [PATCH 3/5] package/libhttpserver: " Bernd Kuhls
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Bernd Kuhls @ 2020-07-05 10:12 UTC (permalink / raw)
To: buildroot
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
...patibility-with-libmicrohttpd-0.9.71.patch | 469 ++++++++++++++++++
1 file changed, 469 insertions(+)
create mode 100644 package/kodi/0003-webserver-Compatibility-with-libmicrohttpd-0.9.71.patch
diff --git a/package/kodi/0003-webserver-Compatibility-with-libmicrohttpd-0.9.71.patch b/package/kodi/0003-webserver-Compatibility-with-libmicrohttpd-0.9.71.patch
new file mode 100644
index 0000000000..04f57b41fc
--- /dev/null
+++ b/package/kodi/0003-webserver-Compatibility-with-libmicrohttpd-0.9.71.patch
@@ -0,0 +1,469 @@
+From 206f55e78f3a5ad39fad17526d01558677f9477a Mon Sep 17 00:00:00 2001
+From: Craig Andrews <candrews@integralblue.com>
+Date: Sat, 4 Jul 2020 11:01:37 +0200
+Subject: [PATCH] [webserver] Compatibility with libmicrohttpd 0.9.71
+
+From the libmicrohttpd 0.9.71 release notes:
+
+The release introduces an 'enum MHD_Result' instead of
+for certain API misuse bugs by providing better types (not everything is
+an 'int'). While this does NOT change the binary API, this change
+_will_ cause compiler warnings for all legacy code -- until 'int' is
+replaced with 'enum MHD_Result'.
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+[downloaded from upstream PR 18134]
+---
+ xbmc/network/WebServer.cpp | 42 +++++++++----------
+ xbmc/network/WebServer.h | 30 ++++++-------
+ .../httprequesthandler/HTTPFileHandler.cpp | 2 +-
+ .../httprequesthandler/HTTPFileHandler.h | 2 +-
+ .../HTTPImageTransformationHandler.cpp | 2 +-
+ .../HTTPImageTransformationHandler.h | 2 +-
+ .../httprequesthandler/HTTPJsonRpcHandler.cpp | 2 +-
+ .../httprequesthandler/HTTPJsonRpcHandler.h | 2 +-
+ .../httprequesthandler/HTTPPythonHandler.cpp | 2 +-
+ .../httprequesthandler/HTTPPythonHandler.h | 2 +-
+ .../HTTPRequestHandlerUtils.cpp | 4 +-
+ .../HTTPRequestHandlerUtils.h | 4 +-
+ .../HTTPWebinterfaceAddonsHandler.cpp | 2 +-
+ .../HTTPWebinterfaceAddonsHandler.h | 2 +-
+ .../httprequesthandler/IHTTPRequestHandler.h | 10 ++++-
+ 15 files changed, 59 insertions(+), 51 deletions(-)
+
+diff --git a/xbmc/network/WebServer.cpp b/xbmc/network/WebServer.cpp
+index 783404227785..be507131092b 100644
+--- a/xbmc/network/WebServer.cpp
++++ b/xbmc/network/WebServer.cpp
+@@ -86,7 +86,7 @@ static MHD_Response* create_response(size_t size, const void* data, int free, in
+ return MHD_create_response_from_buffer(size, const_cast<void*>(data), mode);
+ }
+
+-int CWebServer::AskForAuthentication(const HTTPRequest& request) const
++MHD_RESULT CWebServer::AskForAuthentication(const HTTPRequest& request) const
+ {
+ struct MHD_Response *response = create_response(0, nullptr, MHD_NO, MHD_NO);
+ if (!response)
+@@ -95,7 +95,7 @@ int CWebServer::AskForAuthentication(const HTTPRequest& request) const
+ return MHD_NO;
+ }
+
+- int ret = AddHeader(response, MHD_HTTP_HEADER_CONNECTION, "close");
++ MHD_RESULT ret = AddHeader(response, MHD_HTTP_HEADER_CONNECTION, "close");
+ if (!ret)
+ {
+ CLog::Log(LOGERROR, "CWebServer[%hu]: unable to prepare HTTP Unauthorized response", m_port);
+@@ -105,7 +105,7 @@ int CWebServer::AskForAuthentication(const HTTPRequest& request) const
+
+ LogResponse(request, MHD_HTTP_UNAUTHORIZED);
+
+- ret = MHD_queue_basic_auth_fail_response(request.connection, "XBMC", response);
++ ret = (MHD_RESULT) MHD_queue_basic_auth_fail_response(request.connection, "XBMC", response);
+ MHD_destroy_response(response);
+
+ return ret;
+@@ -135,7 +135,7 @@ bool CWebServer::IsAuthenticated(const HTTPRequest& request) const
+ return authenticated;
+ }
+
+-int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection,
++MHD_RESULT CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection,
+ const char *url, const char *method,
+ const char *version, const char *upload_data,
+ size_t *upload_data_size, void **con_cls)
+@@ -163,7 +163,7 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection,
+ return webServer->HandlePartialRequest(connection, connectionHandler, request, upload_data, upload_data_size, con_cls);
+ }
+
+-int CWebServer::HandlePartialRequest(struct MHD_Connection *connection, ConnectionHandler* connectionHandler, const HTTPRequest& request, const char *upload_data, size_t *upload_data_size, void **con_cls)
++MHD_RESULT CWebServer::HandlePartialRequest(struct MHD_Connection *connection, ConnectionHandler* connectionHandler, const HTTPRequest& request, const char *upload_data, size_t *upload_data_size, void **con_cls)
+ {
+ std::unique_ptr<ConnectionHandler> conHandler(connectionHandler);
+
+@@ -276,7 +276,7 @@ int CWebServer::HandlePartialRequest(struct MHD_Connection *connection, Connecti
+ return SendErrorResponse(request, MHD_HTTP_NOT_FOUND, request.method);
+ }
+
+-int CWebServer::HandlePostField(void *cls, enum MHD_ValueKind kind, const char *key,
++MHD_RESULT CWebServer::HandlePostField(void *cls, enum MHD_ValueKind kind, const char *key,
+ const char *filename, const char *content_type,
+ const char *transfer_encoding, const char *data, uint64_t off,
+ size_t size)
+@@ -294,13 +294,13 @@ int CWebServer::HandlePostField(void *cls, enum MHD_ValueKind kind, const char *
+ return MHD_YES;
+ }
+
+-int CWebServer::HandleRequest(const std::shared_ptr<IHTTPRequestHandler>& handler)
++MHD_RESULT CWebServer::HandleRequest(const std::shared_ptr<IHTTPRequestHandler>& handler)
+ {
+ if (handler == nullptr)
+ return MHD_NO;
+
+ HTTPRequest request = handler->GetRequest();
+- int ret = handler->HandleRequest();
++ MHD_RESULT ret = handler->HandleRequest();
+ if (ret == MHD_NO)
+ {
+ CLog::Log(LOGERROR, "CWebServer[%hu]: failed to handle HTTP request for %s", m_port, request.pathUrl.c_str());
+@@ -348,7 +348,7 @@ int CWebServer::HandleRequest(const std::shared_ptr<IHTTPRequestHandler>& handle
+ return FinalizeRequest(handler, responseDetails.status, response);
+ }
+
+-int CWebServer::FinalizeRequest(const std::shared_ptr<IHTTPRequestHandler>& handler, int responseStatus, struct MHD_Response *response)
++MHD_RESULT CWebServer::FinalizeRequest(const std::shared_ptr<IHTTPRequestHandler>& handler, int responseStatus, struct MHD_Response *response)
+ {
+ if (handler == nullptr || response == nullptr)
+ return MHD_NO;
+@@ -562,7 +562,7 @@ void CWebServer::FinalizePostDataProcessing(ConnectionHandler *connectionHandler
+ MHD_destroy_post_processor(connectionHandler->postprocessor);
+ }
+
+-int CWebServer::CreateMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const
++MHD_RESULT CWebServer::CreateMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const
+ {
+ if (handler == nullptr)
+ return MHD_NO;
+@@ -620,7 +620,7 @@ int CWebServer::CreateMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestH
+ return CreateRangedMemoryDownloadResponse(handler, response);
+ }
+
+-int CWebServer::CreateRangedMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const
++MHD_RESULT CWebServer::CreateRangedMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const
+ {
+ if (handler == nullptr)
+ return MHD_NO;
+@@ -700,7 +700,7 @@ int CWebServer::CreateRangedMemoryDownloadResponse(const std::shared_ptr<IHTTPRe
+ return CreateMemoryDownloadResponse(request.connection, result.c_str(), result.size(), false, true, response);
+ }
+
+-int CWebServer::CreateRedirect(struct MHD_Connection *connection, const std::string &strURL, struct MHD_Response *&response) const
++MHD_RESULT CWebServer::CreateRedirect(struct MHD_Connection *connection, const std::string &strURL, struct MHD_Response *&response) const
+ {
+ response = create_response(0, nullptr, MHD_NO, MHD_NO);
+ if (response == nullptr)
+@@ -713,7 +713,7 @@ int CWebServer::CreateRedirect(struct MHD_Connection *connection, const std::str
+ return MHD_YES;
+ }
+
+-int CWebServer::CreateFileDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const
++MHD_RESULT CWebServer::CreateFileDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const
+ {
+ if (handler == nullptr)
+ return MHD_NO;
+@@ -850,7 +850,7 @@ int CWebServer::CreateFileDownloadResponse(const std::shared_ptr<IHTTPRequestHan
+ return MHD_YES;
+ }
+
+-int CWebServer::CreateErrorResponse(struct MHD_Connection *connection, int responseType, HTTPMethod method, struct MHD_Response *&response) const
++MHD_RESULT CWebServer::CreateErrorResponse(struct MHD_Connection *connection, int responseType, HTTPMethod method, struct MHD_Response *&response) const
+ {
+ size_t payloadSize = 0;
+ const void *payload = nullptr;
+@@ -881,7 +881,7 @@ int CWebServer::CreateErrorResponse(struct MHD_Connection *connection, int respo
+ return MHD_YES;
+ }
+
+-int CWebServer::CreateMemoryDownloadResponse(struct MHD_Connection *connection, const void *data, size_t size, bool free, bool copy, struct MHD_Response *&response) const
++MHD_RESULT CWebServer::CreateMemoryDownloadResponse(struct MHD_Connection *connection, const void *data, size_t size, bool free, bool copy, struct MHD_Response *&response) const
+ {
+ response = create_response(size, const_cast<void*>(data), free ? MHD_YES : MHD_NO, copy ? MHD_YES : MHD_NO);
+ if (response == nullptr)
+@@ -893,20 +893,20 @@ int CWebServer::CreateMemoryDownloadResponse(struct MHD_Connection *connection,
+ return MHD_YES;
+ }
+
+-int CWebServer::SendResponse(const HTTPRequest& request, int responseStatus, MHD_Response *response) const
++MHD_RESULT CWebServer::SendResponse(const HTTPRequest& request, int responseStatus, MHD_Response *response) const
+ {
+ LogResponse(request, responseStatus);
+
+- int ret = MHD_queue_response(request.connection, responseStatus, response);
++ MHD_RESULT ret = MHD_queue_response(request.connection, responseStatus, response);
+ MHD_destroy_response(response);
+
+ return ret;
+ }
+
+-int CWebServer::SendErrorResponse(const HTTPRequest& request, int errorType, HTTPMethod method) const
++MHD_RESULT CWebServer::SendErrorResponse(const HTTPRequest& request, int errorType, HTTPMethod method) const
+ {
+ struct MHD_Response *response = nullptr;
+- int ret = CreateErrorResponse(request.connection, errorType, method, response);
++ MHD_RESULT ret = CreateErrorResponse(request.connection, errorType, method, response);
+ if (ret == MHD_NO)
+ return MHD_NO;
+
+@@ -1296,10 +1296,10 @@ std::string CWebServer::CreateMimeTypeFromExtension(const char *ext)
+ return CMime::GetMimeType(ext);
+ }
+
+-int CWebServer::AddHeader(struct MHD_Response *response, const std::string &name, const std::string &value) const
++MHD_RESULT CWebServer::AddHeader(struct MHD_Response *response, const std::string &name, const std::string &value) const
+ {
+ if (response == nullptr || name.empty())
+- return 0;
++ return MHD_NO;
+
+ CLog::Log(LOGDEBUG, LOGWEBSERVER, "CWebServer[%hu] [OUT] %s: %s", m_port, name.c_str(), value.c_str());
+
+diff --git a/xbmc/network/WebServer.h b/xbmc/network/WebServer.h
+index c7a909304a21..1274a2e0ed40 100644
+--- a/xbmc/network/WebServer.h
++++ b/xbmc/network/WebServer.h
+@@ -56,17 +56,17 @@ class CWebServer
+
+ virtual void LogRequest(const char* uri) const;
+
+- virtual int HandlePartialRequest(struct MHD_Connection *connection, ConnectionHandler* connectionHandler, const HTTPRequest& request,
++ virtual MHD_RESULT HandlePartialRequest(struct MHD_Connection *connection, ConnectionHandler* connectionHandler, const HTTPRequest& request,
+ const char *upload_data, size_t *upload_data_size, void **con_cls);
+- virtual int HandleRequest(const std::shared_ptr<IHTTPRequestHandler>& handler);
+- virtual int FinalizeRequest(const std::shared_ptr<IHTTPRequestHandler>& handler, int responseStatus, struct MHD_Response *response);
++ virtual MHD_RESULT HandleRequest(const std::shared_ptr<IHTTPRequestHandler>& handler);
++ virtual MHD_RESULT FinalizeRequest(const std::shared_ptr<IHTTPRequestHandler>& handler, int responseStatus, struct MHD_Response *response);
+
+ private:
+ struct MHD_Daemon* StartMHD(unsigned int flags, int port);
+
+ std::shared_ptr<IHTTPRequestHandler> FindRequestHandler(const HTTPRequest& request) const;
+
+- int AskForAuthentication(const HTTPRequest& request) const;
++ MHD_RESULT AskForAuthentication(const HTTPRequest& request) const;
+ bool IsAuthenticated(const HTTPRequest& request) const;
+
+ bool IsRequestCacheable(const HTTPRequest& request) const;
+@@ -76,18 +76,18 @@ class CWebServer
+ bool ProcessPostData(const HTTPRequest& request, ConnectionHandler *connectionHandler, const char *upload_data, size_t *upload_data_size, void **con_cls) const;
+ void FinalizePostDataProcessing(ConnectionHandler *connectionHandler) const;
+
+- int CreateMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const;
+- int CreateRangedMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const;
++ MHD_RESULT CreateMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const;
++ MHD_RESULT CreateRangedMemoryDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const;
+
+- int CreateRedirect(struct MHD_Connection *connection, const std::string &strURL, struct MHD_Response *&response) const;
+- int CreateFileDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const;
+- int CreateErrorResponse(struct MHD_Connection *connection, int responseType, HTTPMethod method, struct MHD_Response *&response) const;
+- int CreateMemoryDownloadResponse(struct MHD_Connection *connection, const void *data, size_t size, bool free, bool copy, struct MHD_Response *&response) const;
++ MHD_RESULT CreateRedirect(struct MHD_Connection *connection, const std::string &strURL, struct MHD_Response *&response) const;
++ MHD_RESULT CreateFileDownloadResponse(const std::shared_ptr<IHTTPRequestHandler>& handler, struct MHD_Response *&response) const;
++ MHD_RESULT CreateErrorResponse(struct MHD_Connection *connection, int responseType, HTTPMethod method, struct MHD_Response *&response) const;
++ MHD_RESULT CreateMemoryDownloadResponse(struct MHD_Connection *connection, const void *data, size_t size, bool free, bool copy, struct MHD_Response *&response) const;
+
+- int SendResponse(const HTTPRequest& request, int responseStatus, MHD_Response *response) const;
+- int SendErrorResponse(const HTTPRequest& request, int errorType, HTTPMethod method) const;
++ MHD_RESULT SendResponse(const HTTPRequest& request, int responseStatus, MHD_Response *response) const;
++ MHD_RESULT SendErrorResponse(const HTTPRequest& request, int errorType, HTTPMethod method) const;
+
+- int AddHeader(struct MHD_Response *response, const std::string &name, const std::string &value) const;
++ MHD_RESULT AddHeader(struct MHD_Response *response, const std::string &name, const std::string &value) const;
+
+ void LogRequest(const HTTPRequest& request) const;
+ void LogResponse(const HTTPRequest& request, int responseStatus) const;
+@@ -100,11 +100,11 @@ class CWebServer
+ static ssize_t ContentReaderCallback (void *cls, uint64_t pos, char *buf, size_t max);
+ static void ContentReaderFreeCallback(void *cls);
+
+- static int AnswerToConnection (void *cls, struct MHD_Connection *connection,
++ static MHD_RESULT AnswerToConnection (void *cls, struct MHD_Connection *connection,
+ const char *url, const char *method,
+ const char *version, const char *upload_data,
+ size_t *upload_data_size, void **con_cls);
+- static int HandlePostField(void *cls, enum MHD_ValueKind kind, const char *key,
++ static MHD_RESULT HandlePostField(void *cls, enum MHD_ValueKind kind, const char *key,
+ const char *filename, const char *content_type,
+ const char *transfer_encoding, const char *data, uint64_t off,
+ size_t size);
+diff --git a/xbmc/network/httprequesthandler/HTTPFileHandler.cpp b/xbmc/network/httprequesthandler/HTTPFileHandler.cpp
+index 2101d49f0911..26e53901dbfa 100644
+--- a/xbmc/network/httprequesthandler/HTTPFileHandler.cpp
++++ b/xbmc/network/httprequesthandler/HTTPFileHandler.cpp
+@@ -23,7 +23,7 @@ CHTTPFileHandler::CHTTPFileHandler(const HTTPRequest &request)
+ m_lastModified()
+ { }
+
+-int CHTTPFileHandler::HandleRequest()
++MHD_RESULT CHTTPFileHandler::HandleRequest()
+ {
+ return !m_url.empty() ? MHD_YES : MHD_NO;
+ }
+diff --git a/xbmc/network/httprequesthandler/HTTPFileHandler.h b/xbmc/network/httprequesthandler/HTTPFileHandler.h
+index 3c74b5275092..6121315c6f5f 100644
+--- a/xbmc/network/httprequesthandler/HTTPFileHandler.h
++++ b/xbmc/network/httprequesthandler/HTTPFileHandler.h
+@@ -19,7 +19,7 @@ class CHTTPFileHandler : public IHTTPRequestHandler
+ public:
+ ~CHTTPFileHandler() override = default;
+
+- int HandleRequest() override;
++ MHD_RESULT HandleRequest() override;
+
+ bool CanHandleRanges() const override { return m_canHandleRanges; }
+ bool CanBeCached() const override { return m_canBeCached; }
+diff --git a/xbmc/network/httprequesthandler/HTTPImageTransformationHandler.cpp b/xbmc/network/httprequesthandler/HTTPImageTransformationHandler.cpp
+index de42e7fd3017..6902be012532 100644
+--- a/xbmc/network/httprequesthandler/HTTPImageTransformationHandler.cpp
++++ b/xbmc/network/httprequesthandler/HTTPImageTransformationHandler.cpp
+@@ -104,7 +104,7 @@ bool CHTTPImageTransformationHandler::CanHandleRequest(const HTTPRequest &reques
+ options.find(TRANSFORMATION_OPTION_HEIGHT) != options.end());
+ }
+
+-int CHTTPImageTransformationHandler::HandleRequest()
++MHD_RESULT CHTTPImageTransformationHandler::HandleRequest()
+ {
+ if (m_response.type == HTTPError)
+ return MHD_YES;
+diff --git a/xbmc/network/httprequesthandler/HTTPImageTransformationHandler.h b/xbmc/network/httprequesthandler/HTTPImageTransformationHandler.h
+index c55015ec4eb0..0d17afc3250a 100644
+--- a/xbmc/network/httprequesthandler/HTTPImageTransformationHandler.h
++++ b/xbmc/network/httprequesthandler/HTTPImageTransformationHandler.h
+@@ -23,7 +23,7 @@ class CHTTPImageTransformationHandler : public IHTTPRequestHandler
+ IHTTPRequestHandler* Create(const HTTPRequest &request) const override { return new CHTTPImageTransformationHandler(request); }
+ bool CanHandleRequest(const HTTPRequest &request)const override;
+
+- int HandleRequest() override;
++ MHD_RESULT HandleRequest() override;
+
+ bool CanHandleRanges() const override { return true; }
+ bool CanBeCached() const override { return true; }
+diff --git a/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp b/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp
+index e8e2fa36924b..a4c3c198eba3 100644
+--- a/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp
++++ b/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp
+@@ -25,7 +25,7 @@ bool CHTTPJsonRpcHandler::CanHandleRequest(const HTTPRequest &request) const
+ return (request.pathUrl.compare("/jsonrpc") == 0);
+ }
+
+-int CHTTPJsonRpcHandler::HandleRequest()
++MHD_RESULT CHTTPJsonRpcHandler::HandleRequest()
+ {
+ CHTTPClient client(m_request.method);
+ bool isRequest = false;
+diff --git a/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h b/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h
+index 67c14b666ef6..2659fd549c25 100644
+--- a/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h
++++ b/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h
+@@ -24,7 +24,7 @@ class CHTTPJsonRpcHandler : public IHTTPRequestHandler
+ IHTTPRequestHandler* Create(const HTTPRequest &request) const override { return new CHTTPJsonRpcHandler(request); }
+ bool CanHandleRequest(const HTTPRequest &request) const override;
+
+- int HandleRequest() override;
++ MHD_RESULT HandleRequest() override;
+
+ HttpResponseRanges GetResponseData() const override;
+
+diff --git a/xbmc/network/httprequesthandler/HTTPPythonHandler.cpp b/xbmc/network/httprequesthandler/HTTPPythonHandler.cpp
+index 5f9aeef10f2e..a07ef0d3ac31 100644
+--- a/xbmc/network/httprequesthandler/HTTPPythonHandler.cpp
++++ b/xbmc/network/httprequesthandler/HTTPPythonHandler.cpp
+@@ -112,7 +112,7 @@ bool CHTTPPythonHandler::CanHandleRequest(const HTTPRequest &request) const
+ return true;
+ }
+
+-int CHTTPPythonHandler::HandleRequest()
++MHD_RESULT CHTTPPythonHandler::HandleRequest()
+ {
+ if (m_response.type == HTTPError || m_response.type == HTTPRedirect)
+ return MHD_YES;
+diff --git a/xbmc/network/httprequesthandler/HTTPPythonHandler.h b/xbmc/network/httprequesthandler/HTTPPythonHandler.h
+index 03c150693ff4..166430e68d51 100644
+--- a/xbmc/network/httprequesthandler/HTTPPythonHandler.h
++++ b/xbmc/network/httprequesthandler/HTTPPythonHandler.h
+@@ -25,7 +25,7 @@ class CHTTPPythonHandler : public IHTTPRequestHandler
+ bool CanBeCached() const override { return false; }
+ bool GetLastModifiedDate(CDateTime &lastModified) const override;
+
+- int HandleRequest() override;
++ MHD_RESULT HandleRequest() override;
+
+ HttpResponseRanges GetResponseData() const override { return m_responseRanges; }
+
+diff --git a/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.cpp b/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.cpp
+index 80d1d6733475..f2ea1f2e51ed 100644
+--- a/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.cpp
++++ b/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.cpp
+@@ -61,7 +61,7 @@ bool HTTPRequestHandlerUtils::GetRequestedRanges(struct MHD_Connection *connecti
+ return ranges.Parse(GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_RANGE), totalLength);
+ }
+
+-int HTTPRequestHandlerUtils::FillArgumentMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
++MHD_RESULT HTTPRequestHandlerUtils::FillArgumentMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
+ {
+ if (cls == nullptr || key == nullptr)
+ return MHD_NO;
+@@ -72,7 +72,7 @@ int HTTPRequestHandlerUtils::FillArgumentMap(void *cls, enum MHD_ValueKind kind,
+ return MHD_YES;
+ }
+
+-int HTTPRequestHandlerUtils::FillArgumentMultiMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
++MHD_RESULT HTTPRequestHandlerUtils::FillArgumentMultiMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
+ {
+ if (cls == nullptr || key == nullptr)
+ return MHD_NO;
+diff --git a/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.h b/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.h
+index 9a07801914e4..0ec5ed1bf706 100644
+--- a/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.h
++++ b/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.h
+@@ -25,6 +25,6 @@ class HTTPRequestHandlerUtils
+ private:
+ HTTPRequestHandlerUtils() = delete;
+
+- static int FillArgumentMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value);
+- static int FillArgumentMultiMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value);
++ static MHD_RESULT FillArgumentMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value);
++ static MHD_RESULT FillArgumentMultiMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value);
+ };
+diff --git a/xbmc/network/httprequesthandler/HTTPWebinterfaceAddonsHandler.cpp b/xbmc/network/httprequesthandler/HTTPWebinterfaceAddonsHandler.cpp
+index 01a6b503bdf6..0716a5df96ca 100644
+--- a/xbmc/network/httprequesthandler/HTTPWebinterfaceAddonsHandler.cpp
++++ b/xbmc/network/httprequesthandler/HTTPWebinterfaceAddonsHandler.cpp
+@@ -18,7 +18,7 @@ bool CHTTPWebinterfaceAddonsHandler::CanHandleRequest(const HTTPRequest &request
+ return (request.pathUrl.compare("/addons") == 0 || request.pathUrl.compare("/addons/") == 0);
+ }
+
+-int CHTTPWebinterfaceAddonsHandler::HandleRequest()
++MHD_RESULT CHTTPWebinterfaceAddonsHandler::HandleRequest()
+ {
+ m_responseData = ADDON_HEADER;
+ ADDON::VECADDONS addons;
+diff --git a/xbmc/network/httprequesthandler/HTTPWebinterfaceAddonsHandler.h b/xbmc/network/httprequesthandler/HTTPWebinterfaceAddonsHandler.h
+index e9b1c6d29a41..23cea36d1436 100644
+--- a/xbmc/network/httprequesthandler/HTTPWebinterfaceAddonsHandler.h
++++ b/xbmc/network/httprequesthandler/HTTPWebinterfaceAddonsHandler.h
+@@ -21,7 +21,7 @@ class CHTTPWebinterfaceAddonsHandler : public IHTTPRequestHandler
+ IHTTPRequestHandler* Create(const HTTPRequest &request) const override { return new CHTTPWebinterfaceAddonsHandler(request); }
+ bool CanHandleRequest(const HTTPRequest &request) const override;
+
+- int HandleRequest() override;
++ MHD_RESULT HandleRequest() override;
+
+ HttpResponseRanges GetResponseData() const override;
+
+diff --git a/xbmc/network/httprequesthandler/IHTTPRequestHandler.h b/xbmc/network/httprequesthandler/IHTTPRequestHandler.h
+index 4b1e40a587a7..b3e19f34d3dd 100644
+--- a/xbmc/network/httprequesthandler/IHTTPRequestHandler.h
++++ b/xbmc/network/httprequesthandler/IHTTPRequestHandler.h
+@@ -22,6 +22,14 @@
+
+ #include "utils/HttpRangeUtils.h"
+
++#include <microhttpd.h>
++
++#if MHD_VERSION >= 0x00097002
++#define MHD_RESULT enum MHD_Result
++#else
++#define MHD_RESULT int
++#endif
++
+ class CDateTime;
+ class CWebServer;
+
+@@ -114,7 +122,7 @@ class IHTTPRequestHandler
+ *
+ * \return MHD_NO if a severe error has occurred otherwise MHD_YES.
+ */
+- virtual int HandleRequest() = 0;
++ virtual MHD_RESULT HandleRequest() = 0;
+
+ /*!
+ * \brief Whether the HTTP response could also be provided in ranges.
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 3/5] package/libhttpserver: fix build with libmicrohttpd 0.9.71
2020-07-05 10:12 [Buildroot] [PATCH 1/5] package/libhttpserver: bump version to 0.18.1 Bernd Kuhls
2020-07-05 10:12 ` [Buildroot] [PATCH 2/5] package/kodi: fix build with libmicrohttpd 0.9.71 Bernd Kuhls
@ 2020-07-05 10:12 ` Bernd Kuhls
2020-07-20 7:16 ` Peter Korsgaard
2020-07-05 10:12 ` [Buildroot] [PATCH 4/5] package/upmpdcli: " Bernd Kuhls
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Bernd Kuhls @ 2020-07-05 10:12 UTC (permalink / raw)
To: buildroot
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
...patibility-with-libmicrohttpd-0.9.71.patch | 240 ++++++++++++++++++
1 file changed, 240 insertions(+)
create mode 100644 package/libhttpserver/0001-Compatibility-with-libmicrohttpd-0.9.71.patch
diff --git a/package/libhttpserver/0001-Compatibility-with-libmicrohttpd-0.9.71.patch b/package/libhttpserver/0001-Compatibility-with-libmicrohttpd-0.9.71.patch
new file mode 100644
index 0000000000..f982ee7a82
--- /dev/null
+++ b/package/libhttpserver/0001-Compatibility-with-libmicrohttpd-0.9.71.patch
@@ -0,0 +1,240 @@
+From cfcd8a8f73aa337e8f45d287a79cd9b8e5c51dcd Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd.kuhls@t-online.de>
+Date: Sun, 5 Jul 2020 11:42:23 +0200
+Subject: [PATCH] Compatibility with libmicrohttpd 0.9.71
+
+From the libmicrohttpd 0.9.71 release notes:
+
+Furthermore, the release introduces an 'enum MHD_Result' instead of
+defines for MHD_YES/MHD_NO. This is intended to make it easier to check
+for certain API misuse bugs by providing better types (not everything is
+an 'int'). While this does NOT change the binary API, this change
+_will_ cause compiler warnings for all legacy code -- until 'int' is
+replaced with 'enum MHD_Result'
+
+Patch sent upstream: https://github.com/etr/libhttpserver/pull/199
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ src/http_request.cpp | 6 +++---
+ src/httpserver/http_request.hpp | 6 +++---
+ src/httpserver/http_utils.hpp | 4 ++++
+ src/httpserver/webserver.hpp | 14 +++++++-------
+ src/webserver.cpp | 22 +++++++++++++---------
+ 5 files changed, 30 insertions(+), 22 deletions(-)
+
+diff --git a/src/http_request.cpp b/src/http_request.cpp
+index 5703663..be342c7 100644
+--- a/src/http_request.cpp
++++ b/src/http_request.cpp
+@@ -88,7 +88,7 @@ const std::string http_request::get_connection_value(const std::string& key, enu
+ return header_c;
+ }
+
+-int http_request::build_request_header(
++MHD_Result http_request::build_request_header(
+ void *cls,
+ enum MHD_ValueKind kind,
+ const char *key,
+@@ -189,7 +189,7 @@ const std::string http_request::get_querystring() const
+ return querystring;
+ }
+
+-int http_request::build_request_args(
++MHD_Result http_request::build_request_args(
+ void *cls,
+ enum MHD_ValueKind kind,
+ const char *key,
+@@ -204,7 +204,7 @@ int http_request::build_request_args(
+ return MHD_YES;
+ }
+
+-int http_request::build_request_querystring(
++MHD_Result http_request::build_request_querystring(
+ void *cls,
+ enum MHD_ValueKind kind,
+ const char *key,
+diff --git a/src/httpserver/http_request.hpp b/src/httpserver/http_request.hpp
+index 139272b..62e5275 100644
+--- a/src/httpserver/http_request.hpp
++++ b/src/httpserver/http_request.hpp
+@@ -247,15 +247,15 @@ class http_request
+
+ unescaper_ptr unescaper = 0x0;
+
+- static int build_request_header(void *cls, enum MHD_ValueKind kind,
++ static MHD_Result build_request_header(void *cls, enum MHD_ValueKind kind,
+ const char *key, const char *value
+ );
+
+- static int build_request_args(void *cls, enum MHD_ValueKind kind,
++ static MHD_Result build_request_args(void *cls, enum MHD_ValueKind kind,
+ const char *key, const char *value
+ );
+
+- static int build_request_querystring(void *cls, enum MHD_ValueKind kind,
++ static MHD_Result build_request_querystring(void *cls, enum MHD_ValueKind kind,
+ const char *key, const char *value
+ );
+
+diff --git a/src/httpserver/http_utils.hpp b/src/httpserver/http_utils.hpp
+index 9ad89b4..a812197 100644
+--- a/src/httpserver/http_utils.hpp
++++ b/src/httpserver/http_utils.hpp
+@@ -53,6 +53,10 @@
+
+ #define DEFAULT_MASK_VALUE 0xFFFF
+
++#if MHD_VERSION < 0x00097002
++typedef int MHD_Result;
++#endif
++
+ namespace httpserver {
+
+ typedef void(*unescaper_ptr)(std::string&);
+diff --git a/src/httpserver/webserver.hpp b/src/httpserver/webserver.hpp
+index 1ff472b..661b6ee 100644
+--- a/src/httpserver/webserver.hpp
++++ b/src/httpserver/webserver.hpp
+@@ -195,14 +195,14 @@ class webserver
+ enum MHD_RequestTerminationCode toe
+ );
+
+- static int answer_to_connection
++ static MHD_Result answer_to_connection
+ (
+ void* cls, MHD_Connection* connection,
+ const char* url, const char* method,
+ const char* version, const char* upload_data,
+ size_t* upload_data_size, void** con_cls
+ );
+- static int post_iterator
++ static MHD_Result post_iterator
+ (
+ void *cls,
+ enum MHD_ValueKind kind,
+@@ -219,25 +219,25 @@ class webserver
+ void **con_cls, int upgrade_socket
+ );
+
+- int requests_answer_first_step(MHD_Connection* connection,
++ MHD_Result requests_answer_first_step(MHD_Connection* connection,
+ struct details::modded_request* mr
+ );
+
+- int requests_answer_second_step(MHD_Connection* connection,
++ MHD_Result requests_answer_second_step(MHD_Connection* connection,
+ const char* method, const char* version, const char* upload_data,
+ size_t* upload_data_size, struct details::modded_request* mr
+ );
+
+- int finalize_answer(MHD_Connection* connection,
++ MHD_Result finalize_answer(MHD_Connection* connection,
+ struct details::modded_request* mr, const char* method
+ );
+
+- int complete_request(MHD_Connection* connection,
++ MHD_Result complete_request(MHD_Connection* connection,
+ struct details::modded_request* mr,
+ const char* version, const char* method
+ );
+
+- friend int policy_callback (void *cls,
++ friend MHD_Result policy_callback (void *cls,
+ const struct sockaddr* addr, socklen_t addrlen
+ );
+ friend void error_log(void* cls, const char* fmt, va_list ap);
+diff --git a/src/webserver.cpp b/src/webserver.cpp
+index a3104e9..3340eb0 100644
+--- a/src/webserver.cpp
++++ b/src/webserver.cpp
+@@ -75,6 +75,10 @@
+ #define SOCK_CLOEXEC 02000000
+ #endif
+
++#if MHD_VERSION < 0x00097002
++typedef int MHD_Result;
++#endif
++
+ using namespace std;
+
+ namespace httpserver
+@@ -82,7 +86,7 @@ namespace httpserver
+
+ using namespace http;
+
+-int policy_callback (void *, const struct sockaddr*, socklen_t);
++MHD_Result policy_callback (void *, const struct sockaddr*, socklen_t);
+ void error_log(void*, const char*, va_list);
+ void* uri_log(void*, const char*);
+ void access_log(webserver*, string);
+@@ -421,7 +425,7 @@ void webserver::disallow_ip(const string& ip)
+ allowances.erase(ip);
+ }
+
+-int policy_callback (void *cls, const struct sockaddr* addr, socklen_t addrlen)
++MHD_Result policy_callback (void *cls, const struct sockaddr* addr, socklen_t addrlen)
+ {
+ if(!(static_cast<webserver*>(cls))->ban_system_enabled) return MHD_YES;
+
+@@ -468,7 +472,7 @@ size_t unescaper_func(void * cls, struct MHD_Connection *c, char *s)
+ return std::string(s).size();
+ }
+
+-int webserver::post_iterator (void *cls, enum MHD_ValueKind kind,
++MHD_Result webserver::post_iterator (void *cls, enum MHD_ValueKind kind,
+ const char *key,
+ const char *filename,
+ const char *content_type,
+@@ -522,7 +526,7 @@ const std::shared_ptr<http_response> webserver::internal_error_page(details::mod
+ }
+ }
+
+-int webserver::requests_answer_first_step(
++MHD_Result webserver::requests_answer_first_step(
+ MHD_Connection* connection,
+ struct details::modded_request* mr
+ )
+@@ -574,7 +578,7 @@ int webserver::requests_answer_first_step(
+ return MHD_YES;
+ }
+
+-int webserver::requests_answer_second_step(
++MHD_Result webserver::requests_answer_second_step(
+ MHD_Connection* connection, const char* method,
+ const char* version, const char* upload_data,
+ size_t* upload_data_size, struct details::modded_request* mr
+@@ -597,7 +601,7 @@ int webserver::requests_answer_second_step(
+ return MHD_YES;
+ }
+
+-int webserver::finalize_answer(
++MHD_Result webserver::finalize_answer(
+ MHD_Connection* connection,
+ struct details::modded_request* mr,
+ const char* method
+@@ -731,10 +735,10 @@ int webserver::finalize_answer(
+ mr->dhrs->decorate_response(raw_response);
+ to_ret = mr->dhrs->enqueue_response(connection, raw_response);
+ MHD_destroy_response(raw_response);
+- return to_ret;
++ return (MHD_Result) to_ret;
+ }
+
+-int webserver::complete_request(
++MHD_Result webserver::complete_request(
+ MHD_Connection* connection,
+ struct details::modded_request* mr,
+ const char* version,
+@@ -750,7 +754,7 @@ int webserver::complete_request(
+ return finalize_answer(connection, mr, method);
+ }
+
+-int webserver::answer_to_connection(void* cls, MHD_Connection* connection,
++MHD_Result webserver::answer_to_connection(void* cls, MHD_Connection* connection,
+ const char* url, const char* method,
+ const char* version, const char* upload_data,
+ size_t* upload_data_size, void** con_cls
+--
+2.26.2
+
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 4/5] package/upmpdcli: fix build with libmicrohttpd 0.9.71
2020-07-05 10:12 [Buildroot] [PATCH 1/5] package/libhttpserver: bump version to 0.18.1 Bernd Kuhls
2020-07-05 10:12 ` [Buildroot] [PATCH 2/5] package/kodi: fix build with libmicrohttpd 0.9.71 Bernd Kuhls
2020-07-05 10:12 ` [Buildroot] [PATCH 3/5] package/libhttpserver: " Bernd Kuhls
@ 2020-07-05 10:12 ` Bernd Kuhls
2020-07-20 6:45 ` Peter Korsgaard
2020-07-05 10:12 ` [Buildroot] [PATCH 5/5] package/libmicrohttpd: security bump version to 0.9.71 Bernd Kuhls
2020-07-05 12:31 ` [Buildroot] [PATCH 1/5] package/libhttpserver: bump version to 0.18.1 Yann E. MORIN
4 siblings, 1 reply; 10+ messages in thread
From: Bernd Kuhls @ 2020-07-05 10:12 UTC (permalink / raw)
To: buildroot
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
...dapt-streamproxy-to-newer-microhttpd.patch | 106 ++++++++++++++++++
1 file changed, 106 insertions(+)
create mode 100644 package/upmpdcli/0001-Adapt-streamproxy-to-newer-microhttpd.patch
diff --git a/package/upmpdcli/0001-Adapt-streamproxy-to-newer-microhttpd.patch b/package/upmpdcli/0001-Adapt-streamproxy-to-newer-microhttpd.patch
new file mode 100644
index 0000000000..55c691b86a
--- /dev/null
+++ b/package/upmpdcli/0001-Adapt-streamproxy-to-newer-microhttpd.patch
@@ -0,0 +1,106 @@
+From 4fd8a07b560dcd4ad5706684d512d33707de3da0 Mon Sep 17 00:00:00 2001
+From: Jean-Francois Dockes <jf@dockes.org>
+Date: Fri, 3 Jul 2020 19:26:37 +0200
+Subject: [PATCH] Adapt streamproxy to newer microhttpd where results are now
+ an enum
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+[downloaded from upstream commit
+ https://framagit.org/medoc92/upmpdcli/-/commit/4fd8a07b560dcd4ad5706684d512d33707de3da0]
+---
+ src/mediaserver/cdplugins/streamproxy.cpp | 23 ++++++++++++++---------
+ 1 file changed, 14 insertions(+), 9 deletions(-)
+
+diff --git a/src/mediaserver/cdplugins/streamproxy.cpp b/src/mediaserver/cdplugins/streamproxy.cpp
+index abc57915..8d283834 100644
+--- a/src/mediaserver/cdplugins/streamproxy.cpp
++++ b/src/mediaserver/cdplugins/streamproxy.cpp
+@@ -28,6 +28,11 @@
+ #include <fcntl.h>
+ #include <microhttpd.h>
+
++
++#if MHD_VERSION < 0x00097002
++typedef int MHD_Result;
++#endif
++
+ #include <mutex>
+ #include <condition_variable>
+ #include <unordered_map>
+@@ -155,7 +160,7 @@ public:
+ ~Internal();
+ bool startMHD();
+
+- int answerConn(
++ MHD_Result answerConn(
+ struct MHD_Connection *connection, const char *url,
+ const char *method, const char *version,
+ const char *upload_data, size_t *upload_data_size,
+@@ -202,7 +207,7 @@ StreamProxy::Internal::Internal(int _listenport, UrlTransFunc _urltrans)
+ }
+
+
+-static int answer_to_connection(
++static MHD_Result answer_to_connection(
+ void *cls, struct MHD_Connection *conn,
+ const char *url, const char *method, const char *version,
+ const char *upload_data, size_t *upload_data_size,
+@@ -214,7 +219,7 @@ static int answer_to_connection(
+ return internal->answerConn(
+ conn, url, method, version, upload_data, upload_data_size, con_cls);
+ } else {
+- return -1;
++ return MHD_NO;
+ }
+ }
+
+@@ -238,8 +243,8 @@ static int print_out_key (void *cls, enum MHD_ValueKind kind,
+ }
+ #endif /* PRINT_KEYS */
+
+-static int mapvalues_cb(void *cls, enum MHD_ValueKind kind,
+- const char *key, const char *value)
++static MHD_Result mapvalues_cb(void *cls, enum MHD_ValueKind kind,
++ const char *key, const char *value)
+ {
+ unordered_map<string,string> *mp = (unordered_map<string,string> *)cls;
+ if (mp) {
+@@ -307,7 +312,7 @@ static bool processRange(struct MHD_Connection *mhdconn, uint64_t& offset)
+ return true;
+ }
+
+-int StreamProxy::Internal::answerConn(
++MHD_Result StreamProxy::Internal::answerConn(
+ struct MHD_Connection *mhdconn, const char *_url,
+ const char *method, const char *version,
+ const char *upload_data, size_t *upload_data_size,
+@@ -352,7 +357,7 @@ int StreamProxy::Internal::answerConn(
+ return MHD_NO;
+ }
+ MHD_add_response_header (response, "Location", url.c_str());
+- int ret = MHD_queue_response(mhdconn, 302, response);
++ MHD_Result ret = MHD_queue_response(mhdconn, 302, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+@@ -393,7 +398,7 @@ int StreamProxy::Internal::answerConn(
+ int code = httpcode ? httpcode : MHD_HTTP_INTERNAL_SERVER_ERROR;
+ struct MHD_Response *response =
+ MHD_create_response_from_buffer(0, 0, MHD_RESPMEM_PERSISTENT);
+- int ret = MHD_queue_response(mhdconn, code, response);
++ MHD_Result ret = MHD_queue_response(mhdconn, code, response);
+ MHD_destroy_response(response);
+ LOGINF("StreamProxy::answerConn (1): return with http code: " <<
+ code << endl);
+@@ -434,7 +439,7 @@ int StreamProxy::Internal::answerConn(
+ if (reader->fetcher->fetchDone(&fetchcode, &httpcode)) {
+ code = httpcode ? httpcode : MHD_HTTP_INTERNAL_SERVER_ERROR;
+ }
+- int ret = MHD_queue_response(mhdconn, code, response);
++ MHD_Result ret = MHD_queue_response(mhdconn, code, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+--
+GitLab
+
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread