>>>>The question is: Should the HTTP client component implement this 
>>>>path removal algorithm ?
>>> If it is formally valid yes. But it could be tricky to do because
>>> sometimes the relative path could be a little "strange" :-)
>>Can you give and example of "strange" relative path ?
>  ../../adir/subdir/../anothersubdir/./etc/../../where_I_am
> This can happen when the path is "composed". I don't know if it is
> happen in the web, I followed a similar discussion in the development
> of an OS so I "traslated" it for the web.
> BTW is the "." allowed?

Yes, a "." is allowed but has no effect. The algorithm to absolutize such 
relative path is not very complex. You have to prepend the current path 
before processing. Then simply replace all "/./" by "/", then remove ending 
"/.", then parse from left to right, each time you find a "subdir/..", you 
simply delete it. Until there is no more "/.." in the path.

There can be invalid relative path such as "/dir1/../../dir2/where_I_am". 
The behaviour is then undefined. I would simply replace parent directory 
when it goes before root directory.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html

To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to