diff options
author | Philipp Kerling <pkerling@casix.org> | 2018-02-26 19:35:48 +0100 |
---|---|---|
committer | Philipp Kerling <pkerling@casix.org> | 2018-02-26 21:14:43 +0100 |
commit | a56ff9ea5a5231969ab17ad5b2d690f96cfc5ba4 (patch) | |
tree | 0eeb6b8b29448470c60b9cdcb079ab69bf9d1ea7 | |
parent | 7d79561f20d9fc3dc2f427d8a1c6a910f8926a02 (diff) |
Drop code for libmicrohttpd < 0.9.40
Since we require 0.9.40 now anyways
-rw-r--r-- | xbmc/network/WebServer.cpp | 56 | ||||
-rw-r--r-- | xbmc/network/WebServer.h | 17 | ||||
-rw-r--r-- | xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp | 4 | ||||
-rw-r--r-- | xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h | 4 | ||||
-rw-r--r-- | xbmc/network/httprequesthandler/HTTPPythonHandler.cpp | 4 | ||||
-rw-r--r-- | xbmc/network/httprequesthandler/HTTPPythonHandler.h | 4 | ||||
-rw-r--r-- | xbmc/network/httprequesthandler/IHTTPRequestHandler.cpp | 6 | ||||
-rw-r--r-- | xbmc/network/httprequesthandler/IHTTPRequestHandler.h | 8 |
8 files changed, 1 insertions, 102 deletions
diff --git a/xbmc/network/WebServer.cpp b/xbmc/network/WebServer.cpp index a9b97dd3d5..f74fe7f1c4 100644 --- a/xbmc/network/WebServer.cpp +++ b/xbmc/network/WebServer.cpp @@ -103,16 +103,12 @@ CWebServer::CWebServer() static MHD_Response* create_response(size_t size, void* data, int free, int copy) { -#if (MHD_VERSION >= 0x00094001) MHD_ResponseMemoryMode mode = MHD_RESPMEM_PERSISTENT; if (copy) mode = MHD_RESPMEM_MUST_COPY; else if (free) mode = MHD_RESPMEM_MUST_FREE; return MHD_create_response_from_buffer(size, data, mode); -#else - return MHD_create_response_from_data(size, data, free, copy); -#endif } int CWebServer::AskForAuthentication(const HTTPRequest& request) const @@ -164,17 +160,10 @@ bool CWebServer::IsAuthenticated(const HTTPRequest& request) const return authenticated; } -#if (MHD_VERSION >= 0x00040001) int 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) -#else -int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection, - const char *url, const char *method, - const char *version, const char *upload_data, - unsigned int *upload_data_size, void **con_cls) -#endif { if (cls == nullptr || con_cls == nullptr || *con_cls == nullptr) { @@ -312,17 +301,10 @@ int CWebServer::HandlePartialRequest(struct MHD_Connection *connection, Connecti return SendErrorResponse(request, MHD_HTTP_NOT_FOUND, request.method); } -#if (MHD_VERSION >= 0x00040001) int 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) -#else -int 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, - unsigned int size) -#endif { ConnectionHandler *conHandler = (ConnectionHandler *)cls; @@ -974,23 +956,13 @@ void CWebServer::LogRequest(const char* uri) const CLog::Log(LOGDEBUG, "CWebServer[%hu]: request received for %s", m_port, uri); } -#if (MHD_VERSION >= 0x00090200) ssize_t CWebServer::ContentReaderCallback(void *cls, uint64_t pos, char *buf, size_t max) -#elif (MHD_VERSION >= 0x00040001) -int CWebServer::ContentReaderCallback(void *cls, uint64_t pos, char *buf, int max) -#else //libmicrohttpd < 0.4.0 -int CWebServer::ContentReaderCallback(void *cls, size_t pos, char *buf, int max) -#endif { HttpFileDownloadContext *context = (HttpFileDownloadContext *)cls; if (context == nullptr || context->file == nullptr) return -1; -#if (MHD_VERSION >= 0x00090200) CLog::Log(LOGDEBUG, LOGWEBSERVER, "CWebServer [OUT] write maximum %zu bytes from %" PRIu64 " (%" PRIu64 ")", max, context->writePosition, pos); -#else - CLog::Log(LOGDEBUG, LOGWEBSERVER, "CWebServer [OUT] write maximum %d bytes from %" PRIu64 " (%" PRIu64 ")", max, context->writePosition, pos); -#endif // check if we need to add the end-boundary if (context->rangeCountTotal > 1 && context->ranges.IsEmpty()) @@ -1153,31 +1125,21 @@ struct MHD_Daemon* CWebServer::StartMHD(unsigned int flags, int port) unsigned int timeout = 60 * 60 * 24; const char* ciphers = "NORMAL:-VERS-TLS1.0"; -#if MHD_VERSION >= 0x00040500 MHD_set_panic_func(&panicHandlerForMHD, nullptr); -#endif if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_SERVICES_WEBSERVERSSL) && MHD_is_feature_supported(MHD_FEATURE_SSL) == MHD_YES && LoadCert(m_key, m_cert)) // SSL enabled return MHD_start_daemon(flags | -#if (MHD_VERSION >= 0x00040002) && (MHD_VERSION < 0x00090B01) - // use main thread for each connection, can only handle one request at a - // time [unless you set the thread pool size] - MHD_USE_SELECT_INTERNALLY -#else // one thread per connection // WARNING: set MHD_OPTION_CONNECTION_TIMEOUT to something higher than 1 // otherwise on libmicrohttpd 0.4.4-1 it spins a busy loop MHD_USE_THREAD_PER_CONNECTION -#endif #if (MHD_VERSION >= 0x00095207) | MHD_USE_INTERNAL_POLLING_THREAD /* MHD_USE_THREAD_PER_CONNECTION must be used only with MHD_USE_INTERNAL_POLLING_THREAD since 0.9.54 */ #endif -#if (MHD_VERSION >= 0x00040001) | MHD_USE_DEBUG /* Print MHD error messages to log */ -#endif | MHD_USE_SSL , port, @@ -1186,15 +1148,10 @@ struct MHD_Daemon* CWebServer::StartMHD(unsigned int flags, int port) &CWebServer::AnswerToConnection, this, -#if (MHD_VERSION >= 0x00040002) && (MHD_VERSION < 0x00090B01) - MHD_OPTION_THREAD_POOL_SIZE, 4, -#endif MHD_OPTION_CONNECTION_LIMIT, 512, MHD_OPTION_CONNECTION_TIMEOUT, timeout, MHD_OPTION_URI_LOG_CALLBACK, &CWebServer::UriRequestLogger, this, -#if (MHD_VERSION >= 0x00040001) MHD_OPTION_EXTERNAL_LOGGER, &logFromMHD, 0, -#endif // MHD_VERSION >= 0x00040001 MHD_OPTION_THREAD_STACK_SIZE, m_thread_stacksize, MHD_OPTION_HTTPS_MEM_KEY, m_key.c_str(), MHD_OPTION_HTTPS_MEM_CERT, m_cert.c_str(), @@ -1203,22 +1160,14 @@ struct MHD_Daemon* CWebServer::StartMHD(unsigned int flags, int port) // No SSL return MHD_start_daemon(flags | -#if (MHD_VERSION >= 0x00040002) && (MHD_VERSION < 0x00090B01) - // use main thread for each connection, can only handle one request at a - // time [unless you set the thread pool size] - MHD_USE_SELECT_INTERNALLY -#else // one thread per connection // WARNING: set MHD_OPTION_CONNECTION_TIMEOUT to something higher than 1 // otherwise on libmicrohttpd 0.4.4-1 it spins a busy loop MHD_USE_THREAD_PER_CONNECTION -#endif #if (MHD_VERSION >= 0x00095207) | MHD_USE_INTERNAL_POLLING_THREAD /* MHD_USE_THREAD_PER_CONNECTION must be used only with MHD_USE_INTERNAL_POLLING_THREAD since 0.9.54 */ #endif -#if (MHD_VERSION >= 0x00040001) | MHD_USE_DEBUG /* Print MHD error messages to log */ -#endif , port, 0, @@ -1226,15 +1175,10 @@ struct MHD_Daemon* CWebServer::StartMHD(unsigned int flags, int port) &CWebServer::AnswerToConnection, this, -#if (MHD_VERSION >= 0x00040002) && (MHD_VERSION < 0x00090B01) - MHD_OPTION_THREAD_POOL_SIZE, 4, -#endif MHD_OPTION_CONNECTION_LIMIT, 512, MHD_OPTION_CONNECTION_TIMEOUT, timeout, MHD_OPTION_URI_LOG_CALLBACK, &CWebServer::UriRequestLogger, this, -#if (MHD_VERSION >= 0x00040001) MHD_OPTION_EXTERNAL_LOGGER, &logFromMHD, 0, -#endif // MHD_VERSION >= 0x00040001 MHD_OPTION_THREAD_STACK_SIZE, m_thread_stacksize, MHD_OPTION_END); } diff --git a/xbmc/network/WebServer.h b/xbmc/network/WebServer.h index 9c9f1777dc..402921e500 100644 --- a/xbmc/network/WebServer.h +++ b/xbmc/network/WebServer.h @@ -108,16 +108,9 @@ private: // MHD callback implementations static void* UriRequestLogger(void *cls, const char *uri); -#if (MHD_VERSION >= 0x00090200) static ssize_t ContentReaderCallback (void *cls, uint64_t pos, char *buf, size_t max); -#elif (MHD_VERSION >= 0x00040001) - static int ContentReaderCallback (void *cls, uint64_t pos, char *buf, int max); -#else - static int ContentReaderCallback (void *cls, size_t pos, char *buf, int max); -#endif static void ContentReaderFreeCallback(void *cls); -#if (MHD_VERSION >= 0x00040001) static int AnswerToConnection (void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, @@ -126,16 +119,6 @@ private: const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size); -#else //libmicrohttpd < 0.4.0 - static int AnswerToConnection (void *cls, struct MHD_Connection *connection, - const char *url, const char *method, - const char *version, const char *upload_data, - unsigned int *upload_data_size, void **con_cls); - static int 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, - unsigned int size); -#endif bool LoadCert(std::string &skey, std::string &scert); diff --git a/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp b/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp index 8c191e833a..29296da2fa 100644 --- a/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp +++ b/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp @@ -130,11 +130,7 @@ HttpResponseRanges CHTTPJsonRpcHandler::GetResponseData() const return ranges; } -#if (MHD_VERSION >= 0x00040001) bool CHTTPJsonRpcHandler::appendPostData(const char *data, size_t size) -#else -bool CHTTPJsonRpcHandler::appendPostData(const char *data, unsigned int size) -#endif { if (m_requestData.size() + size > MAX_HTTP_POST_SIZE) { diff --git a/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h b/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h index 7c61c255db..88cb6429bf 100644 --- a/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h +++ b/xbmc/network/httprequesthandler/HTTPJsonRpcHandler.h @@ -46,11 +46,7 @@ protected: : IHTTPRequestHandler(request) { } -#if (MHD_VERSION >= 0x00040001) bool appendPostData(const char *data, size_t size) override; -#else - bool appendPostData(const char *data, unsigned int size) override; -#endif private: std::string m_requestData; diff --git a/xbmc/network/httprequesthandler/HTTPPythonHandler.cpp b/xbmc/network/httprequesthandler/HTTPPythonHandler.cpp index e1fd4850db..fc12c0e1f0 100644 --- a/xbmc/network/httprequesthandler/HTTPPythonHandler.cpp +++ b/xbmc/network/httprequesthandler/HTTPPythonHandler.cpp @@ -240,11 +240,7 @@ bool CHTTPPythonHandler::GetLastModifiedDate(CDateTime &lastModified) const return true; } -#if (MHD_VERSION >= 0x00040001) bool CHTTPPythonHandler::appendPostData(const char *data, size_t size) -#else -bool CHTTPPythonHandler::appendPostData(const char *data, unsigned int size) -#endif { if (m_requestData.size() + size > MAX_STRING_POST_SIZE) { diff --git a/xbmc/network/httprequesthandler/HTTPPythonHandler.h b/xbmc/network/httprequesthandler/HTTPPythonHandler.h index 92e308c360..2dfdd17766 100644 --- a/xbmc/network/httprequesthandler/HTTPPythonHandler.h +++ b/xbmc/network/httprequesthandler/HTTPPythonHandler.h @@ -47,11 +47,7 @@ public: protected: explicit CHTTPPythonHandler(const HTTPRequest &request); -#if (MHD_VERSION >= 0x00040001) bool appendPostData(const char *data, size_t size) override; -#else - bool appendPostData(const char *data, unsigned int size) override; -#endif private: std::string m_scriptPath; diff --git a/xbmc/network/httprequesthandler/IHTTPRequestHandler.cpp b/xbmc/network/httprequesthandler/IHTTPRequestHandler.cpp index addf36a35a..7f7769470d 100644 --- a/xbmc/network/httprequesthandler/IHTTPRequestHandler.cpp +++ b/xbmc/network/httprequesthandler/IHTTPRequestHandler.cpp @@ -112,11 +112,7 @@ void IHTTPRequestHandler::AddPostField(const std::string &key, const std::string m_postFields[key].append(value); } -#if (MHD_VERSION >= 0x00040001) bool IHTTPRequestHandler::AddPostData(const char *data, size_t size) -#else -bool IHTTPRequestHandler::AddPostData(const char *data, unsigned int size) -#endif { if (size > 0) return appendPostData(data, size); @@ -166,4 +162,4 @@ bool IHTTPRequestHandler::GetHostnameAndPort(std::string& hostname, uint16_t &po port = 80; return true; -}
\ No newline at end of file +} diff --git a/xbmc/network/httprequesthandler/IHTTPRequestHandler.h b/xbmc/network/httprequesthandler/IHTTPRequestHandler.h index 04c1f53b59..f43db8cb63 100644 --- a/xbmc/network/httprequesthandler/IHTTPRequestHandler.h +++ b/xbmc/network/httprequesthandler/IHTTPRequestHandler.h @@ -224,7 +224,6 @@ public: * \param value Value of the HTTP POST field */ void AddPostField(const std::string &key, const std::string &value); -#if (MHD_VERSION >= 0x00040001) /*! * \brief Adds the given raw HTTP POST data. * @@ -232,19 +231,12 @@ public: * \param size Size of the raw HTTP POST data */ bool AddPostData(const char *data, size_t size); -#else - bool AddPostData(const char *data, unsigned int size); -#endif protected: IHTTPRequestHandler(); explicit IHTTPRequestHandler(const HTTPRequest &request); -#if (MHD_VERSION >= 0x00040001) virtual bool appendPostData(const char *data, size_t size) -#else - virtual bool appendPostData(const char *data, unsigned int size) -#endif { return true; } bool GetRequestedRanges(uint64_t totalLength); |