Understanding the use of Hypertext Transfer Protocol (HTTP)

Cartoon man typing on keyboard, looking at computer screen.

Hypertext Transfer Protocol or HTTP is the protocol used in each transaction of the internet. HTTP was developed by the World Wide Web Consortium and the Internet Engineering Task Force, a collaboration that culminated in 1999 with the publication of a series of RFCs, the most important of them is the RFC 2616 that specifies version 1.1.

HTTP defines the syntax and semantics using the software elements of the web architecture (clients, servers, proxies) to communicate. It is a transaction-oriented protocol and follows the request-response between a client and a server.

The requesting client (a web browser or spider) is known as user agent. The information transmitted is called resource and is identified by a Uniform Resource Locator (URL). File resources may be the result of the execution of a program, a query to a database, the machine translation of a document, etc.

HTTP is a stateless protocol , that is, it does not keep any information about previous connections. The development of Web applications often need to maintain state.

For this cookies are used, which is information that a server can store on the client system. This allows web applications to establish the notion of session, and also allows users to track because the cookies can be stored in the client indefinitely.

HTTP Transactions

An HTTP transaction consists of a header, optionally followed by a blank line and some data. The header specifies things like the action required of the server, the type of data returned, or the status code.

A header is a data block that precedes the information itself, so often referred to as metadata – that is data about data.

If you receive header lines the client, the server puts in the CGI environment variables with the prefix HTTP_ followed by the header name. Any character hyphen (-) the name of the header is converted to character “_”.

The server sends the client:

A status code indicating whether the request was successful or not. Typical error codes indicate that the requested file was not found, the request is not made correctly or authentication is required to access the file.

The information itself. HTTP is capable of sending documents of all types and formats, ideal for streaming media, such as graphics, audio and video. This freedom is one of the biggest advantages of HTTP.
Information about the object that is returned.

Keep in mind that the list is not a complete list of the header fields and some of them only make sense in one direction.

About the Author