Seeking wisdom on URI path parameters.

JanC usenet_spam at janc.invalid
Thu May 29 00:45:16 EDT 2003


Alan Kennedy <alanmk at hotmail.com> schreef:

> Lastly, since RFC 2396 says "The parameters are not significant to the
> parsing of relative references", does this mean that in order to be
> compliant with RFC 2396, I have to parse out these parameters in order
> to correctly resolve URLs? E.G. When parsing a returned resource, do I
> have to turn 
> 
> /dir;im_ignoring=this/subdir;and=this/index.html
> 
> into 
> 
> /dir/subdir/index.html
> 
> before I can resolve URLs relative to index.html? Or should I just treat
> the "/dir;im_ignoring=this/subdir;and=this/" as the base directory?

Don't remove the parameters.

There is no reason for that, relative paths resolve correctly with the 
parameters included.  (In fact they would resolve incorrectly when you 
remove the parameters.)


Example base URL:
http://localhost/dir;im_ignoring=this/subdir;and=this/index.html

And some relative URL examples expanded:

#top -> http://localhost/dir;im_ignoring=this/subdir;and=this/index.html#top

page.html -> http://localhost/dir;im_ignoring=this/subdir;and=this/page.html

../index.html -> http://localhost/dir;im_ignoring=this/index.html

../subdir;and=that/index.html -> http://localhost/dir;im_ignoring=this/subdir;and=that/index.html

/index.html -> http://localhost/index.html

/anotherdir;param=value/index.html -> http://localhost/anotherdir;param=value/index.html

-- 
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9




More information about the Python-list mailing list