1
play

1 The http protocol: more WWW: the http protocol http is stateless - PDF document

Internet apps: their protocols and transport protocols Application Underlying layer protocol Application transport protocol e-mail smtp [RFC 821] World Wide Web TCP remote terminal access telnet [RFC 854] TCP Web http [RFC 2068] TCP


  1. Internet apps: their protocols and transport protocols Application Underlying layer protocol Application transport protocol e-mail smtp [RFC 821] World Wide Web TCP remote terminal access telnet [RFC 854] TCP Web http [RFC 2068] TCP ftp [RFC 959] file transfer TCP streaming multimedia proprietary TCP or UDP HTTP (e.g. RealNetworks) NFS remote file server TCP or UDP Internet telephony proprietary typically UDP (e.g., Vocaltec) 2: Application Layer 2: Application Layer 1 2 The World Wide Web URI/URL/URN ❒ Web is a collection of documents, called ❒ URI: “uniform resource identifier” Web pages ❒ Originally, a generalization of: ❒ Each page consists from objects ❍ URL (uniform resource locator), ❒ Each object is a file of a specific type: ❍ URN (uniform resource name), ❍ html, gif, jpeg, applet and etc ❍ URC (uniform resource citation), ❒ The most common is a html file with ❍ and potentially others, references to other objects ❒ but mainly, URL and URN 2: Application Layer 2: Application Layer 3 4 URL Port Numbers ( e.g. http://www.cs.huji.ac.il:80/~com1/index.html ❒ URL (uniform resource locator) ❒ A computer may have Internet Address and host name(s). (Usually only one) ❒ Each WWW page assigned a URL ❒ Several application may run on the same ❍ Which specifies page name, location and way to computer access it. ❒ For each protocol a “standard port” is ❒ Each URL has FOUR parts reserved(e.g. 80 for http) ❍ Protocol that must be used to access the page ❒ Unix allows to only super user to run ❍ The DNS name of the machine on which page is located applications which use local port number < 1024 ❍ Port number to contact (optional) ❍ Local name of specific page (usually file name) 2: Application Layer 2: Application Layer 5 6 1

  2. The http protocol: more WWW: the http protocol http is “stateless” http: hypertext transfer http: TCP transport protocol service: ❒ server maintains no h t t p r e information about q ❒ WWW’s application layer u ❒ client initiates TCP e PC running s http response t past client requests protocol Explorer connection (creates socket) to server, port 80 ❒ client/server model aside ❒ server accepts TCP ❍ client: browser that Protocols that maintain t s e u connection from client “state” are complex! requests, receives, q e http response r Server p t t “displays” WWW h ❒ http messages (application- running ❒ past history (state) must objects NCSA Web layer protocol messages) be maintained server exchanged between browser ❍ server: WWW server ❒ if server/client crashes, (http client) and WWW sends objects in their views of “state” may Mac running server (http server) response to requests be inconsistent, must be Navigator ❒ TCP connection closed ❒ http1.0: RFC 1945 reconciled ❒ http1.1: RFC 2068 2: Application Layer 2: Application Layer 7 8 http example Reliable Data Transfer Suppose user enters URL (contains text, ❒ TCP protocol is used by HTTP parties www.someSchool.edu/someDepartment/home.index references to 10 jpeg images) (Client and Server) to communicate 1a . http client initiates TCP connection to http server ❒ The http messages eventually achieve 1b. http server at host (process) at www.someSchool.edu waiting their destination without dublications www.someSchool.edu. Port 80 for TCP connection at port 80. is default for http server. or changes in the same order they “accepts” connection, notifying client were sent 2. http client sends http request message (containing URL) into ❒ This allows http not worry about 3. http server receives request TCP connection socket message, forms response losses, order, network congestion and message containing requested flow control object ( someDepartment/home.index ), sends message into socket time 2: Application Layer 2: Application Layer 9 10 http example (cont.) Pipelining 4. http server closes TCP connection. ❒ Persistent connection may use pipelining 5 . http client receives response message containing html file, ❒ Without pipelining displays html. Parsing html file, finds 10 referenced jpeg ❍ A new request is sent only when the response to objects the previous one has been received. 6. Steps 1-5 repeated for each of 10 jpeg objects ❒ With pipelining time ❍ A requests is sent immediately when a ❒ non-persistent connection: one object in each TCP connection reference is found ❍ some browsers create multiple TCP connections Pipelining causes to lower latency. simultaneously - one per object ❒ persistent connection: multiple objects transferred within one TCP connection 2: Application Layer 2: Application Layer 11 12 2

  3. HTTP REQUEST MESSAGES http message format: request ❒ Methods: ❒ two types of http messages: request , response ❒ http request message: ❍ GET: Request to read an object ❍ ASCII (human-readable format) ❍ HEAD: Request to read an object’s request line headers (GET, POST, GET /somedir/page.html HTTP/1.1 HEAD commands) Connection: close ❍ POST: Request to accept the User-agent: Mozilla/4.0 header object enclosed in the request Accept: text/html, image/gif,image/jpeg lines Accept-language:fr Carriage return, (extra carriage return, line feed) line feed indicates end of message 2: Application Layer 2: Application Layer 13 14 http message format: reply http request message: general format status line (protocol status code HTTP/1.1 200 OK status phrase) Connection: close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) header Last-Modified: Mon, 22 Jun 1998 …... lines Content-Length: 6821 Content-Type: text/html data data data data data ... data, e.g., requested html file 2: Application Layer 2: Application Layer 15 16 Status codes http reply status codes In first line in server->client response message. ❒ 1.. Information Codes A few sample codes: ❒ 2.. Success Codes 200 OK ❍ request succeeded, requested object later in this message ❒ 3.. Redirection Codes 301 Moved Permanently ❍ requested object moved, new location specified later in ❒ 4.. Client Error Codes this message (Location:) ❒ 5.. Server Error Codes 400 Bad Request ❍ request message not understood by server 404 Not Found ❍ requested document not found on this server 505 HTTP Version Not Supported 2: Application Layer 2: Application Layer 17 18 3

  4. Trying out http (client side) for yourself User-server interaction: authentication server client 1. Telnet to your favorite WWW server: Authentication goal: control access to server documents usual http request msg Opens TCP connection to port 80 telnet www.eurecom.fr 80 ❒ stateless: client must present 401: authorization req. (default http server port) at www.eurecom.fr. authorization in each request Anything typed in sent WWW authenticate: ❒ authorization: typically name, to port 80 at www.eurecom.fr password usual http request msg 2. Type in a GET http request: ❍ authorization: header + Authorization:line line in request By typing this in (hit carriage usual http response msg GET /~ross/index.html HTTP/1.0 ❍ if no authorization return twice), you send presented, server refuses this minimal (but complete) access, sends usual http request msg GET request to http server + Authorization:line WWW authenticate: 3. Look at response message sent by http server! time header line in response usual http response msg 2: Application Layer 2: Application Layer 19 20 User-server interaction: cookies User-server interaction: conditional GET server server client client ❒ server sends “cookie” to ❒ Goal: don’t send object if client in response client has up-to-date stored usual http request msg http request msg (cached) version Set-cookie: # usual http response + object If-modified-since: ❒ client present cookie in ❒ client: specify date of Set-cookie: # <date> not cached copy in http request later requests modified http response If-modified-since: HTTP/1.0 cookie: # usual http request msg cookie- 304 Not Modified <date> ❒ server matches cookie: # spectific ❒ server: response contains presented-cookie with usual http response msg action no object if cached copy up- server-stored cookies to-date: http request msg ❍ authentication If-modified-since: object HTTP/1.0 304 Not usual http request msg ❍ remembering user cookie- <date> modified Modified cookie: # preferences, previous spectific http response choices usual http response msg action HTTP/1.1 200 OK … <data> 2: Application Layer 2: Application Layer 21 22 Web Caches (proxy server) Why WWW Caching? origin Goal: satisfy client request without involving origin server servers Assume: cache is “close” to client (e.g., in same ❒ user sets browser: public origin Internet WWW accesses via network) server web cache Proxy ❒ smaller response time: t ❒ client sends all http http request s e server u q cache “closer” to e http response r requests to web cache http response p 1.5 Mbps t client t h client access link ❍ if object at web cache, web cache t ❒ decrease traffic to s institutional e u http request q e immediately returns http response network r p distant servers 10 Mbps LAN t t http response object in http h ❍ link out of response institutional/local ISP ❍ else requests object client network often from origin server, institutional origin then returns http bottleneck cache server response to client 2: Application Layer 2: Application Layer 23 24 4

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend