HTTP

Browsers and Web servers use a special protocol, called the HyperText Transfer Protocol (HTTP), which specifies how a browser should format and send a request to a Web server. The client browser sends a document request consisting of a line of characters terminated by a CR/LF (carriage return/line-feed) pair. A well-behaved server will not require the carriage return character. This request consists of the word GET, a space, and the location of the document relative to the root of the Web server's file system. When a Web server/site is configured, it is usually set up to use a particular directory on the host machine's local file system as the Web site's root directory. Documents are found relative to this directory.

Document Identification

The full identifier for referencing and obtaining the document is called a uniform resource locator (URL). It identifies the protocol (HTTP), host machine name, optional port number, and document name/location. A URL is a single word with no white space. Any further words found on the request line are either ignored or treated according to the full HTTP spec.

A URL is a way to specify an object, or resource, on the network. A URL is like the network equivalent for specifying a file name on a file system. A URL can be used to request many types of objects with different protocols. In addition to HTTP, common Internet protocols include news, FTP, Gopher, and file. Each protocol is specific to the type of information or resource it represents.

When HTTP is specified, the object is a Web page. The following URL requests a Web page from a host identified by www.wae-uml.org:

http://www.wae-uml.org/specs/wd/cav43.html

The document name is cav43.html and is located in the directory /specs/wd/. This directory is relative to the Web site's root directory on the Web server.

A more explicit reference to this page could include the port number; however, the default port number, 80, is usually assumed for all HTTP requests:

http://www.wae-uml.org:80/specs/wd/cav43.html

It is possible to configure the Web server to listen to a port other than 80. This is often done to create a "private" Web site. Some Web servers monitor an additional port and use it for Web configuration. This allows Web mastersthose responsible for managing a Web server and siteto remotely manage a Web server's configuration with just a browser. This type of configuration tool is an example of a small Web application.

Domain Names

A domain name is simply the textual name used to look up a numeric Internet address. The Internet addressing system in use today is the Internet Protocol (IP).[1] When a client requests a URL, the request must be made directly to the host computer. This means that the host name identified in the URL must be resolved into a numeric IP address. This process is done with a domain name server (DNS). A DNS is a network computer that the client has access to and that has a known IP address. Network infrastructure software on the client knows how to request the IP address from a DNS for a given domain name.

[1] The version in use today is version 4 (IPv4) and is a 32-bit number.The next version, 6 (IPv6) version 5 was skippedis a 128-bit number and is expected to replace IPv4 in the coming years.

The host name www.wae-uml.org is made up of two distinct parts. The rightmost dot in the name is used to separate the host name from its top-level domain (TLD), in this case com. The wae-uml part is the subdomain. The term domain name often refers to the combination of the top-level domain and the subdomain. In this case, the domain name is wae-uml.org, and it is this name that I "own." As owner of this domain name, I am responsible for ensuring that an IP address is associated with the domain. Reserving a domain name and not using it to host a Web site or application is referred to as "parking" the domain name, with the expectation that a real host will soon respond meaningfully to this domain name.

When I registered that domain name, I used one of the official registrars delegated the authority to assign domain names. In order to reserve a domain, I had to supply the IP addresses of two name servers (DNS) that would act as the authoritative source for translating the domain name into a valid IP address. It is on this server that I have the rights to adjust, as necessary, the IP address that I want associated with the domain name and all its mutilevel variations. So in my case, I created records in the DNS to equate wae-uml.org, www.wae-uml.org, and test.wae-uml.org to the specific IP address of my host computer.

The www and test parts are third-level domains, and their usage is up to the discretion of the host owner. The convention is to use www for HTML Web sites, ftp for FTP servers, nntp for Usenet news servers, and so on, although this shouldn't be confused with the protocol specification part of a URL (see discussion of protocols in this chapter). Third-level domain names serve only as a convenience to host machine administrators and are not part of the domain name ownership process; nor do they impact types of protocols that are used.

