The value (./) in the URI?

After reading and viewing the samples here

Given an uri example:

http://a/b/c/d;p?q 

redirecting to "g" redirect me to http://a/b/c/g (the reason is the directory)

So, I ask myself when to use ./g

This is actually the same [current goto and find g folder]

So why does this syntax even exist? ./ When should I use it?

+4
source share
2 answers

I would say this:

There is no particular reason why this construct exists (or was created / defined). It just exists because it is a logical combination of other constructs ( . , / , /g ) that are required and therefore are defined for other reasons. Since these constructs (path components here) can be combined more or less without restriction, the dubious constrcut ./g well defined and therefore valid. But this does not mean that there should be a special reason why this particular design was or should be defined.

+2
source

The general syntax of a URI consists of a hierarchical sequence of components, designated as a scheme, authority, path, query, and fragment.

  URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty 

Schema and path components are required, although the path may be empty (no characters). When power is present, the path must either be empty or start with a slash ("/"). when there is no authority, the path cannot begin with two slash characters ("//"). These restrictions lead to five different ABNF rules for the path (section 3.3), only one of which will match any using a URI reference.

  The following are two example URIs and their component parts: foo://example.com:8042/over/there?name=ferret#nose \_/ \______________/\_________/ \_________/ \__/ | | | | | scheme authority path query fragment | _____________________|__ / \ / \ urn:example:animal:ferret:nose 
+2
source

Source: https://habr.com/ru/post/1446747/


All Articles