From: Amos Jeffries Date: Tue, 19 Sep 2023 08:45:27 +0000 (+0000) Subject: Bug 5301: cachemgr.cgi not showing new manager interface URLs (#1479) X-Git-Tag: SQUID_7_0_1~353 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cea8f444cbd60bac78e8bee7cf36f7c25f0813b2;p=thirdparty%2Fsquid.git Bug 5301: cachemgr.cgi not showing new manager interface URLs (#1479) Also fix several related UI issues uncovered during testing: * Prune the list of servers accessible via the CGI tool login. Their responses would be badly mangled if accessed via the old tools parse logic. Also, hide the old login form if all servers use the new manager interface. * Ensure the 'menu' report is always used by default after the CGI tool login. This prevents errors about MGR_INDEX not being available on recent Squid releases. Restoring the expected CGI tool behavior. --- diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index 9ab8d8c7ff..3facfc4adf 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -277,11 +277,16 @@ auth_html(const char *host, int port, const char *user_name) printf(" if (x.readyState==4) {\n"); printf(" if ((x.status>=200 && x.status <= 299) || x.status==401) {\n"); printf(" var v = x.getResponseHeader('Server');\n"); - printf(" if (v.substring(0,8) == 'squid/3.' && (v[8]=='H' || parseInt(v.substring(8)) >= 2)) {\n"); + printf(" if (v.substring(0,6) == 'squid/' || v == 'squid') {\n"); printf(" var d = document.getElementById('H' + s + 'mgr');\n"); printf(" if (d.innerHTML == '') d.innerHTML = '

HTTP' + (s=='s'?'S':'') + ' Managed Proxies

';\n"); printf(" d.innerHTML = d.innerHTML + '

Host: ' + t + '

';\n"); - printf(" }}}}\n"); + printf(" var sv = document.getElementById('server');\n"); + printf(" var op = sv.getElementsByTagName('OPTION');\n"); + printf(" for(var i=0; i\n"); @@ -802,7 +807,7 @@ process_request(cachemgr_request * req) } if (req->action == nullptr) { - req->action = xstrdup(""); + req->action = xstrdup("menu"); } if (strcmp(req->action, "authenticate") == 0) {