Forum Discussion
Chris_Miller
Altostratus
Nov 02, 2010Logging if certain HTTP Query Strings are Null
I have a query string that looks like the following: s_sample=test&t_sample=test&u_sample=test. I'm trying to determine the most effective way to log when s_sample, t_sample, or u_sa...
hoolio
Cirrostratus
Nov 02, 2010Not pretty, but it seems to work assuming I have the scenario correct:
scan [string range [HTTP::query] [string first "s_sample=" [HTTP::query]] end] {s_sample=%[^&]&t_sample=%[^&]&u_sample=%[^&]}
Here is a description of the steps:
Save a test query with some parameters and values including the three sample parameters in order
set query {blah=val&s_sample=s_sample_value&t_sample=t_sample_value&u_sample=u_sample_value&blah=val2}
Get the index of the first sample parameter
string first "s_sample=" $query
Trim off everything up to the first sample parameter name
string range $query [string first "s_sample=" $query] end
Scan the trimmed string to get the values for the three sample parameters. If it doesn't return 3, then one or more of the parameters wasn't matched and parsed
scan [string range $query [string first "s_sample=" $query] end] {s_sample=%[^&]&t_sample=%[^&]&u_sample=%[^&]}
I'm guessing there might be a cleaner solution if you can give more detail on the scenario.
Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects