HTTP::payload replacement
Hello,
I try to modify a HTTP SOAP request from a client, because the used namespace is not correct (:i -> :xsi). The iRule is assigned to the virtual server. The replacement is correct, but when the ASM module is validating the XML it fails because the SOAP Request is to short.
I think the replacement of the payload does not work in the way I expect: HTTP::payload replace 0 [string length $newdata_1] $newdata_1
How can I exchange the payload against a larger buffer ?
Best Regards Jürgen
iRule to modify a SOAP request from a clientwhen RULE_INIT { set static::debug 1 }
when HTTP_REQUEST { Get the Content-Length Content-Length is only part of an POST, a GET has no Content_Length attribut
if Content-Length is > 1MB then set Content-Length to 1MBif { [HTTP::header exists "Content-Length"] } { set content_length [HTTP::header "Content-Length"] } else { set content_length 0 } if { $content_length > 0 && $content_length < 1048577 } { set collect_length $content_length } else { set collect_length 1048576 }
if { $collect_length > 0 } { content_length != 0 if HTTP::collect was executed next step is the event HTTP_REQUEST_DATA HTTP::collect $collect_length } }when HTTP_REQUEST_DATA {
if {$static::debug}{log local0. "payload before: [HTTP::payload $collect_length]"}
regsub -all ":i" [HTTP::payload] ":xsi" newdata_1
if {$static::debug}{log local0. "length newdata_1 : [string length $newdata_1]"}
replace the old payload with the new HTTP::payload replace 0 [string length $newdata_1] $newdata_1
if {$static::debug}{log local0. "payload after: $newdata_1"}
HTTP::release }