Forum Discussion

Brandon_High_10's avatar
Brandon_High_10
Icon for Nimbostratus rankNimbostratus
Nov 17, 2004

Bug or code error?

I'm trying to do a rule based on the contents of the Referer header, and it looks like the URI::path function is not working correctly.

 

 

For instance:

 

Referer: http://www.foo.com/search

 

 

[URI::path [HTTP::header "Referer"] ]

 

should evaluate as "/search", but instead evaluates as "/".

 

 

To get the path, I'm using the following (messy) code:

 

 

set referer_host [URI::host [HTTP::header "Referer"] ]

 

 

set referer_path [ string range [HTTP::header "Referer"] [expr [string first ${referer_host} [HTTP::header "Referer"] ] + [string length ${referer_host} ] ] end ]

 

 

 

Any better options?
  • gomes_127447's avatar
    gomes_127447
    Historic F5 Account
    this should do it

     

     

    set referer_host [URI::path [HTTP::header "Referer"]][URI::basename [HTTP::header "Referer"]]

     

     

    You were just missing the URI basename.