HyperText Transfer Protocol (HTTP)
Web and HTTP
Web terminology:
A web page consists of objects.
Object can be HTML file, JPEG image, Java applet,
audio file, video clip, …
A web page consists of a base HTML-file which includes
several referenced objects.
Each object is addressable by a URL.
Example URL:
[Link]/someDept/[Link]
host name path name
2
HTTP Overview
HTTP: HyperText Transfer HT
T
Pr
Protocol equ
PC running HTT est
Web’s application layer protocol Explorer P r
esp
o ns
client/server model e
client: a browser that
est
u
requests, receives and r eq
T P o nse Server
“displays” Web objects. HT p
r es running
T P Apache Web
server: a Web server sends HT server
objects in response to
requests.
Mac running
Navigator
3
Characteristics of HTTP
HTTP is IP based communication protocol that is
used to deliver data from server to client or vice-versa.
Any type of content can be exchanged as long as the
server and client are compatible with it.
It is a request and response protocol based on client
and server requirements.
Computer Networks HTTP 4
HTTPS
HTTPS stands for Hyper Text Transfer Protocol Secure. HTTP Secure
(HTTPS), could be a combination of the Hypertext Transfer Protocol
with the SSL.
HTTPS is more secure than HTTP because HTTPS is certified by the
SSL(Secure Socket Layer).
HTTPS encrypts all message substance, including the HTTP headers
and the request/response data.
Computer Networks HTTP 5
Working of HTTP
There is a connection that
becomes open between the
client and the webserver
through the TCP.
After that, the HTTP sends a
request to the server that mainly
collects the requested data.
The response with the objects is
sent back to the client by HTTP
At last, HTTP closes the
connection.
Computer Networks HTTP 6
HTTP Overview (continued)
Uses TCP: HTTP is “stateless”
client initiates TCP connection server maintains no
(creates socket) to server, port information about past
80. client requests.
server accepts TCP connection
from client. aside
HTTP messages (application- Protocols that maintain “state”
layer protocol messages) are complex!
exchanged between browser • past history (state) must be
(HTTP client) and Web server maintained.
(HTTP server). • if server/client crashes, their
TCP connection closed. views of “state” may be
inconsistent, must be
reconciled.
7
HTTP Connections
Non-persistent HTTP
At most one object is sent over a TCP connection.
HTTP 1.0
Persistent HTTP
Multiple objects can be sent over single TCP
connection between client and server.
HTTP 1.1
8
(contains text,
Nonpersistent HTTP references to 10
jpeg images)
Suppose user enters URL
[Link]/someDepartment/[Link]
1a. HTTP client initiates TCP
connection to HTTP server
(process) at [Link]
1b. HTTP server at host
[Link] waiting
on port 80.
for TCP connection at port 80.
“accepts” connection, notifying
client.
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection 3. HTTP server receives request
socket. Message indicates that message, forms response
client wants object message containing requested
someDepartment/[Link] object, and sends message into
its socket.
time
9
Nonpersistent HTTP (cont.)
4. HTTP server closes TCP
connection.
5. HTTP client receives response
message containing html file,
displays html. Parsing html file,
finds 10 referenced jpeg objects.
May be done as
parallel TCP connections.
time 6. Steps 1-5 repeated for each of 10
jpeg objects.
Computer Networks HTTP 10
HTTP 1.0 Behavior
Figure 9.4 HTTP 1.0 Behavior
Computer Networks HTTP 11
HTTP 1.1 Behavior
Figure 9.5 HTTP 1.1 Behavior with Persistent
Connections
Computer Networks HTTP 12
Table 9.1 HTTP Request Operations
Computer Networks HTTP 13
HTTP Response Status Codes
200 OK
request succeeded, requested object later in this message.
301 Moved Permanently
requested object moved, new location specified later in this
message (Location:).
400 Bad Request
request message not understood by server.
404 Not Found
requested document not found on this server.
505 HTTP Version Not Supported
Computer Networks HTTP 14