Subject: Re: punctuation and path names

From: Werner Baumann <[email-masked]>
Date: Wed, 28 May 2008 11:17:23 +0200

There is still a problem with the approach taken by davfs2.

Within HTTP, "on the wire", URLs must be %-encoded as mentioned by Tim. 
A "/" within a path-segment will be represented by "%2f". But when used 
as path-separator, "/" must *not* be encoded. At some point a  client 
will have to decode the URL-path-component. davfs2 stores the URL-path 
in its decoded form and encodes it again when used in a request.

But in this case, it can not distinguish between "/" as path-separator 
and "/" within a path-segment. So you better store the URL-path in its 
%-encoded form as received from the server. You still have to check for 
trailing-slash-errors (I had a report about a server that does not 
accept URLs when send exactly as received from the server, because it 
mixed up the trailing-slash-rules).

Very strange:
I just tested with Windows2000 and WindowsServer2003. Both of them did 
*not* allow to create file-names containing a "/"-character. Did 
Microsoft change this good policy to the bad in XP?

"/" is the path-separator in HTTP. As today everything can end up in the 
  World Wide Web, "/"-characters in file-names should always be rejected.

Werner

---

From: Henrik Holst <[email-masked]>
Date: Wed, 28 May 2008 11:51:59 +0200

Werner Baumann skrev:
> Within HTTP, "on the wire", URLs must be %-encoded as mentioned by 
> Tim. A "/" within a path-segment will be represented by "%2f". But 
> when used as path-separator, "/" must *not* be encoded. At some point 
> a  client will have to decode the URL-path-component. davfs2 stores 
> the URL-path in its decoded form and encodes it again when used in a 
> request.
>
> %-encoded form as received from the server. You still have to check 
> for trailing-slash-errors (I had a report about a server that does not 
> "/" is the path-separator in HTTP. As today everything can end up in 
> the  World Wide Web, "/"-characters in file-names should always be 
> rejected.
>
> Werner
>
You cannot create filenames in XP with / in them. WIN32 handles / and \ 
equally in many functions. For example the splitpath family of functions 
treat / and \ equally and I do think that CreateFile does as well (not 
sure though).

Just tested to create a file on XP as "test/test2" and it gave me an 
error that / was not allowed in filenames.

/Henrik Holst