Forum Discussion
vinny_murphy_96
Mar 31, 2005Nimbostratus
Hi 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.