0% found this document useful (0 votes)
10 views

HTTP

The document describes Hypertext Transfer Protocol (HTTP), including what hypertext is, how HTTP works, the client-server model, HTTP requests and responses, features of HTTP such as being stateless and connectionless, common HTTP request commands like GET and POST, and status codes. HTTP is the underlying protocol used to deliver web pages on the World Wide Web.

Uploaded by

MD ASMATH SHAIKH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

HTTP

The document describes Hypertext Transfer Protocol (HTTP), including what hypertext is, how HTTP works, the client-server model, HTTP requests and responses, features of HTTP such as being stateless and connectionless, common HTTP request commands like GET and POST, and status codes. HTTP is the underlying protocol used to deliver web pages on the World Wide Web.

Uploaded by

MD ASMATH SHAIKH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Hypertext Transfer

Protocol(HTTP)
What is Hypertext?
⚫ Hypertext is a text that contains links to other texts(present
in same or different document).
⚫ By selecting a link, you are able to jump immediately to
another part of the document or even to a different
document.
⚫ In the WWW, links can go not only from one document to
another, but from one computer to another.
⚫ Browser is required to view and navigate hypertexts.
⚫ HTML language is used to create it.
HyperText Transfer Protocol
⚫ It is a protocol used by WWW for data communication
between web client (browser) and web server.
⚫ HTTP protocol defines how messages are prepared and
transmitted during web client and web server
communication.
⚫ It also defines what actions web server and browser should
take in response to various commands.
⚫ HTTP is a TCP/IP based communication protocol that is
used to deliver data which may be HTML files, image
files, query results, etc. on the web.
HTTP Protocol:Request & Response
⚫ HTTP is based on the client-server architecture model and
a stateless request/response protocol that operates by
exchanging messages across a reliable TCP/IP connection.
Client-Server Model
⚫ Web Client
⚫ It communicates with web server using a set of rules
(specified by HTTP protocol).
⚫ It uses HTTP protocol to communicate with the web server
to access resources specified by the URL.
⚫ Web server
⚫ It waits for incoming requests, process the requests, identify
the correct resource and finally responds with the desired
resource.
HTTP Protocol:Request & Response
⚫ HTTP is based on the client-server architecture model and
a stateless request/response protocol that operates by
exchanging messages across a reliable TCP/IP connection.
⚫ HTTP client (Web browser)
⚫ HTTP client is a program that establishes a connection to a
server for the purpose of sending one or more HTTP request
messages.
HTTP Protocol:Request & Response
⚫ HTTP server (web server)
⚫ It is a program that accepts connections in order to serve
HTTP requests by sending HTTP responses messages.

⚫ HTTP status codes (error messages)


⚫ HTTP status codes are response codes given by web servers
and help identify the cause of problem.
⚫ Example :Error 404-File Not Found
Features of HTTP protocol
⚫ HTTP is connectionless
⚫ Browser (HTTP client) initiates a HTTP request and after a
request is made, the client waits for the response from the
server.
⚫ The server processes the request and sends a response.
⚫ After getting response client disconnects the connection.
⚫ No connection remain established forever between server
and client.
⚫ For every new request, a new connection is established
between them.
Features of HTTP protocol
⚫ HTTP is media-independent
⚫ Any type of data can be sent by HTTP such as audio, video,
images, etc.
⚫ It may be HTML file, CSS file, JS file or data.
Features of HTTP protocol
⚫ HTTP is stateless
⚫ Stateless means there is no record of previous interactions and
each interaction request has to be handled based entirely on
information that comes with it.
⚫ HTTP is stateless because each request from a user for a
webpage or URL results in the requested pages being served, but
without the web(HTTP) server remembering the request later.
⚫ In other words, there is no recorded continuity. Each
communication is discrete and unrelated to those that precede or
follow.
⚫ That is, each request-response pair is handled independently.
HTTP :Request & Response
⚫ Messages which are transmitted between web server and web
browser are of two types :
⚫ Request Message
⚫ A request message is sent by a web client to the web server.

⚫ Response Message
⚫ In response to the request message, a response message is sent by a
server to the client.
HTTP Request Message
A request message consists of the following parts :
⚫ A request line
⚫ A header
⚫ An empty line
⚫ An optional body
HTTP Request Message
⚫ Request Line
⚫ It consists of three parts : Request type, URL, and HTTP
version.
⚫ Two consecutive parts are separated by a space.
⚫ Request type : is the type of request a client wants to send.
HTTP Request Message
⚫ Header fields
⚫ This is a collection of optional lines allowing additional
information about the request and/or the client (browser,
operating system, etc.).
⚫ Each of these lines is composed of a name describing the
header type, followed by a colon (:) and the value of the
header.
⚫ Body of the request : This is a collection of optional lines
which must be separated from preceding lines by an empty
line.
HTTP Request Message
HTTP Request Commands
⚫ GET
⚫ Request for the resource located at the URL.
⚫ HEAD
⚫ Request for the header of the resource located at the specified
URL and not the content.
⚫ POST
⚫ Sends data to the program located at the specified URL.
⚫ PUT
⚫ Sends data to the specified URL
⚫ DELETE
⚫ Deletes the resource located at the specified URL.
HTTP Response Message
A HTTP response is a collection of lines sent by the
server to the browser.
It includes :
⚫ A status line
⚫ A response header
⚫ An empty line
⚫ Body of the response
HTTP Response Message
⚫ Status Line
⚫ This is a line specifying the protocol version used and the
status codes of the request being processed using a code and
explanatory text.

⚫ Response header
⚫ Body of the response
⚫ This contains the requested document.
HTTP Status codes
These are response codes given by web server to help identify the cause
of the problem.
⚫ 10x : Informational message
⚫ These codes are not used in version 1.1 of the protocol.
⚫ 20x : Success
⚫ These codes indicate the smooth running of the transaction.
⚫ 30x : Redirection
⚫ These codes indicate that resource is no longer in the location specified.
⚫ 40x : Error due to the client
⚫ These codes indicate that the request is incorrect.
⚫ 50x : Error due to the server
⚫ These codes indicate that there is an internal error in the server.
Example 1
⚫ This example retrieves a document. We use the GET
method to retrieve an image with the path
/usr/bin/image1. The request line shows the method
(GET), the URL, and the HTTP version (1.1). The
header has two lines that show that the client can
accept images in the GIF or JPEG format. The
request does not have a body. The response message
contains the status line and four lines of header. The
header lines define the date, server, MIME version,
and length of the document. The body of the
document follows the header.
Example 1

You might also like