Anyway how to use 'switch -glob' to search HTTP::payload?
It works with 'if-elseif' logic.
Also, is the HTTP::release advisable to add?
when HTTP_REQUEST {
if { [HTTP::method] equals "POST" }{
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
switch -glob [HTTP::payload] {
apple {
pool apple_pool
}
orange {
pool orange_pool
}
}
}
It will work, but I’m guessing you need to allow for some padding:
when HTTP_REQUEST {
if { [HTTP::method] equals "POST" }{
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
switch -glob [HTTP::payload] {
"*apple*" {
pool apple_pool
}
"*orange*" {
pool orange_pool
}
}
}
You shouldn’t need to issue the HTTP::release command because you’re explicitly defining the amount of payload to collect using the Content-Length header.