rsacheen
May 16, 2018Nimbostratus
HTTP::collect does not function as expected
iRule written below does not collect the specified amount (1024 Bytes) of payload data. Am I missing something here? When I debug the payload contents, the chunked payload size amounts to only about 869 Bytes, while the specified content_length is 1024 Bytes. The size of the actual length is around 2.55 KB, lager than the specified length.
The HTTP::method is POST
BIG-IP LTM 1600
TMOS 12.1.0
when HTTP_REQUEST {
if { [HTTP::host] contains "test-main" } {
pool pool_test-main
return
} elseif { [HTTP::host] contains "test01" } {
pool pool_test01
return
} else {
pool pool_test02
if {[HTTP::uri] contains "web_dummy"} {
if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1024}{
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1024
}
collect
HTTP::collect $content_length
}
return
}
}
when HTTP_REQUEST_DATA {
log local0. "collected data.....POST Data: [HTTP::payload]"
foreach x [split [HTTP::payload] "&"] {
if { $x starts_with "user_ref=" } {
set user_ref [lindex [split $x "="] 1]
if { [matchclass $user_ref equals CX_SERVICE_ID] }{
HTTP::uri [string map {"/web_dummy" "/notify_dummy"} [HTTP::uri]]
pool pool_test00
return
}
}
}
return
}