Forum Discussion
Hamish
Jul 13, 2011Cirrocumulus
Here's the code I use for grabbing the content of an HTTP request. Apologies for it being a bit messy... It's in a quick & dirty iRule I wrote a long while ago...
Trigger collection for up to 1MB of data
if {[HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576}{
set fl_content_length [HTTP::header "Content-Length"]
} else {
set fl_content_length 1048576
}
paranoia... Check if $content_length has been set and is not set to 0
if { [info exists fl_content_length] && $fl_content_length > 0} {
if { $fl_debugFlag >= 2 } {
HSL::send $hsl "$fl_logprefix collecting $fl_content_length Bytes"
}
HTTP::collect $fl_content_length
}
H