BA N G A BA N D H U SH E I K H MUJ I BUR RA H MA N D I G I TA L
UN I V E R SI T Y
HTTP Protocol
BY: MONIRUZZAMAN HEMAL
Presentation Outline
POI NT S OF DI S CUS SI ON
Web and HTTP?
ObjectivesHow HTTP works?
HTTP client server communication
HTTP request and response
Persistent and Non-persistent method
TH E W E B
Internet (or The Web) is a massive distributed client/server
information system
Internet
(The Web)
Many applications are running concurrently over the Web, such as web
browsing/surfing, e-mail, file transfer, audio & video streaming, and so on. In order
for proper communication to take place between the client and the server, these
applications must agree on a specific application-level protocol such as HTTP, FTP,
TH E H TTP P ROTOCOL
HTTP (Hypertext Transfer Protocol) is perhaps the most popular application
protocol used in the Internet (or The WEB).
HTTP= Hypertext Transfer
Protocol
HTTP is an application-layer protocol for transmitting
hypermedia documents, such as HTML.
HTTP is a client-server protocol by which two machines
communicate using a reliable, connection-oriented transport
service such as the TCP.
HTTP is used for transferring information like document, file, image,
video between computers over internet.
The Basic Features of HTTP
HTTP is media Any type of media content can be sent by HTTP as long as both
independent: the server and the client can handle the data content.
HTTP is A browser initiates the HTTP request and after the request is sent
connectionless: the client disconnects from server and waits for the response.
The client and server are aware of each other during a current request only. Afterwards,
HTTP is
both of them forget each other. Due to the stateless nature of protocol, neither the client
stateless: nor the server can retain the information about different request across the web pages.
HOST(BROWSE TARGET(SERVER)
R)
APPLICATION LAYER (HTTP) APPLICATION LAYER (HTTP)
TRANSPORT LAYER (TCP) TRANSPORT LAYER (TCP)
NETWORK LAYER (IP) NETWORK LAYER (IP)
INTERNET
DATA LINK LAYER DATA LINK LAYER
HTTP
HTTP Request
client
HTTP Response server
HTTP & DNS
n.c om
.a m azo
ww w
DNS server
s I P :
vi d e
Pro . 0 .1
10 . 1
MAKES HTTP
REQUEST
HTTP RESPONSE
TARGET SERVER
USER WITH WEB
BROWSER amazon.com
Uniform Resource Locator (URL)
A URL is used to uniquely identify a resource over the web. URL has the following syntax:
protocol://hostname:port/path-and-file-name
There are 4 parts in a URL:
Protocol: The application-level protocol used by the client and server, e.g., HTTP,
FTP, and telnet.
Hostname: The DNS domain name (e.g., www.nowhere123.com) or IP address (e.g.,
192.128.1.2) of the server.
Port: The TCP port number that the server is listening for incoming requests from
the clients.
Path-and-file-name: The name and location of the requested resource, under the
For example, in the URL
http://www.nowhere123.com/docs/index.html
The communication protocol is HTTP;
The hostname is www.nowhere123.com.
The port number was not specified in the URL, and
takes on the default number, which is TCP port 80
for HTTP.
The path and file name for the resource to be
When this request message reaches the
server, the server can take either one of
these actions:
The server interprets the request received, maps the request
into a file under the server's document directory, and returns the
file requested to the client.
The server interprets the request received, maps the request
into a program kept in the server, executes the program, and
returns the output of the program to the client.
The request cannot be satisfied, the server returns an error
message.
HTTP message format
# HTTP request message:
HTTP Request message format
<method> is the operation to
perform on URL
<request-URL> can be full URL or just the
path part
<version> is of the form
HTTP/<major>.<minor>
<entity-body> is a stream of bytes (could
be empty)
HTTP Request Headers
Host: www.joes-
hardware.com
– Host from the request
User-Agent:URL
Mozilla/4.0
– Client application making the
request
Accept: text/html, text/xml
– MIME types the client can
handle
Referer:
http://www.joes-hardware.com/index.html
– Page that contained the link currently being
requested
If-Modified-Since: Tue, 3 Oct 1974 02:16:00 GMT
– Conditional request; only send the document if it changed since I last
retrieved it
HTTP message format
# HTTP response message:
HTTP Response message format
<version> is of the form
HTTP/<major>.<minor>
<status> is a 3-digit number indicating
status of request
<reason-phrase> human-readable
description of status code
<entity-body> is a stream of bytes (could
be empty)
HTTP Response Headers
Content-length: 15023
– Length of response entity body measured
in bytes
Content-type: text/html
– MIME type of response entity
body
Server: Apache/1.2b6
– Server software that handled the
request
Cache-Control: no-cache
– Clients must not cache the response
document
HTTP Request Methods
GET – Retrieve document from
server
PUT – Store document on
server
DELETE – Remove document from
server
POST – Send data to server for
processing
HEAD – Retrieve document headers from
server
OPTIONS – Determine what methods the server
supports
TRACE – Trace the path taken by a request through proxy
servers on the way to the destination server
HTTP Response status codes
100-199
Informational
200-299
Successful
300-399
Redirection
400-499 Client
error
500-599 Server
error 200 OK
502 Bad Gateway
401 Unauthorized to access resource
404 Requested resource does not exist
Persistent Connection
Client initiates Server Accepts
TCP Connection Connection
Client sends HTTP Sender Receives Request,
Request Message Sends Responde Message
Client Receives Response,
Finds 10 more references
Repeat 10x
Server Closes TCP Connection
Non-Persistent
Connection
Client initiates Server Accepts
TCP Connection Connection
Client sends HTTP
Sender Receives Request,
Request Message
Sends Responde Message
Client Receives Response,
Finds 10 more references
Server Closes TCP Connection
Repeat 10x
Persistent Connection
1
3
Network 2 By opening and
congestion is
much more closing fewer 4
reduced by
effi ciently, with TCP Reuse open
reducing the
much lower connections, connection
number of
elapsed time. CPU time is
packets
saved
caused by
in routers
TCP opens
and hosts
Method types
HTTP/1.0: HTTP/1.1:
GET GET, POST, HEAD
POST
HEAD
PUT
asks server
uploads file in
to leave
entity
requested body to path
object out of DELETE specified
response in URL field
deletes file
specified in
the URL field
HTTP Cookies
HTTP allows the server to store a small amount of state on
the client
Each request from the client to the server contains the state
previously stored by that server on the client
This way the server can “remember” who the client is and
something about them
Related Questions
Related Questions
Related Questions
Thank you for your
time.