ltm rule command HTTP payload
iRule(1) BIG-IP TMSH Manual iRule(1)
HTTP::payload
Queries for or manipulates HTTP payload information.
SYNOPSIS
HTTP::payload ( LENGTH | (OFFSET LENGTH) )?
HTTP::payload length
HTTP::payload rechunk
HTTP::payload unchunk
HTTP::payload replace OFFSET LENGTH CONTENT
DESCRIPTION
Queries for or manipulates HTTP payload (content) information. With
this command, you can retrieve content, query for content size, or
replace a certain amount of content. The content does not include the
HTTP headers.
Syntax
HTTP::payload
* Returns the content that the HTTP::collect command has
collected thus far, up to the number of bytes specified. If you do
not specify a size, the system returns the entire collected
content.
HTTP::payload
* Returns the content that the HTTP::collect command has
collected thus far from the specified offset, up to the number of
bytes specified.
HTTP::payload length
* Returns the size of the content that has been collected thus far,
in bytes.
HTTP::payload rechunk
* Will cause the payload to be chunked on output.
* This subcommand was added in v9.4.0, and is only valid if selective
response chunking is being used.
HTTP::payload unchunk
* Will cause the payload to be chunked on output if and only if it is
chunked on input.
* This subcommand was added in v9.4.0, and is only valid if selective
response chunking is being used.
HTTP::payload replace
* Replaces the amount of content that you specified with the
argument, starting at with , adjusting the
Content-Length header appropriately.
* To clarify, the length argument should be the length of original
content to replace. In order to replace the entire payload, the
offset should be 0 and the length should be the original size in
bytes of the payload. The original content length can typically be
retrieved using [HTTP::header value Content-Length].
RETURN VALUE
VALID DURING
CACHE_REQUEST, CACHE_RESPONSE, HTTP_REQUEST, HTTP_REQUEST_DATA,
HTTP_REQUEST_SEND, HTTP_RESPONSE, HTTP_RESPONSE_CONTINUE,
HTTP_RESPONSE_DATA
EXAMPLES
when HTTP_RESPONSE {
if {[HTTP::status] == 205}{
HTTP::collect [HTTP::header Content-Length]
set clen [HTTP::header Content-Length]
}
}
when HTTP_RESPONSE_DATA {
HTTP::respond 200 content [HTTP::payload]
}
when HTTP_RESPONSE_DATA {
regsub -all "oursite" [HTTP::payload] "oursitedev" newdata
log "Replacing payload with new data."
HTTP::payload replace 0 $clen $newdata
HTTP::release
}
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-9.0.0 --First introduced the command.
BIG-IP 2017-01-31 iRule(1)