This is an automated email from the ASF dual-hosted git repository.
gmurthy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 0c27fdb DISPATCH-1926: Added code to selectively allow deletion of
http:yes listeners based on available libwebsockets version. This closes #995.
0c27fdb is described below
commit 0c27fdb9f5016258422f2902f98b27985e31dec9
Author: Ganesh Murthy
AuthorDate: Fri Jan 22 15:25:04 2021 -0500
DISPATCH-1926: Added code to selectively allow deletion of http:yes
listeners based on available libwebsockets version. This closes #995.
---
.gitignore | 1 +
CMakeLists.txt | 11 +
.../management/{agent.py => agent.py.in} | 2 +
tests/system_tests_http.py.in | 57 ++
4 files changed, 52 insertions(+), 19 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4c68305..92550f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ tests/system_tests_authz_service_plugin.py
tests/system_tests_handle_failover.py
tests/system_tests_topology_disposition.py
tests/system_tests_http.py
+python/qpid_dispatch_internal/management/agent.py
*.iml
.idea
.metadata
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c949f9..0854b01 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,6 +70,8 @@ find_package(libnghttp2 1.4.0)
find_package(LibWebSockets 2.4.2)
CMAKE_DEPENDENT_OPTION(USE_LIBWEBSOCKETS "Use libwebsockets for WebSocket
support" ON
"LIBWEBSOCKETS_FOUND" OFF)
+
+set(SKIP_DELETE_HTTP_LISTENER "True")
if (LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING)
# This is a fix for DISPATCH-1513. libwebsockets versions 3.2.0 introduces a
new flag called LWS_SERVER_OPTION_ALLOW_HTTP_ON_HTTPS_LISTENER
# The new flag allows (as the flag says) HTTP pver HTTPS listeners. Since
this flag is not available before lws 3.2.0 we need
@@ -79,6 +81,14 @@ if (LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING)
if ((LIBWEBSOCKETS_VERSION_STRING STREQUAL LWS_VERSION_WITH_SSL_FIX) OR
(LIBWEBSOCKETS_VERSION_STRING STRGREATER LWS_VERSION_WITH_SSL_FIX))
set(TEST_OPTION_ALLOW_HTTP_ON_HTTPS_LISTENER "")
endif()
+ # The listener delete functionality worked in all versions of LibWebSockets
+ # starting from v2.4.2 thru v3.2.3. It stopped working in v4.0.0 and beyond
+ if ( (LIBWEBSOCKETS_VERSION_STRING STREQUAL "2.4.2") OR (
(LIBWEBSOCKETS_VERSION_STRING STRGREATER_EQUAL "3.0.0") AND
(LIBWEBSOCKETS_VERSION_STRING STRLESS "4.0.0") ) )
+# Do not skip the tests (in system_tests_http.py) that specifically
+# test deletion of http:yes listeners.
+set(SKIP_DELETE_HTTP_LISTENER "False")
+ endif()
+
endif(LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING)
# Python
@@ -245,6 +255,7 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_authz_service_plug
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_handle_failover.py.in
${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_handle_failover.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_http.py.in
${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_http.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_topology_disposition.py.in
${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_topology_disposition.py)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/python/qpid_dispatch_internal/management/agent.py.in
${CMAKE_CURRENT_SOURCE_DIR}/python/qpid_dispatch_internal/management/agent.py)
execute_process(COMMAND ${RUN} --sh OUTPUT_FILE config.sh)
if (NOT UNITTEST_MISSING)
diff --git a/python/qpid_dispatch_internal/management/agent.py
b/python/qpid_dispatch_internal/management/agent.py.in
similarity index 99%
rename from python/qpid_dispatch_internal/management/agent.py
rename to python/qpid_dispatch_internal/management/agent.py.in
index 275ee59..606fac8 100644
--- a/python/qpid_dispatch_internal/management/agent.py
+++ b/python/qpid_dispatch_internal/management/agent.py.in
@@ -435,6 +435,8 @@ class ListenerEntity(ConnectionBaseEntity):
return super(ListenerEntity, self).__str__().replace("Entity(",
"ListenerEntity(")
def _delete(self):
+if self.http and ${SKIP_DELETE_HTTP_LISTENER}:
+raise BadRequestStatus("HTTP listeners cannot be deleted")
self._qd.qd_connection_manager_delete_listener(self._dispatch,
self._implementations[0].key)
diff --git a/tests/system_tests_http.py.in b/tests/system_tests_http.py.in
index 931baf6..9ba4c0d 100644
--- a/tests/system_tests_http.py.in
+++ b/tests/system_tests_http.py.in
@@ -49,6 +49,13 @@ class RouterTestHttp(TestCase):
return os.path.join(DIR, 'ssl_certs', name)
@classmethod
+def setUpClass(cls):
+super(RouterTestHttp, cls).setUpClass()
+# Http listener delete