Friday, February 4, 2011

The components of a URL


A URL (Uniform Resource Locator) is a specific type of URI (Universal Resource Identifier). A URL normally locates an existing resource on the Internet. A URL is used when a Web client makes a request to a server for a resource.
The concepts of the URI and the URL are defined by the Internet Society and IETF (Internet Engineering Task Force) Request for Comments document RFC 2396, Uniform Resource Identifiers (URI): Generic Syntax (http://www.ietf.org/rfc/rfc2396.txt). Briefly, a URI is defined as any character string that identifies a resource. A URL is defined as those URIs that identify a resource by its location or by the means used to access it, rather than by a name or other attribute of the resource.
A URL for HTTP (or HTTPS) is normally made up of three or four components:
  1. A scheme. The scheme identifies the protocol to be used to access the resource on the Internet. It can be HTTP (without SSL) or HTTPS (with SSL).
  2. A host. The host name identifies the host that holds the resource. For example, www.example.com. A server provides services in the name of the host, but there is not a one-to-one mapping between hosts and servers. Host names explains more about host names.
    Host names can also be followed by a port numberPort numbers explains more about these. Well-known port numbers for a service are normally omitted from the URL. Most servers use the well-known port numbers for HTTP and HTTPS , so most HTTP URLs omit the port number.
  3. A path. The path identifies the specific resource within the host that the Web client wants to access. For example,/software/htp/cics/index.html.
  4. A query string. If a query string is used, it follows the path component, and provides a string of information that the resource can use for some purpose (for example, as parameters for a search or as data to be processed). The query string is usually a string of name and value pairs, for example,q=bluebird.
The scheme and host components of a URL are not defined as case-sensitive, but the path and query string are case-sensitive. Usually, the whole URL is specified in lower case.
The components of the URL are combined and delimited as follows:
scheme://host:port/path?query
  • The scheme is followed by a colon and two forward slashes.
  • If a port number is specified, that number follows the host name, separated by a colon.
  • The path name begins with a single forward slash.
  • If a query string is specified, it is preceded by a question mark.
Figure 1. Syntax of an HTTP URL
Read syntax diagramSkip visual syntax diagram
                            .-:80-----.                      
>>-http://--+-host name--+--+---------+--/--path component------>
            '-IP address-'  '-:--port-'                      

>--+-----------------+-----------------------------------------><
   '-?--query string-'   

This is an example of an HTTP URL:
http://www.research.ibm.com/software/htp/cics/index.html
If a port number was specified, the URL would be:
http://www.research.ibm.com:1030/software/htp/cics/index.html
Start of changeA URL can be followed by a fragment identifier. The separator used between the URL and the fragment identifier is the # character. A fragment identifier is used to point a Web browser to a reference or function within the item that it has just retrieved. For example, if the URL identifies an HTML page, a fragment identifier can be used to indicate a subsection within the page, using the ID of the subsection. In this case, the Web browser normally displays the page to the user so that the subsection is visible. The action taken by the Web browser for a fragment identifier differs depending on the media type of the item and the defined meaning of the fragment identifier for that media type.End of change
Other protocols, such as File Transfer Protocol (FTP) or Gopher, also use URLs. The URLs used by these protocols may have a different syntax to the one used for HTTP.

1 comment:

  1. Hi Dear, are you in fact visiting this site on a regular basis, if so then you will without doubt get pleasant experience.

    ReplyDelete