Forum Discussion

Neil_66348's avatar
Neil_66348
Icon for Nimbostratus rankNimbostratus
Apr 30, 2010

iRules - URI's with "FullStops" in

Hi guys ,

 

 

Hope someone can help here .

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::path]] {

 

"*/dev.inbound.prod.Portal*" {

 

pool Prod-HTTP-POOL

 

}

 

"*/dev-pool*" {

 

pool DEV-HTTP-POOL

 

}

 

default {

 

pool LIVE-HTTP

 

}

 

}

 

}

 

 

The above is a variation of our usual rule for content directing , the problem with the above is that it appears any uri's which have a "fullstop" in dont' work.

 

So */dev-pool* works fine , but /dev.inbound.prod.Portal* doesn't , if we change "." to be "-" this works.

 

Unfortunatley the website we wish to apply this to, we cannot change....

 

 

Any ideas greatly recieved.

 

 

Many Thanks

 

Neil

 

 

 

2 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Good question... A '.' char isn't special according to the glob docs on tcl.tk, so in theory it should work. What happens is you

     

     

    1. Try escaping the . with a backslash? (Used also to match a * or ?).

     

    2. Try regexp matching instead?

     

     

    If escaping the '.' works, you could try raising a case with the info and asking for it to be fixed...

     

     

    H

     

  • That's really odd. switch -glob should use the same logic as 'string match'. I don't think the period has any significance as a wildcard for string matching:

    http://www.tcl.tk/man/tcl8.4/TclCmd/string.htmM35

    I couldn't reproduce this non-matching of .'s using string match or switch in 10.1:

    tclsh

    % string match "a.b.c." "aabbcc"

    0

    % string match "a.b.c." "a.b.c."

    1

    
    when RULE_INIT {
    
       log local0. "[string match "a.b.c." "a.b.c."]"
       log local0. "[string match "a.b.c." "aabbcc"]"
    
       switch -glob "a.b.c." {
          "a.b.c." {
             log local0. "matched a.b.c."
          }
          "aabbcc" {
             log local0. "matched aabbcc"
          }
          default {
             log local0. "no match"
          }
       }
    }
    

    : 1

    : 0

    : matched a.b.c.

    Aaron