Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's different between URI, request-URI and URL?

Tags:

url

uri

web

I'm learning Web tech and teacher cannot give me a satisfactory explanation. I'd like to give a few example, please help me to point out am I right.

  • I know URL is a subset of URI
  • http://www.example.org:56789/a/b/c.txt?t=win&s=chess#para5 is a URL and also a URI
  • every address we type in browsers can be called URL
  • http://www.example.org:56789/ is also a URI
  • the part: a/b/c.txt?t=win&s=chess is request-URI
  • the part: para5 does not belong to the request-URI is just a fragment
like image 992
Microos Avatar asked Jan 18 '16 07:01

Microos


People also ask

What is the difference between URI and URL?

URL is used to describe the identity of an item. URI provides a technique for defining the identity of an item. URL links a web page, a component of a web page or a program on a web page with the help of accessing methods like protocols. URI is used to distinguish one resource from other regardless of the method used.

What is request URI of a URL?

The request URI is the uniform resource identifier of the resource to which the request applies. While URIs can theoretically refer to either uniform resource locators (URLs) or uniform resource names (URNs), at the present time a URI is almost always an HTTP URL that follows the standard syntax rules of Web URLs.

What are the two types of URI?

Types of Uniform Resource Identifiers. Uniform Resource Locators (URLs) and Uniform Resource Names (URNs) are two types of URI.

Is a URI a type of URL?

URL is a useful but informal concept: a URL is a type of URI that identifies a resource via a representation of its primary access mechanism (e.g., its network "location"), rather than by some other attributes it may have. As such, a URL is simply a URI that happens to point to a resource over a network.


2 Answers

The URI standard is STD 66, which currently maps to RFC 3986.

URI vs. URL

Section 1.1.3 describes the difference between URIs and URLs (and URNs).

Components

Section 3 describes the components a URI can have.

For the URI http://www.example.org:56789/a/b/c.txt?t=win&s=chess#para5 these would be:

  • Scheme: http

  • Authority: www.example.org:56789

  • User Information: not present

  • Host: www.example.org

  • Port: 56789

  • Path: /a/b/c.txt

  • Query: t=win&s=chess

  • Fragment: para5

request-URI

The term "request-URI" is not defined or even used in STD 66 / RFC 3986.

like image 135
unor Avatar answered Oct 20 '22 08:10

unor


The term "Request-URI" is defined by the HTTP standard (RFC 2616, §5.1.2), and refers to the URL as it is given in the actual HTTP request.

In normal HTTP requests, the URL scheme and host have already been handled by the time the request is sent (and the URL fragment does not exist at the HTTP protocol level at all), meaning the Request-URI is a path-absolute-URL string, possibly followed by ? and a URL-query string.

That is to say, this part of the complete URL:

https://example.org/path/to/file?param=42#fragment
                   ^^^^^^^^^^^^^^^^^^^^^^

Note that it includes the leading /.

Exceptions to this include:

  • For e.g. the OPTIONS HTTP method, the Request-URI may simply be *.
  • When the HTTP server is acting as a proxy, the Request-URI may be a complete absolute-URL string (still excluding the fragment).
  • Other, more elaborate/non-standard things.
like image 24
Søren Løvborg Avatar answered Oct 20 '22 08:10

Søren Løvborg