-
Change Request
-
Resolution: Duplicate
-
Major
-
None
-
4.2.3
-
S24-W24/25, S24-W28/29, S24-W36/37
-
1
In web scenarios it is possible to extract data returned from a webpage in to a variable which is used in a later step.
What is not possible is to html decode the webpage data, to be able to post this back later.
For example using the following HTTP response:
<html><head><title>Working...</title></head> <body> <form method="POST" name="hiddenform" action="https://opac.stpeters.school.nz:443/"> <input type="hidden" name="wctx" value="rm=0&id=passive&ru=%2f" /><noscript><p>Script is disabled. Click Submit to continue.</p><input type="submit" value="Submit" /></noscript> </form> <script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script> </body></html>
It is possible to extract out the form action and the value of the wctx input:
{action}=regex:<form .action="([^"])"
{wctx}=regex:name="wa"[\s]value="([^"]*)"
The problem is when in a following step I try to post back wctx, the POST data appears as:
wctx=rm%3D0%26amp%3Bid%3Dpassive%26amp%3Bru%3D%252f%253fsr%253dsso%2526sr%253dsso
which is invalid.
Currently there are the macro functions {{macro}.urlencode()} and {{macro}.urldecode()} which will URL encode and decode (https://www.zabbix.com/documentation/4.2/manual/web_monitoring) a string.
There are also the macro functions {{macro}.regsub(<pattern>,<output>)} and {{macro}.iregsub(<pattern>,<output>)} which do regular expression substitutions, however these are not supported against web scenario variables (https://www.zabbix.com/documentation/4.2/manual/config/macros/macro_functions).
Hence this request is for two new macro functions: {{macro}.htmlencode()} and {{macro}.htmldecode()}. These functions would HTML escape special characters in macros and remove the escaping respectably. A list of characters to be escaped can be found at http://www.htmlhelp.com/reference/html40/entities/special.html
The following forum post also discusses the exact issue I’m having and the reason for requesting these functions: https://www.zabbix.com/forum/zabbix-help/51074-html-entities-in-web-scenario
A related but not identical feature request is: ZBXNEXT-4452 Edit macro variables values extracted from web page in successive POST request using function "replace(<what>,<to_what>)"
- duplicates
-
ZBXNEXT-9208 New macro functions, web scenario improvements
- Closed
- mentioned in
-
Page Loading...