Forum Discussion
hooleylist
Feb 21, 2008Cirrostratus
Maybe the naming convention isn't very intuitive, but it's very nice to have each of the three commands: HTTP::uri to get the full URI, HTTP::path to get the URI minus the query string, and URI::path to get the path without the object name or file extension. The commands haven't changed since they were introduced. So no, I don't think there are any bugs or issues with documentation. It's just not the most intuitive names.
Aaron
[edit: I just ran into an issue where I was trying to get the path for a URL that wasn't the one the client requested. I guess I see your point that it would be nice if URI::path $url returned just the path (ie, the URI minus the query string).
Here is a bit of a hack to get the URI and the path for a static string (where you can't use HTTP::path or HTTP::uri):
set url http://example.com/path/file.html?param=val
Get the URI for a URL without using HTTP::uri (parses: /path/file.html?param=val)
log local0. "URI: [getfield $url [URI::protocol $url]://[URI::host $url] 2]"
Get the path for a URL without using HTTP::path (parses: /path/file.html)
log local0. "path: [getfield [getfield $url [URI::protocol $url]://[URI::host $url] 2] "?" 1]"
This might not be the most optimal solution, but it works...