Open topic with navigation
A request cooker is similar to a query cooker, but it modifies the whole action, rather than only the query text. For example, you can use a request cooker to add extra parameters to the query that users send to HPE QMS.
You can configure the request cooker to be an external service, or you can use a Lua script.
When you use a request cooker, HPE QMS sends the original action to the cooker. The cooker returns the modified request, and HPE QMS applies whitelist, then blacklist, and then query text processing to it as necessary.
The cooker must specify the whole action to use.
The Lua script must provide a globally accessible
cook_request function, which accepts a string representation of the request as its only argument. The function must return a Lua table. The keys of this table are the parameter names to use in the action (the parameter names must be in lower case). The table values are the corresponding request values.
QMS loads the Lua script for every request that it cooks. This means that any changes to the script are reflected immediately in the query behavior.
The following example request cooker Lua script sets
10 for all queries:
-- load module that provides string to table request parser aci = require "autn_aci" -- Set maxresults to 10 on every query function cook_request(request_string) cooked_request = aci.parse_request_string(request_string) cooked_request["maxresults"] = 10 return cooked_request end
The following procedure describes how to configure HPE QMS to use a request cooker from an external service, or a Lua script.
To use a request cooker
[RequestCooker] section to the HPE QMS configuration file.
If you want to use a request cooker on an external server, specify the host and port information of the server and set
legacy in the
[RequestCooker] section of the configuration file. For example:
[RequestCooker] Host=188.8.131.52 Port=8080 Mode=legacy
If you want to use a custom Lua script for request cooking, set
lua in the
[RequestCooker] section of the configuration file, and set
Script to the path to the script that you want to use. For example:
[RequestCooker] Script=qms\lua\cookrequest-maxresults.lua Mode=lua
Send queries to HPE QMS with the
CookRequest parameter set to
If you want to cook all requests that you send to HPE QMS, set the
CookAllRequests configuration parameter to
Refer to the QMS Reference for more information on how to configure query cooking.