Sei sulla pagina 1di 18

Hypertext

Transfer Protocol
(HTTP)

Hypertext Transfer Protocol


Browser and server communicate using
HTTP
simple set of rules designed to be suitable for
hypermedia systems distributed across
networks

HTTP defines a simple request-response


conversation

Hypertext Transfer Protocol


HTTP does define how to correctly format
the request and the response
the client- often but not necessarily a browseris the requesting program and establishes a
connection to the receiving program or server
the server replies with a response including
the requested information if possible

Hypertext Transfer Protocol


HTTP does not define:
how the network connection is made or
managed,
how the information is actually transmitted
(this is done by lower-level protocols such as
TCP/IP)

HTTP requests consist of a method, a


Universal Resource Identifier (URI), a
protocol version, and other information.

HTTP

The Hypertext Transfer Protocol is used mainly to


access data on the World Wide Web.
The protocol transfers data in the form of plain text,
hypertext, audio, video, and so on. It is called the
Hypertext Transfer Protocol.
It is used in an environment where there are rapid
jumps from one document to another.
HTTP functions like a combination of FTP and SMTP.

It is similar to FTP because it transfers files and


uses the services of TCP.
HTTP uses the services of TCP on well-known
port 80.
There is no separate control connection; only
data are transferred between the client and the
server.
HTTP differs from SMTP in the way the
messages are sent from the client to the server
and from the server to the client.
SMTP messages are stored and forwarded, but
HTTP messages are delivered immediately.

HTTPTransaction

Messagecategories:

There are two general types of HTTP messages: request and


response.

Request Messages:
A request message consists of a request line, headers, and
sometimes a body.
Request Line
The request line defines the request type, resource (URL),

Requestmessage

Requestline

Uniform Resource Locator (URL). A client that wants to access a Web


page needs an address.
The URL is a standard for specifying any kind of information on the Internet.

Uniform Resource Locator (URL).


The URL defines four things: method, host computer, port, and path.
The method is the protocol used to retrieve the document.
The host can be any name given to the computer that hosts the
Web page.
The port number of the server. If the port is included, it is
inserted between the host and the path, and it should be
separated from the host by a colon.
Path is the path name of the file where the information is
located.

The request type field in a request message defines several kinds of messages
referred to as methods.
GET The GET method is used when the client wants to retrieve a document
from the server.
HEAD The HEAD method is used when the client wants some information
about a document .
POST The POST method is used by the client to provide some information to
the server.
PUT The PUT method is used by the client to provide a new or replacement
document to be stored on the server.
PATCH PATCH is similar to PUT
COPY The COPY method copies a file to another location.
MOVE The MOVE method moves a file to another location.
DELETE The DELETE method removes a document on the server.
LINK The LINK method creates a link or links from a document to another
location. UNLINK The UNLINK method deletes links created by the LINK
method.

Responsemessage

A response message consists of a status line, a header, and sometimes a


body. The status line defines the status of the response message.

Statusline: Statuscode:SameformatasFTPresponses(threedigits)

Headerformat:

Headers
The headers exchange additional information between the client and the
server.
The header can be one or more header lines.
Each header line is made of a header name, a colon, a space, and a header
value
A header line belongs to one of four categories:
General header,
Request header,
Response header, and
Entity header.

General Header
The general header gives general information about the message
and can be present in both a request and a response.
Request Header
The request header can be present only in a request message. It
specifies the clients configuration and the clients preferred
document format.
Response Header
The response header can be present only in a response message. It
specifies the servers configuration and special information about
the request.
Entity Header
The entity header gives information about the body of the document.
Although it is mostly present in response messages, some request
messages, such as POST and PUT methods, that contain a body
also use this type of header.

Headers

Potrebbero piacerti anche