Forum Discussion
. I used that construction because I wanted to pick up just the path. [HTTP::path] includes the hostname and protocol fields. [URI::path] gives everything up to the last slash. [URI::basename] gives you the piece after the last slash. I thought it looked too complicated, but that was what seemed to work.
Looking at the docs on devcentral, I may have been misunderstanding it. It did look too complicated.
Also, I think there’s somewhere else some lore that [HTTP::path] gives you everything that was offered after the method on the HTTP command line. If a client happened to deliver the request in the form it would be in should it think that it’s talking to a proxy, that can contain the whole path.
Normally, an HTTP request looks like:
GET /index.html HTTP/1.1
And [HTTP::path] has the value “/index.html”.
However, if the client thinks it’s talking to a proxy, the HTTP request looks like this:
GET http://foo.bar.com/index.html HTTP/1.1
The web server would treat these two requests identically, I believe, but in the second case [HTTP::path] would be “http://foo.bar.com”.
I’ve never tested this; I just did it because I read something on Devcentral recommending that you do so.