Title: Hooman nili
1The WWW Part 3 How Clients Severs work
together via HTTP
Hooman nili
2HTTP Message Construction - Simplified
Browser
Application (HTTP)
HTTP Message
Transport (TCP)
TCP Segment
Internet (IP)
IP Datagram
Network Technology
?
Network (The Internet)
Network-ready packet/datagram
3How Client and Server work together
- Initiating (starting )Communication
- The three-way handshake Connections
- Persistence
- Pipelining
41. Initiating Communication
1
Request
Response
2
52. The three-way (3W) handshake
1
TCP SYN (Hello, Im a client. Can I ask for
something?)
TCP SYN-ACK (Hello, Im a Server. Sure, Go ahead)
2
3
TCP ACK (OK, Thank you!)
4
HTTP Request (Give us this file. Will you.)
HTTP Response (Here you are.)
5
TCP FIN (Finished that request)
6
7
TCP FIN-ACK (OK, Im finished with that req. too)
62. The three-way (3W) handshake
1 TCP SYN 2 TCP SYN-ACK 3 TCP ACK TCP
connection is ESTABLISHED.
72. The three-way (3W) handshake
TCP SYN TCP Synchronise flag TCP SYN-ACK TCP
Synchronise and Acknowledge flag TCP ACK TCP
Acknowledge flag TCP FIN TCP Finished flag TCP
FIN-ACK TCP Finished and Acknowledge flag
83. Persistence
A client can issue more than one HTTP request
over the same TCP connection (Newer version of
HTTP i.e. HTTP 1.1). Persistence improves web
servers efficiency and performance. Even with
persistence the client still has to send a
request for each object (aka item, or resource).
93. Persistence
103. PersistenceMany reqs same TCP con.
1
TCP SYN
TCP SYN-ACK
2
3
TCP ACK
4
HTTP Request (Give us that web page)
HTTP Response (Here you are.)
5
6
HTTP Request (Give us this image)
HTTP Response (Here you are.)
7
TCP FIN (Finished that request)
8
9
TCP FIN-ACK (OK, Im finished with that req. too)
113. PersistenceA Mutual effort
Persistence depends on both the client and the
server. The client first decides whether to
request more than one item persistently. The
server, in turn, must first support persistence
connections and be kind enough not close the
TCP connection until all the clients requests
are responded to. NB Web servers like Apache can
be configured to limit the number of requests per
connection.
124. Pipelining
Pipelining is a feature of HTTP that allows the
client to issue consecutive requests without
having to wait for a response to each
request. Pipelining is facilitated by
persistence and together, these two features of
HTTP can improve performance noticeably. Like
persistence, pipelining requires cooperation from
both the client and the server.
134. PipeliningMany reqs in the pipeline
144. Pipelining - Example
A web page with 50 items and a server latency of
500 ms takes around 25 seconds to load
completely. If both persistence and pipelining
are used, the same page would typically load in
7 seconds i.e. we can improve performance by a
factor of 4. Terms Conditions apply.
Figures for illustration only! Subject to
availability. 56K modem, Users must know the
basics.
154. Pipelining Why should I care?
Im a web designer. Why do I need to know about
all this stuff? Surely, the server will do
everything. I just design the sites!
16HTTP Four Basic User Operations
17HTTP Four Basic User Operations 1. GET
- Used for resource retrieval
- Its a simple 2-way exchange- Request is
issued with a GET URI- Response comes back with
a status code (e.g. 200 OK). The server includes
the object itself in the response.
181. GET
1
Request GET URL
Response 200 OK resource
2
19HTTP Four Basic User Operations 2. POST
- Used for sending info to server e.g. forms
- Its a simple 2-way exchange- Requests is
issued with a POST URI- Response comes back with
a status code (e.g. 200 OK)
201. POST
1
Request POST URI
Response 200 OK resource
2
21Confused.com!
- What is difference between GET and POST?
22HTTP Four Basic User Operations 3. PUT
- Used for sending info to server e.g. file
upload - Its a simple 2-way exchange- Requests is
issued with a PUT URI- Response comes back with
a status code (e.g. 200 OK)
233. PUT
1
Request PUT URI
Response 200 OK resource
2
24Confused!
- What is difference between POST and PUT?
253. PUT Example Web-based file upload
26HTTP Four Basic User Operations 4. DELETE
- Allows client to remove a resource on server e.g.
file deletion - Its a simple 2-way exchange- Requests is
issued with a PUT URI- Response comes back with
a status code (e.g. 200 OK)
274. DELETE
1
Request DELETE URI
Response 200 OK resource
2
284. DELETE Example Web-based file manager