Forum Discussion

Darren_Person_2's avatar
Darren_Person_2
Icon for Nimbostratus rankNimbostratus
Aug 17, 2009

Bug with URI::basename?

I've been trying to track down this bug for a while now:

 

I have the following URL:

 

http://host.com/something.htm

 

 

When I use URI::basename, it returns something.htm - good so far.

 

 

However, when I use the following URL:

 

http://host.com/somthing.htm?redirect=http://redirecthost.com/somethingelse.html

 

 

URI::basename return somethingelse.html - now this is a problem since somethingelse.html doesn't exist on my server and is just being passed it as part of the query string.

 

 

Does anyone know a good work around to this bug? I've already filed a case with F5 support...

8 Replies

  • You can use [HTTP::path] instead, that does not include the query string (everything after ?).

     

     

    Denny
  • Actually, I can't:

     

    [HTTP::path] now returns the path of the redirect URL and not the original.

     

     

    Expanded example:

     

    http://host.com/somthing.htm?redirect=http://redirecthost.com/path1/path2/somethingelse.html

     

     

    [HTTP::path] now returns /path1/path2/somethingelse.html

     

  • Interesting, which event are you using this in, HTTP_REQUEST or something else?

     

     

    Denny
  • So if you do something like this:

     
     when HTTP_REQUEST { 
        log local0. "Full request is [HTTP::uri]" 
        log local0. "Path is [HTTP::path]" 
         then process your other logic 
     } 
     

    and you send

     
     http://host.com/something.htm?redirect=http://redirecthost.com/somethingelse.html 
     

    then /var/log/ltm should show you precisely what you are getting on each request for those commands.

    If you don't get something.htm for HTTP::path then I'd say that's definitely a bug. I can't think of a workaround yet but I'll keep digging....

    Denny
  • Thanks for the reply and solution. Apparently, I was using URI::basename against HTTP::uri instead of HTTP::path.

     

     

    This is perfect and works. Thanks to everyone who contributed ideas.
  • If you did find a bug in the URI::basename command it would be helpful for you to open a case with F5 Support and report the issue. Someone from F5 may monitor the forums, but a support case is the best way to ensure the issue is documented and potentially fixed.

     

     

    Aaron