Forum Discussion
Matt_Williamson
Nimbostratus
Mar 29, 2005iRule to persist on tcp_content
Hi all, I'm trying to write a rule that will search the first 2500 bytes of tcp_content for the "USERNAME=" string and then persist on the next 7 characters after that. Here is my original attempt. ...
vinny_murphy_96
Nimbostratus
Mar 31, 2005Hi again,
Can you inspect a server response on TCP level, retrieve a value, modify it and send back to client? I need to get the value of a Max-Connections header from a server in an options response. Modify this value to insert the total Max-Connections value for all the servers in the pool and send it on its way back to the client.
I got the impression from forum that the Wizards like to see a little effort or a hack at a rule from the subscriber so here goes: (its not pretty!)
Rule entry point
when SERVER_CONNECTED {
TCP::collect
}
when SERVER_DATA {
Collect 30 bytes to see if its an OPTIONS response
TCP::collect 30
set identifier [findstr [TCP::payload] "OPTIONS" 7 "\r"]
if {$identifier ne " "} {
if its an OPTIONS response, process the TCP..
TCP::collect 250
250 bytes should give me the Max-Connections header
} else { [[TCP::payload] contains "Max-Connections:"]} {
set MaxConn [[TCP::payload] value "Max-Connections:"]
TCP::respond $MaxConn
log local0. "OptionResponse: $MaxConn"
}
Flush collect data and release event hook point
TCP::release
}
The "Max-Connections: 2000\r\n" header is very simple and tells me how mant TCP connections I can set up on my server.
I am a little bit weary of TCP::respond, for the moment I have not managed to retrieve the value of Max-Connections.
Finally I need to be able to modify this value for example by a factor of 10 and return this value to the client.
Thanks,
Vin.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
