Forum Discussion
Darren_Person_2
Nimbostratus
Aug 17, 2009Bug 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...
- dennypayne
Employee
You can use [HTTP::path] instead, that does not include the query string (everything after ?). - Darren_Person_2
Nimbostratus
Actually, I can't: - dennypayne
Employee
Interesting, which event are you using this in, HTTP_REQUEST or something else? - Darren_Person_2
Nimbostratus
HTTP_REQUEST is the event that it's in. - dennypayne
Employee
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 }
http://host.com/something.htm?redirect=http://redirecthost.com/somethingelse.html
- L4L7_53191
Nimbostratus
This code:when HTTP_REQUEST { set real_basename [URI::basename [HTTP::path]] HTTP::respond 200 content " $real_basename " }
- Darren_Person_2
Nimbostratus
Thanks for the reply and solution. Apparently, I was using URI::basename against HTTP::uri instead of HTTP::path. - hoolio
Cirrostratus
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.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects