Variable Passing between Events

Hi !

I am sorry that I am a Newbie for iRule and Tcl command. Could anyone help me the following:

Why can’t it pass the value of $clsub from Event CLIENTSSL_CLIENTCERT to event HTTP_REQUEST. How to solve it and what way can I use for solution?

when CLIENT_ACCEPTED {

set needcert 0;

set gotcert 0;

set crt “”;

set clcert “”;

}

when CLIENTSSL_CLIENTCERT {

log LOCAL0.warn “cert count=[SSL::cert count] result= SSL::verify_result]”;

if { [SSL::cert count] != 0 or [SSL::verify_result] == 0 } {

log LOCAL0.warn “Good cert! ($needcert)”

set gotcert 1

set crt “[SSL::cert 0]”

set clsub “[X509::subject $crt]”

Subject is obtained successfully shown on log.

log LOCAL0. “$clsub”

if { $needcert == 1 } {

HTTP::release

}

} else {

log LOCAL0.warn “Bad cert!”

if { $needcert == 1 } {

reject

}

}

}

when HTTP_REQUEST {

log LOCAL0. “HTTP-RQ”

I found $clsub is null on log.

log LOCAL0. “$clsub”

snatpool customer1_snatpool

}

You can use global variables to span across events. Take a look at this thread (Click here) or do a search on “global variables” to find more examples.

-Joe

My suspicion is that you are actually dealing with a request on a different connection, as many browsers regularly spread requests over multiple connections. I would suggest adding a few log statements both to your HTTP_REQUEST event and to CLIENT_ACCEPTED and log the TCP/IP tuple so you can double check what’s going on.