HTTP::query

Description

Returns the query part of the HTTP request. The query is defined as the part of the request past a ? character, if any.
For the following URL:
http://www.example.com:8080/main/index.jsp?user=test&login=check
The query is:
user=test&login=check
See also URI::query for a parser to extract the HTTP query or individual query parameters from a specified URI.

Syntax

HTTP::query
HTTP::query -normalized

HTTP::query

  • Returns (or sets in v11.5+) the query part of the HTTP request.

HTTP::query -normalized

  • Returns (or sets in v11.5+) the query part of the HTTP request. Introduced in v12.1.0, the normalization involves lower-casing, removing unnecessary directory traversals, convert from microsoft style %uxxxx form to the standard %xx hex form, bytes not allowed in a uri are normalised to their percent-encoded representation, bytes percent-encoded when they don’t need to be are changed to their normal representation.

Examples

when HTTP_REQUEST {
  log local0. "http_path [HTTP::path]"
  log local0. "http_query [HTTP::query]"
}

when HTTP_REQUEST {
 if {[string tolower [HTTP::query]] contains "utm" || [string tolower [HTTP::query]] contains "gclid"} {
 set query [string tolower [HTTP::query]]
}

Notes

Beginning in version 11, the cached behavior changes so that the value of the query is updated immediately if set. Previously, you would need to log the value in a higher priority (read: higher number) of the current event or log the value in a later event in order to reflect the change.