Title: Web a HTTP
1Web ?a? HTTP
- ???? ???????a
- ???e Web se??da ap?te?e?ta? ap? a?t??e?µe?a
(objects) - O? a?t??e?µe?? µp??e? ?a ?e????e? ??a HTML
a??e??, ??a a??e?? e????a?, ???? ? video, ??p???
Java applet ?t?... - ??a Web se??da µp??e? ?a pe???aµß??e? d??f??a
a?t??e?µe?a, ta ?p??a ap??a????ta? ?a? referenced
objects - ???e a?t??e?µe?? d?e????s??d?te?ta? ap? ??a URL
(Uniform Resource Locator) - Example URL
2HTTP Hyper-Text Transfer Protocol
- HTTP Hyper-Text Transfer Protocol
- Application layer protocol
- client/server model
- client browser that requests, receives,
displays Web objects - server Web server sends objects in response to
requests - HTTP 1.0 RFC 1945
- HTTP 1.1 RFC 2068
HTTP request
PC running Internet Explorer
HTTP response
HTTP request
Server running Apache Web server
HTTP response
Mac running Navigator
3HTTP
- ???s? TCP
- ? client e????e? ??a TCP connection (d?µ?????e?
?a? s??d?eta? d??ad? µe socket) st?? server, st?
port 80 - ? server d??eta? t? TCP connection t?? client
- ????µata HTTP (application-layer protocol
µ???µata) a?ta??????ta? µeta?? t?? browser (HTTP
client) ?a? t?? Web server (HTTP server) - ?????, ??e??e? t? TCP connection
- HTTP is stateless
- ? server de? s????ate? p????f???a ?at?stas?? ??a
ta pa?a??te?a requests t?? client (ap?? ???p???s?)
a?t???t??
- ?a p??t?????a efa?µ???? p?? d?at?????
p????f???a ?at?stas?? e??a? s???eta! - ???pe? ?a d?at??e?ta? ? pa??? ?at?stas?
- ?? ??a ap? ta d?? µ??? (server ? client)
ap???pe?, ? ?at?stas? t?? d?? µe??? p??pe? ?a
a?a?t??e? ap? t?? a??? se t?t???? e?d???
p??t?????a
4HTTP s??d?se??
- Persistent HTTP
- (ep?µ??e?) s??d?se??
- ????ap?? a?t??e?µe?a µp????? ?a sta???? p??? ap?
µ?a TCP s??des? µeta?? e??? client ?a? e???
server - ?? HTTP/v.1.1 ???s?µ?p??e? persistent connections
se default mode
- Non-persistent HTTP
- (µ? ep?µ??e?) s??d?se??
- ??a t? p??? a?t??e?µe?? µp??e? ?a sta?e? p??? ap?
µ?a TCP s??des? µeta?? e??? client ?a? e???
server - ?? HTTP/v.1.0 ???s?µ?p??e? non-persistent HTTP
5Non-persistent HTTP
(?st? ep?s?? ?t? t? URL pe????e? text ?a?
references se 10 jpeg e????e?)
- ?st? ?t? ? ???st?? ep???µe? t? URL
www.someSchool.edu/someDepartment/index.html
- 1a. ? HTTP client e????e? ??a TCP connection st??
HTTP server (1 process st? socket)
www.someSchool.edu st? port 80
1b. ? HTTP server www.someSchool.edu ß??s?eta? se
?at?stas? a?aµ???? pe??µ????ta? ??a TCP
connection st? port 80. ???eta? t?? a?t?s? ??a
s??des? (connection) ?a? e?d?p??e? t?? client
2. ? HTTP client st???e? ??a HTTP request message
(p?? pe????e? t? URL) st? socket t?? TCP
connection. ?? message ?p?de????e? ?t? ? client
ep???µe? t? object someDepartment/index.html
3. ? HTTP server ?aµß??e? t? request message,
s????te? t? response message p?? pe????e? t?
??t??µe?? a?t??e?µe?? (object) ?a? st???e? t?
message a?t? st? socket
time
6Non-persistent HTTP
- 4b. ? HTTP client ?aµß??e? t? µ???µa
- ap????s?? (response message) p??
- pe????e? t? html a??e?? ?a? t? eµfa???e?.
- ?at? t?? epe?e??as?a t?? html file,
- ß??s?e? 10 s?et???µe?a a?t??e?µe?a t?p?? jpeg
4a. ? HTTP server ??e??e? t? TCP connection
time
5. ?a ß?µata 1-4 epa?a?aµß????ta? ??a ???e ??a
ap? ta 10 jpeg objects
7Response time modeling
- RTT (Round Trip Time) ? ?????? p?? apa?te?ta?
??a t?? ap?st??? e??? µ????? pa??t?? ??a ?a
d?a??se? t?? ap?stas? ap? t?? client st?? server
?a? p?s? - Response time
- one RTT to initiate TCP connection
- one RTT for HTTP request and first few bytes of
HTTP response to return - file transmission time
- ?otal 2RTT?ransmit ?ime
8Persistent HTTP
- Non-persistent HTTP issues
- ?pa?te? 2 RTTs a?? ??a a?t??e?µe??
- ?? ?e?t??????? s?st?µa p??pe? ?a apas???e?ta?
s??e??? ??a t?? e?t?p?sµ? resources ??a ???e TCP
s??des? (af?? ??e??e? ? s??des?) - ?µ?? ?? browsers s???? a??????? pa??????a TCP
connections p??? ta d??f??a a?t??e?µe?a - Persistent HTTP
- ? server af??e? a????t? t? s??des? af?? ste??e?
t? response message - ?ts? ta epa??????a HTTP messages µeta?? t??
?d??? client/server a?ta???ss??ta? ap? t?? ?d?a
s??des?
- Persistent ????? pipelining
- ? client µp??e? ?a ???e? ??? request a? ?a? µ???
a? ??e? ??ße? t? p??????µe?? response - Synchronous
- ??????? apa?te?ta? ??a RTT ??a ???e a?t??e?µe??
- Persistent µe pipelining
- Default st? HTTP/v.1.1
- ? client µp??e? ?a ste??e? ??a requests ??a ??a
objects, ????? ?a ??e? ??ße? a??µa ap??t?s? ??a
p??????µe?a requests - Asynchronous
- Te???t??? µp??e? ??????? se ??a RTT ?a a?t??e?
(?a ste??e? requests) ??a ??a ta a?t??e?µe?a
9HTTP request message
- ??a??????µe HTTP messages d?? t?p?? request,
response - HTTP request message
- ASCII (human-readable format)
request line (GET, POST, HEAD commands)
GET /somedir/page.html HTTP/1.1 Host
www.someschool.edu User-agent
Mozilla/1.1 Connection close Accept
text/html,image/jpg,image/gif Accept-languagefr
(extra carriage return, line feed)
header lines
Carriage return, line feed indicates end of
message
10HTTP request message general format
11????µata ???? (v1.0 ?a? v.1.1)
- HTTP/1.0
- GET
- POST
- G?a ap?st??? p????f???a? ap? t?? p?e??? t??
client (p.?. S?µp????s? st???e??? ??e?t???????
f??µa?) - HEAD
- ?a?ap??s?? µe t? µ???µa GET, µe t? s?µa?t??? ?µ??
d?af??? ?t? ?pa? ?a? ? client ste??e? µ???µa
HEAD, ? server ??? ?????? ?a pe????e? ?????? µ?sa
st? message body t?? response µ???µat??
(???s?µ?p??e?ta? ??a testing)
- HTTP/1.1
- GET, POST, HEAD
- PUT
- ???e? upload t? a??e?? p?? µetaf??e? st? entity
body t?? µ???µat??, st? path p?? a?af??e? t? URL
ped?? t?? µ???µat?? - DELETE
- ??a???fe? t? a??e?? p?? pe?????feta? st? URL
ped?? t?? µ???µat??
12HTTP response message
status line (protocol status code status phrase)
HTTP/1.1 200 OK Connection close Date Thu, 22
Dec 2006 120015 GMT Server Apache/1.3.0
(Unix) Last-Modified Mon, 22 Jun 2004 ...
Content-Length 6821 Content-Type text/html
data data data data data ...
header lines
data, e.g., requested HTML file
13HTTP response status codes
- 200 OK
- request succeeded, requested object later in this
message - 306 No content
- The request clients message (e.g. PUT or POST)
didnt contain any content - 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