Any host can receive the requests for multiple domains. When it makes an HTTP request for a resource to a server, a client application typically includes the full URL that was used to resolve the IP address. The server, with a single IP address, can receive a request and look at the URL to determine which application or separate Web site should handle the request. This is how many Internet service providers (ISPs) can offer basic hosting capabilities to customers with custom domain names on shared machines. I've set up my server to point to a portal application when the request is for wae-uml.org and www.wae-uml.org and to a simple test HTML Web site for test.wae-uml.org.

The two types of top-level domains are generic and country specific. An additional one, .arpa, is dedicated to Internet infrastructure. Recently, the list of generic top-level domains was expanded; however, .com, .edu, .net, and .org continue to be the ones most of us recognize. Each domain is intended for a particular type of use. For example, .com domains are for commercial businesses; .net, for Internet service providers; .org, for nonprofit organizations; and .edu, for educational institutions.

Country-specific domains are managed by organizations in individual countries and can define the usage of the second-level domain in any way they want. For example, the .uk top-level domain of the United Kingdom defines a number of second-level domains, such as .co.uk, .me.uk, .org.uk, plc.uk, and ltd.uk, each with its own expected uses. It isn't until the third-level domain is specified that individual organizations can claim ownership.

TLDs are managed by a single authority: Internet Corporation for Assigned Names and Numbers (ICANN, www.icann.org), with the distribution of Internet numbers managed by Internet Assigned Numbers Authority (IANA, www.iana.org). In the vast majority of situations, you will work through an official registrara company responsible for selling domainsor an ISP rather than work directly with these organizations.

Resource Identifiers

Related to the URL is the uniform resource identifier (URI) and the uniform resource name (URN).[2] Simply put, a URI is a superclass to URLs and URNs, whereas the URI is simply an identifier of a resource on the Internet, nothing more. A URL, on the other hand, is a name that includes an access mechanism: name of host server. The URN is required to "remain globally unique and persistent even when the resource ceases to exist or becomes unavailable." [3] For all practical purposes, we as Web application developers are interested mostly in URLs since it is these identifiers that we use to connect our Web pages to form a system.

[2] An excellent, detailed discussion of URIs by Tim Berners-Lee can be found at http://www.w3.org/DesignIssues/Axioms.htm.

[3] The World Wide Web Consortium (W3C) report "URIs, URLs, and URNs: Clarifications and Recommendations," at http://www.w3.org/TR/2001/NOTE-uri-clarification-20010921/, is an excellent resource for exploring this topic further.

Fault Tolerance

One important design goal of Web systems is that they be robust and fault tolerant. In the first Web systems at CERN, Web documents, computers, and network configurations were often subject to change. This meant that it was possible for Web pages to contain links to documents or host computers that no longer existed. It is even possible for the HTML specification itself to change, by adding elements, or tags. The browsers and Web servers of the system have to deal gracefully with these conditions.

This desire for a high degree of fault tolerance led in part to the decision to use a connectionless protocol, such as HTTP, as the principal protocol for managing document requests. HTTP is considered a connectionless protocol because as soon as the request is made and fulfilled, the connection between the client and server is terminated. The connection is broken by the server when the whole document has been transferred. The client can abort the transfer by breaking the connection before the transfer completes, in which case the server doesn't record any error condition. The server doesn't need to store information about the request after disconnection. This enables hosts and clients to act more independently and is more resistant to temporary network outages.

HTTP runs over TCP (Transmission Control Protocol), but could run over any connection-oriented service. TCP, a lower-level network protocol used by the Internet and many company networks, enables computers to make connections and to exchange information with one another. TCP, usually combined with IP, is an implementation of layers in the OSI (Open Systems Interconnection) model for network communications.

HTTPSHTTP with Secure Sockets Layer (SSL)is related to HTTP but uses encryption to help "secure" the communication. HTTPS is used on the Internet for handling sensitive data such as personal and financial information. More detailed discussion of security and encryption is in Chapter 5, Security.

Категории