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...
8 Replies
- dennypayne
Employee
You can use [HTTP::path] instead, that does not include the query string (everything after ?).
Denny - Darren_Person_2
Nimbostratus
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 - dennypayne
Employee
Interesting, which event are you using this in, HTTP_REQUEST or something else?
Denny - 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 }
and you sendhttp://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 - L4L7_53191
Nimbostratus
This code:when HTTP_REQUEST { set real_basename [URI::basename [HTTP::path]] HTTP::respond 200 content " $real_basename " }
Against: http://192.168.1.100:8080/foo/bar.html?redirect=http://redirecthost.com/somethingelse.htm
Prints "bar.html" to my browser as the basename. Is this what you're after, or do I misread the issue?
-Matt - Darren_Person_2
Nimbostratus
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. - 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.
Aaron
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