need help tweaking this iRule

i need to add something to this iRule to limit cookies to less than 4MB.

HttpOnlyCookies_NoSSL_irule

DO NOT USE THIS IN CONJUNCTION WITH SecureCookies_SSLOnly_irule

when HTTP_RESPONSE {

if { [catch {

foreach cookie [HTTP::cookie names]

{

set value [HTTP::cookie value $cookie];

if { “” != $value }

{

set testvalue [string tolower $value]

set valuelen [string length $value]

log local0. “Cookie found: $cookie = $value”;

switch -glob $testvalue {

“*;httponly*” -

“*; httponly*” { }

default { set value “$value; HttpOnly”; }

}

if { [string length $value] > $valuelen} {

log local0. “Replacing cookie $cookie with $value”

HTTP::cookie value $cookie “${value}”

}

}

}

} myresult] != 0 } {

log local0. “IP: [IP::server_addr]”

log local0. “Cookies: [HTTP::cookie names]”

log local0. “Cookie Count: [HTTP::cookie count]”

log local0. “Local Address: [IP::client_addr]”

log local0. “Response Code: [HTTP::status]”

}

}