Forum Discussion

Randy_Johnson_1's avatar
Randy_Johnson_1
Icon for Nimbostratus rankNimbostratus
Sep 05, 2007

Request Parsing Rule -

I've been working with an example posted by Joe, in the 'docs and tips' section at

 

http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=89

 

 

and I just can't quite seem to get it right.

 

 

I'm taking it in sections - the first attempt is a cut and paste from Joe's article -

 

 

when HTTP_REQUEST {

 

Inspect Headers

 

log local0. "============================"

 

log local0. "<<< HTTP Headers >>>"

 

set names [HTTP::header names]

 

foreach name $names {

 

set val [HTTP::header values $name]

 

log local0. " $name: $val"

 

}

 

}

 

 

When I get a hit on this rule, ltm tells me:

 

 

Aug 31 15:46:31 tmm tmm[751]: 01220001:3: TCL error: Rule Inspect_Headers

 

- Illegal argument. Illegal argument. Illegal argument. Illegal argument. Ille (line 5)

 

invoked from within "HTTP::header values $name"

 

("foreach" body line 2)

 

invoked from within "foreach name $names

 

{ set val [HTTP::header values $name] log local0. " $name: $val" }"

 

 

 

In comments to Joe's article, I was asked by Joe to add a line to my rule -

 

 

when HTTP_REQUEST {

 

Inspect Headers

 

log local0. "============================"

 

log local0. "<<< HTTP Headers >>>"

 

set names [HTTP::header names]

 

foreach name $names {

 

log local0. "Extracting value for header: '$name'"

 

set val [HTTP::header values $name]

 

log local0. " $name: $val"

 

}

 

}

 

 

And got this result:

 

 

I added the requested line to the rule, and the result was:

 

Sep 5 10:39:15 tmm tmm[751]: Rule Inspect_Headers : ============================

 

Sep 5 10:39:15 tmm tmm[751]: Rule Inspect_Headers : <<< HTTP Headers >>>

 

Sep 5 10:39:15 tmm tmm[751]: Rule Inspect_Headers : Extracting value for header: 'Accept'

 

Sep 5 10:39:15 tmm tmm[751]: 01220001:3: TCL error: Rule Inspect_Headers - Illegal argument. Illegal argument. Illegal argument. Illegal argument. Ille (line 1) invoked from within "HTTP::header values $name" ("foreach" body line 3) invoked from within "foreach name $names { log local0. "Extracting value for header: '$name'" set val [HTTP::header values $name] log local0. "$name: $val" }"

 

 

My BigIP version is older, but 'should' work - 9.1.0 Build 6.2

 

 

any thoughts from the group ?

 

 

 

 

 

 

 

  • I see absolutely nothing wrong with the iRule. This has to be a software version issue. Can you try this out and post back what it returns.

    when HTTP_REQUEST {
      set name "Accept"
      log local0. "Test 1 - const header name"
      set val [HTTP::header values "Accept"]
      log local0. "Test 1 returned: $val"
      log local0." Test 2 - variable header name"
      set val [HTTP::header values $name]
      log local0. "Test 2 returned: $val"
    }

    Thanks for the extra work in diagnosing this issue!

    -Joe
  • I REALLY appreciate YOUR help Joe -

     

     

    When using the rule you just posted,

     

    I get this returned:

     

     

    Sep 5 12:21:44 tmm tmm[751]: Rule Joe_Test : Test 1 - const header name

     

    Sep 5 12:21:44 tmm tmm[751]: 01220001:3: TCL error: Rule Joe_Test - Illegal argument. Illegal argument. Illegal argument. Illegal argument. Ille (line 1) invoked from within "HTTP::header values "Accept""