Forum Discussion

jeff_mccombs_47's avatar
jeff_mccombs_47
Icon for Nimbostratus rankNimbostratus
Oct 17, 2012

iRules OneConnect and variable scope...Hrm.

Could be I'm just not doing something right here. But consider the following:

 

 

iRule:

 

when CLIENT_ACCEPTED {

 

set seqA 0

 

incr seqA

 

log local0. "SEQ-1: $seqA - SEQ-2 (not initalized yet)"

 

}

 

 

when HTTP_REQUEST {

 

set seqB 0

 

incr seqA

 

incr seqB

 

log local0. "SEQ-1: $seqA - SEQ-2: $seqB"

 

}

 

 

when HTTP_RESPONSE {

 

incr seqA

 

incr seqB

 

log local0. "SEQ-1: $seqA - SEQ-2: $seqB"

 

}

 

-- end of rule --

 

 

Now in a OneConnect operation, where the same TCP connection is being re-used, but mutiple backend clients are out there making requests.. say in the case of a farm of web browsers behind a proxy -- that seqA number just keeps going and going and going until the actual TCP connection is torn down. It's NOT created for every new HTTP event, correct? And SeqB is reinitalized to "0" for every time HTTP_REQUEST is fired off?

 

 

So then, how can I transfer data between events (e.g. LB_SELECTED, HTTP_REQUEST, HTTP_RESPONSE) ? I need to shovel around some data found in a header between these 3 events - but in a OneConnect situation, it doesn't seem like it works very well - especially when there is LONG pauses between the HTTP_REQUEST and RESPONSE events (sometimes as many as 10 seconds).

 

 

2 Replies

  • how can I transfer data between events (e.g. LB_SELECTED, HTTP_REQUEST, HTTP_RESPONSE) ? I need to shovel around some data found in a header between these 3 events - but in a OneConnect situation, it doesn't seem like it works very well

     

     

    Can you clarify what you mean but it does not work very well? You mean sometimes it does NOT work? what does not work?
  • Richard__Harlan's avatar
    Richard__Harlan
    Historic F5 Account
    If I understand what you are looking for you need to put what you are looking for into a array. So I am guessing you want to match request X with response X. The first thing it has been a while since I have read the RFC but in a HTTP 1.1 connection request are answered in the same order they were received. Now oneconnect does not use HTTP 1.1 but it should still answer the requests in the order it was received. So the 5th response should be the answer for the 5th request.

     

     

    If you put the data you are wanting to keep track of in a Array you can push new data into it and pull data out. So if you are keeping track of the Host header for the 5th request. when the 5th response happens you can look at the 5th position of the array to get your answer.

     

     

    If this is not what you are looking for let us know. Thanks