From ac34872e887387c2e32d4ffc2059975a082f96e0 Mon Sep 17 00:00:00 2001 From: Radoslav Husar Date: Fri, 16 Feb 2024 17:38:19 +0100 Subject: [PATCH 1/2] MODCLUSTER-551 Fix spelling of EnableMCPMReceive option. --- native/mod_manager/mod_manager.c | 42 ++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/native/mod_manager/mod_manager.c b/native/mod_manager/mod_manager.c index e9d632cb..ce7cc78c 100644 --- a/native/mod_manager/mod_manager.c +++ b/native/mod_manager/mod_manager.c @@ -162,8 +162,8 @@ typedef struct mod_manager_config int reduce_display; /* maximum message size */ int maxmesssize; - /* Enable MCPM receiver */ - int enable_mcpm_receive; + /* Enable MCMP receiver */ + int enable_mcmp_receive; /* Enable WebSocket Proxy */ int enable_ws_tunnel; /* WebSocket upgrade header */ @@ -2589,7 +2589,7 @@ static int manager_trans(request_rec *r) if (r->method_number != M_INVALID) { return DECLINED; } - if (!mconf->enable_mcpm_receive) { + if (!mconf->enable_mcmp_receive) { return DECLINED; /* Not allowed to receive MCMP */ } @@ -2619,7 +2619,7 @@ static int manager_map_to_storage(request_rec *r) if (r->method_number != M_INVALID) { return DECLINED; } - if (!mconf->enable_mcpm_receive) { + if (!mconf->enable_mcmp_receive) { return DECLINED; /* Not allowed to receive MCMP */ } @@ -3351,7 +3351,7 @@ static int manager_handler(request_rec *r) } mconf = ap_get_module_config(r->server->module_config, &manager_module); - if (!mconf->enable_mcpm_receive) { + if (!mconf->enable_mcmp_receive) { return DECLINED; /* Not allowed to receive MCMP */ } @@ -3705,18 +3705,27 @@ static const char *cmd_manager_maxmesssize(cmd_parms *cmd, void *mconfig, const return NULL; } -static const char *cmd_manager_enable_mcpm_receive(cmd_parms *cmd, void *dummy) +static const char *cmd_manager_enable_mcmp_receive(cmd_parms *cmd, void *dummy) { mod_manager_config *mconf = ap_get_module_config(cmd->server->module_config, &manager_module); (void)dummy; if (!cmd->server->is_virtual) { - return "EnableMCPMReceive must be in a VirtualHost"; + return "EnableMCMPReceive must be in a VirtualHost"; } - mconf->enable_mcpm_receive = 1; + mconf->enable_mcmp_receive = 1; return NULL; } +static const char *cmd_manager_enable_mcmp_receive_deprecated(cmd_parms *cmd, void *dummy) +{ + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, + "EnableMCPMReceive is deprecated misspelled version of 'EnableMCMPReceive' configuration option. " + "Please update your configuration."); + + return cmd_manager_enable_mcmp_receive(cmd, dummy); +} + static const char *cmd_manager_enable_ws_tunnel(cmd_parms *cmd, void *dummy) { mod_manager_config *mconf = ap_get_module_config(cmd->server->module_config, &manager_module); @@ -3826,8 +3835,11 @@ static const command_rec manager_cmds[] = { "displayed)"), AP_INIT_TAKE1("MaxMCMPMessSize", cmd_manager_maxmesssize, NULL, OR_ALL, "MaxMCMPMaxMessSize - Maximum size of MCMP messages. (Default: calculated min value: 1024)"), - AP_INIT_NO_ARGS("EnableMCPMReceive", cmd_manager_enable_mcpm_receive, NULL, OR_ALL, - "EnableMCPMReceive - Allow the VirtualHost to receive MCPM."), + AP_INIT_NO_ARGS("EnableMCMPReceive", cmd_manager_enable_mcmp_receive, NULL, OR_ALL, + "EnableMCMPReceive - Allow the VirtualHost to receive MCMP."), + AP_INIT_NO_ARGS("EnableMCPMReceive", cmd_manager_enable_mcmp_receive_deprecated, NULL, OR_ALL, + "EnableMCPMReceive - Deprecated misspelled version of 'EnableMCMPReceive' configuration option " + "kept in for configuration backwards compatibility."), AP_INIT_NO_ARGS( "EnableWsTunnel", cmd_manager_enable_ws_tunnel, NULL, OR_ALL, "EnableWsTunnel - Use ws or wss instead of http or https when creating nodes (allows WebSocket proxying)."), @@ -3893,7 +3905,7 @@ static void *create_manager_config(apr_pool_t *p) mconf->allow_display = 0; mconf->allow_cmd = -1; mconf->reduce_display = 0; - mconf->enable_mcpm_receive = 0; + mconf->enable_mcmp_receive = 0; mconf->enable_ws_tunnel = 0; mconf->ws_upgrade_header = NULL; mconf->ajp_secret = NULL; @@ -3979,10 +3991,10 @@ static void *merge_manager_server_config(apr_pool_t *p, void *server1_conf, void mconf->reduce_display = mconf1->reduce_display; } - if (mconf2->enable_mcpm_receive != 0) { - mconf->enable_mcpm_receive = mconf2->enable_mcpm_receive; - } else if (mconf1->enable_mcpm_receive != 0) { - mconf->enable_mcpm_receive = mconf1->enable_mcpm_receive; + if (mconf2->enable_mcmp_receive != 0) { + mconf->enable_mcmp_receive = mconf2->enable_mcmp_receive; + } else if (mconf1->enable_mcmp_receive != 0) { + mconf->enable_mcmp_receive = mconf1->enable_mcmp_receive; } if (mconf2->enable_ws_tunnel != 0) { From 4109576721ca59679868036fb7d6d760f0ecfe19 Mon Sep 17 00:00:00 2001 From: Radoslav Husar Date: Fri, 16 Feb 2024 19:31:55 +0100 Subject: [PATCH 2/2] test: Update tests to use the correctly spelled version of 'EnableMCMPReceive' option. --- native/balancers/README.md | 2 +- test/MODCLUSTER-640/mod_proxy_cluster.conf | 2 +- test/MODCLUSTER-734/mod_proxy_cluster.conf | 2 +- test/MODCLUSTER-755/mod_proxy_cluster.conf | 2 +- test/MODCLUSTER-785/mod_proxy_cluster.conf | 2 +- test/MODCLUSTER-794/mod_proxy_cluster.conf | 2 +- test/httpd/mod_lbmethod_cluster.conf | 2 +- test/httpd/mod_proxy_cluster.conf | 2 +- test/websocket/mod_proxy_cluster.conf | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/native/balancers/README.md b/native/balancers/README.md index f593e98f..05e6ade8 100644 --- a/native/balancers/README.md +++ b/native/balancers/README.md @@ -31,7 +31,7 @@ LoadModule lbmethod_cluster_module modules/mod_lbmethod_cluster.so KeepAliveTimeout 300 MaxKeepAliveRequests 0 - EnableMCPMReceive + EnableMCMPReceive ServerName localhost diff --git a/test/MODCLUSTER-640/mod_proxy_cluster.conf b/test/MODCLUSTER-640/mod_proxy_cluster.conf index b2d15744..b8b4d946 100644 --- a/test/MODCLUSTER-640/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-640/mod_proxy_cluster.conf @@ -28,7 +28,7 @@ ProxyPreserveHost On EnableWsTunnel WSUpgradeHeader websocket - EnableMCPMReceive + EnableMCMPReceive Require ip 127.0.0.1 Require ip ::1 diff --git a/test/MODCLUSTER-734/mod_proxy_cluster.conf b/test/MODCLUSTER-734/mod_proxy_cluster.conf index b32e3a23..4a5952da 100644 --- a/test/MODCLUSTER-734/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-734/mod_proxy_cluster.conf @@ -16,7 +16,7 @@ ManagerBalancerName mycluster ServerName localhost - EnableMCPMReceive + EnableMCMPReceive Require ip 127.0.0.1 Require ip ::1 diff --git a/test/MODCLUSTER-755/mod_proxy_cluster.conf b/test/MODCLUSTER-755/mod_proxy_cluster.conf index ed5f2b8f..82c18ae8 100644 --- a/test/MODCLUSTER-755/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-755/mod_proxy_cluster.conf @@ -16,7 +16,7 @@ ManagerBalancerName mycluster ServerName localhost - EnableMCPMReceive + EnableMCMPReceive Require ip 127.0.0.1 Require ip ::1 diff --git a/test/MODCLUSTER-785/mod_proxy_cluster.conf b/test/MODCLUSTER-785/mod_proxy_cluster.conf index 11bd1161..660be964 100644 --- a/test/MODCLUSTER-785/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-785/mod_proxy_cluster.conf @@ -16,7 +16,7 @@ EnableWsTunnel WSUpgradeHeader websocket - EnableMCPMReceive + EnableMCMPReceive Require ip 127.0.0.1 Require ip ::1 diff --git a/test/MODCLUSTER-794/mod_proxy_cluster.conf b/test/MODCLUSTER-794/mod_proxy_cluster.conf index 91a2ed22..d5124903 100644 --- a/test/MODCLUSTER-794/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-794/mod_proxy_cluster.conf @@ -24,7 +24,7 @@ WSUpgradeHeader websocket - EnableMCPMReceive + EnableMCMPReceive Require ip 127.0.0. Require ip ::1 diff --git a/test/httpd/mod_lbmethod_cluster.conf b/test/httpd/mod_lbmethod_cluster.conf index 6d16232f..3c237bda 100644 --- a/test/httpd/mod_lbmethod_cluster.conf +++ b/test/httpd/mod_lbmethod_cluster.conf @@ -17,7 +17,7 @@ ManagerBalancerName mycluster WSUpgradeHeader websocket - EnableMCPMReceive + EnableMCMPReceive Require ip 127.0.0. Require ip ::1 diff --git a/test/httpd/mod_proxy_cluster.conf b/test/httpd/mod_proxy_cluster.conf index a378d841..0ffea8b2 100644 --- a/test/httpd/mod_proxy_cluster.conf +++ b/test/httpd/mod_proxy_cluster.conf @@ -23,7 +23,7 @@ WSUpgradeHeader websocket - EnableMCPMReceive + EnableMCMPReceive Require ip 127.0.0. Require ip ::1 diff --git a/test/websocket/mod_proxy_cluster.conf b/test/websocket/mod_proxy_cluster.conf index aacc0efa..e9946b10 100644 --- a/test/websocket/mod_proxy_cluster.conf +++ b/test/websocket/mod_proxy_cluster.conf @@ -24,7 +24,7 @@ ManagerBalancerName mycluster EnableWsTunnel WSUpgradeHeader websocket - EnableMCPMReceive + EnableMCMPReceive Require ip 127.0.0. Require ip ::1