Download presentation
Presentation is loading. Please wait.
Published byGavin Bell Modified over 9 years ago
1
CSx760 Computer Networks1 HTTP
2
CSx760 Computer Networks2 The Web: Some Jargon r Web page: m consists of “objects” m addressed by a URL r Most Web pages consist of: m base HTML page, and m several referenced objects. r URL has three components: host name, port number and path name: r User agent for Web is called a browser: m MS Internet Explorer m Netscape Navigator r Server for Web is called Web server: m Apache (public domain) m MS Internet Information Server snowball.cs.uga.edu:80/~cs6760/index.html
3
CSx760 Computer Networks3 The Web: the HTTP Protocol HTTP: hypertext transfer protocol r Web’s application layer protocol r client/server model m client: browser that requests, receives, “displays” Web objects m server: Web server sends objects in response to requests r http1.0: RFC 1945 r http1.1: RFC 2068 Windows running Explorer Server running Apache Web server Linux running Navigator http request http response
4
CSx760 Computer Networks4 The HTTP Protocol: Message Flow HTTP: TCP transport service: r client initiates TCP connection (creates socket) to server, port 80 r server accepts TCP connection from client r http messages (application- layer protocol messages) exchanged between browser (http client) and Web server (http server) r TCP connection closed http is “stateless” r server maintains no information about past client requests Protocols that maintain “state” are complex! r past history (state) must be maintained r if server/client crashes, their views of “state” may be inconsistent, must be reconciled r When is “state” desired? aside
5
CSx760 Computer Networks5 HTTP Example Suppose user enters URL www.cs.uga.edu/index.html 1a. http client initiates TCP connection to http server (process) at www.cs.uga.edu. Port 80 is default for http server. 2. http client sends http request message (containing URL) into TCP connection socket 1b. http server at host www.cs.uga.edu waiting for TCP connection at port 80. “accepts” connection, notifying client 3. http server receives request message, forms response message containing requested object ( index.html ), sends message into socket (the sending speed increases slowly, which is called slow-start) time
6
CSx760 Computer Networks6 HTTP Example (cont.) 5. http client receives response message containing html file, parses html file, finds embedded image 6. Steps 1-5 repeated for each of the embedded images 4. http server closes TCP connection. time
7
CSx760 Computer Networks7 HTTP Request Message: General Format
8
CSx760 Computer Networks8 The HTTP Protocol: Message Format r Two types of HTTP messages: request, response r HTTP request message: m ASCII (human-readable format) GET /~cs6760/index.html HTTP/1.1 Host: snowball.cs.uga.edu Connection: close User-agent: Mozilla/4.0 Accept: text/html, image/gif, image/jpeg Accept-language: en (extra carriage return, line feed) request line (GET, POST, HEAD commands) header lines Carriage return, line feed indicates end of message
9
CSx760 Computer Networks9 HTTP Message Format: Response HTTP/1.1 200 OK Date: Sun, 06 Aug 2002 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Wed, 2 Oct 2002 …... Content-Length: 6821 Content-Type: text/html data data data data data... status line (protocol status code status phrase) header lines data, e.g., requested html file
10
CSx760 Computer Networks10 HTTP Response Status Codes 200 OK m request succeeded, requested object later in this message 301 Moved Permanently m requested object moved, new location specified later in this message (Location:) 400 Bad Request m request message not understood by server 404 Not Found m requested document not found on this server 505 HTTP Version Not Supported In first line in server->client response message. A few sample codes:
11
CSx760 Computer Networks11 More about Message Format r Why encode HTTP message in ASCII, why not use binary? r Loss a few encoding bytes on the wire, and in RAM … r But human-readable format is very important for high level network protocols m typing interactively to the system or sending scripts directly into the system is.
12
CSx760 Computer Networks12 Trying out HTTP (client side) for yourself 1. Telnet to your favorite Web server: Opens TCP connection to port 80 (default http server port) at www.cs.uga.edu. Anything typed in sent to port 80 at www.cs.uga.edu telnet www.cs.uga.edu 80 2. Type in a GET http request: GET /index.html HTTP/1.0 By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to http server 3. Look at response message sent by http server!
13
CSx760 Computer Networks13 Response time modeling Definition of RTT: time to send a small packet to travel from client to server and back. Web Response time: r one RTT to initiate TCP connection r one RTT for HTTP request and first few bytes of HTTP response to return r file transmission time total = 2RTT+transmit time time to transmit file initiate TCP connection RTT request file RTT file received time
14
CSx760 Computer Networks14 Non-Persistent and Persistent Connections Non-persistent r HTTP/1.0 r server parses request, responds, and closes TCP connection r 2 RTTs to fetch each object r Each object transfer suffers from slow start Persistent r default for HTTP/1.1 r on same TCP connection: server parses request, responds, parses new request, … r Client sends requests for all referenced objects as soon as it receives base HTML. r Fewer RTTs and less slow start. But most 1.0 browsers use parallel TCP connections.
15
CSx760 Computer Networks15 Pipelining Persistent without pipelining: r client issues new request only when previous response has been received r one RTT for each referenced object Persistent with pipelining: r default in HTTP/1.1 m “It is unfortunately not well supported by many web servers and proxies”, therefore Mozilla (and probably all other browers disable it by default) r client sends requests as soon as it encounters a referenced object r as little as one RTT for all the referenced objects
16
CSx760 Computer Networks16 User-Server Interaction: Authentication Authentication goal: control access to server documents r stateless: client must present authorization in each request r authorization: typically name, password Authorization: header line in request m if no authorization presented, server refuses access, sends WWW-authenticate: header line in response client server usual http request msg 401: authorization req. WWW-authenticate: usual http request msg + Authorization:line usual http response msg usual http request msg + Authorization:line usual http response msg time Browser caches name & password so that user does not have to repeatedly enter it.
17
CSx760 Computer Networks17 User-server Interaction: Cookies r server sends “cookie” to client in response msg Set-cookie: 1678453 r client presents cookie in later requests Cookie: 1678453 r server matches presented-cookie with server-stored info m authentication m remembering user preferences, previous choices client server usual http request msg usual http response + Set-cookie: # usual http request msg Cookie: # usual http response msg usual http request msg Cookie: # usual http response msg cookie- spectific action cookie- spectific action
18
CSx760 Computer Networks18 HTTPS r Secure Socket Layer (SSL) r Certification Authority (CA) r Symmetric Key Cryptography r Asymmetric Key Cryptography m Public Key & Private Key r What if m Sniffing? m Replaying? clientserver https request msg (cryptographic preferences) Cryptographic preference, public key, and CA certificate time If the client has the CA’s public key, then the client can verify the CA certificate Client generates a random symmetric key, encrypts it using the server’s public key Server extracts the symmetric key and encrypt further communication with it
19
CSx760 Computer Networks19 Certification Example r A digital certificate contains the name of a company, web site or individual, along with a cryptographic key that can be used to encrypt information that must be sent to that individual r A list of CAs is pre-loaded in your browser
20
CSx760 Computer Networks20 User-Server Interaction: Conditional GET r Goal: don’t send object if client has up-to-date stored (cached) version r client: specify date of cached copy in http request If-modified-since: r server: response contains no object if cached copy up- to-date: HTTP/1.0 304 Not Modified client server http request msg If-modified-since: http response HTTP/1.0 304 Not Modified object not modified http request msg If-modified-since: http response HTTP/1.1 200 OK … object modified
21
CSx760 Computer Networks21 Web Caches (Proxy Server) r user sets browser: Web accesses via web cache r client sends all http requests to web cache m if object at web cache, web cache immediately returns object in http response m else requests object from origin server, then returns http response to client r Why do we need proxy? Goal: satisfy client request without involving origin server client Proxy server client http request http response http request http response http request http response origin server origin server
22
CSx760 Computer Networks22 Why Web Caching? Assume: cache is “close” to client (e.g., in same network) r smaller response time: cache “closer” to client r decrease traffic to distant servers m link out of institutional/local ISP network often bottleneck origin servers public Internet institutional network 10 Mbps LAN 1.5 Mbps access link institutional cache
23
CSx760 Computer Networks23 Content distribution networks (CDNs) r The content providers are the CDN customers. Content replication r CDN company installs hundreds of CDN servers throughout Internet m in lower-tier ISPs, close to users r CDN replicates its customers’ content in CDN servers. When provider updates content, CDN updates servers origin server in North America CDN distribution node CDN server in S. America CDN server in Europe CDN server in Asia
24
CSx760 Computer Networks24 CDN example origin server r www.foo.com r distributes HTML r Replaces: http://www.foo.com/sports.ruth.gif with h ttp://www.cdn.com/www.foo.com/sports/ruth.gif HTTP request for www.foo.com/sports/sports.html DNS query for www.cdn.com HTTP request for www.cdn.com/www.foo.com/sports/ruth.gif 1 2 3 Origin server CDNs authoritative DNS server Nearby CDN server CDN company r cdn.com r distributes gif files r uses its authoritative DNS server to route redirect requests
25
CSx760 Computer Networks25 Content Distribution Networks BBB.COM client server surrogate B B B B B B cache A A A A A A AAA.COM C C C C C C CCC.COM redirector
26
CSx760 Computer Networks26 Partial Replication on CDN BBB.COM client server surrogate B B B B A A A A AAA.COM C C C BB A A C C C CCC.COM redirector
27
CSx760 Computer Networks27 Partial Replication on CDN BBB.COM client server surrogate B B B B A A A A AAA.COM C C C C CCC.COM redirector
28
CSx760 Computer Networks28 Factors Affecting Redirection r Goals m Increase system throughput under load m Reduce response latency perceived by clients r Server load m Pick least loaded server r Network proximity m Pick closest server r Cache locality m Pick server just served the object What’s the tradeoff across different loads? Often conflict
29
CSx760 Computer Networks29 More about CDNs routing requests r CDN creates a “map”, indicating distances from leaf ISPs and CDN nodes r when query arrives at authoritative DNS server: m server determines ISP from which query originates m uses “map” to determine best CDN server not just Web pages r streaming stored audio/video r streaming real-time audio/video m CDN nodes create application-layer overlay network
30
CSx760 Computer Networks30 Summary r HTTP m Stateless application layer protocols m HTTP/1.1 Persistent connection & pipeline m Authentication, Cookies, and HTTPS m HTTP is not limited to web server/browser m Proxy and CDN for performance improvement
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.