Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Url Format: Empty Path

Tags:

http

url

format

I have questions regarding the URL path format.

A url has a authority and a path. Now the question here is what is with an empty path (no path segments).

The following is considered.

  1. The leading slash is part of the path. '/' is a path in http.//domain/
  2. A empty path is actually a segment with a empty string as name "".

Those two assumption would lead to the following results:

A. http.//domain?query, http.//domain#fraction, http.//domain would be legal URL strings

B. The following domain path would be extracted for the given domains.

  • http.//domain -> segments = {}
  • http.//domain/ -> segments = {''}
  • http.//domain/a -> segments = {'a'}
  • http.//domain/a/ -> segments = {'a', ''}
  • http.//domain/a/b -> segments = {'a', 'b'}
  • http.//domain/a/b/ -> segments = {'a', 'b', ''}
  • http.//domain//// -> segments = {'', '', '', '', ''}`

Is this the correct interpretation?

PS: I used 'http.//' instead of 'http://' to avoid complains about illegal links.

like image 975
Martin Kersten Avatar asked Oct 22 '25 13:10

Martin Kersten


1 Answers

That is correct. You can read the full URL specification (RFC 3986). Specifically section 3.3.

like image 187
mcrumley Avatar answered Oct 25 '25 07:10

mcrumley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!