URL HTTP Encoding - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.7
Category
Reference Guide

HTTP URLs usage must comply to percent-encoding method.

RFC 1738 defines URL (see faqs.org, RFC 1738).

Wikipedia explain percent-encoding method (see Wikipedia, percent-encoding).

Every URL component must be encoded, in order not to contain unsupported characters or characters with a particular signification. It is easy to understand. In an HTTP URL, hostname is followed by wanted resource path.

A URL component is everything between separators. In the following example, everything in bold:

http://host/path/to/the/file?param=value&m=value#anchor

The URL of the bar.txt file located in the foobar directory is:

http://host/foobar/bar.txt

Example of an URL with a "/" within the directory name:

If the foobar directory was named "foo/bar", I would expect the following URL:

http://host/foo/bar/bar.txt

But in this case, there will be a conflict between "/" used as separators and the / used in the directory name. The "/" used in the directory name must be encoded as %2F.

The following URL is then properly encoded:

http://host/foo%2Fbar/bar.txt

Example of a URL with a "+" within the query:

If my query contains the following value "My+Query", I would expect the following URL:

http://host/foobar/bar.txt?afs:query=My+Query

But in this case, when not encoded, "+" is interpreted as a space. The "afs:query=My+Query" query would be processed by AFS as "afs:query=My Query".

The "+" used within the query must be encoded as %2B, hence giving the query "My%2BQuery".

The following URL is then properly encoded:

http://host/foobar/bar.txt?afs:query=My%2BQuery