CMPE 150 Introduction to Computer Networks Dr Chane L Fullmer chane cse ucsc edu Spring 2003 UCSC cmpe150 1 Homework Assignments Homework assignment 5 Chapter two Due June 5th This Thursday Spring 2003 UCSC cmpe150 2 Optional Class Project Network programming project Goal In lieu of taking final examination Or just a wildcard for mid term or final Build an FTP client server from scratch Using C language Details on web page now Due by tomorrow June 4th Spring 2003 UCSC cmpe150 3 Class Final Exam Final exam Three hours 40 50 questions comprehensive Multiple choice as the midterm Scantron bring your sheet and pencils Wednesday June 11th 8 00 11 00am Eight short days Tick tick tick Spring 2003 UCSC cmpe150 4 Class Review Lecture Thursday June 5th last class meeting Coverage of high points of the quarter Much of what might appear on the final exam Spring 2003 UCSC cmpe150 5 CMPE 150 Introduction to Computer Networks Set 18 Application level Protocols continued Spring 2003 UCSC cmpe150 6 HTTP Spring 2003 UCSC cmpe150 7 Background Hypertext Transport Protocol Created by Tim Berners Lee at CERN Physicists not computer scientists Share data from physics experiments Standardized and much expanded by the IETF Spring 2003 UCSC cmpe150 8 Web and HTTP Web page consists of objects Object can be HTML file JPEG image Java applet audio file Web page consists of base HTML file which includes several referenced objects Each object is addressable by a URL Example URL www someschool edu someDept pic gif host name Spring 2003 UCSC path name cmpe150 9 HTTP overview HTTP hypertext transfer protocol Web s 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 Spring 2003 UCSC HT TP r equ est PC running HT TP res Explorer pon se st e u q re se Server P n T o running HT esp r P T Apache Web HT server Mac running Navigator cmpe150 10 HTTP Overview continued HTTP is stateless Uses TCP client initiates TCP connection creates socket to server port 80 server accepts TCP connection from client HTTP messages application layer protocol messages exchanged between browser HTTP client and Web server HTTP server TCP connection closed Spring 2003 UCSC server maintains no information about past client requests aside Protocols that maintain state are complex past history state must be maintained if server client crashes their views of state may be inconsistent must be reconciled cmpe150 11 HTTP Connections Nonpersistent HTTP At most one object is sent over a TCP connection HTTP 1 0 uses nonpersistent HTTP Spring 2003 UCSC Persistent HTTP Multiple objects can be sent over single TCP connection between client and server HTTP 1 1 uses persistent connections in default mode cmpe150 12 Nonpersistent HTTP contains text Suppose user enters URL references to 10 www someSchool edu someDepartment home index jpeg images 1a HTTP client initiates TCP SYN connection to HTTP server process at www someSchool edu on port 80 1b HTTP server at host SYNACK 2 HTTP client sends HTTP request message containing ACK DATA3 URL into TCP connection socket Message indicates that client wants object someDepartment home index ACK DATA www someSchool edu waiting for TCP connection at port 80 accepts connection notifying client HTTP server receives request message forms response message containing requested object and sends message into its socket time Spring 2003 UCSC cmpe150 13 Nonpersistent HTTP cont 2 way close 4 HTTP server closes TCP connection 5 HTTP client receives response time message containing html file displays html Parsing html file finds 10 referenced jpeg objects 6 Steps 1 5 repeated for each of 10 jpeg objects Spring 2003 UCSC cmpe150 14 Persistent HTTP Nonpersistent HTTP issues requires 2 RTTs per object OS must work and allocate host resources for each TCP connection but browsers often open parallel TCP connections to fetch referenced objects Persistent HTTP server leaves connection open after sending response subsequent HTTP messages between same client server are sent over connection Spring 2003 UCSC Persistent without pipelining client issues new request only when previous response has been received one RTT for each referenced object Persistent with pipelining default in HTTP 1 1 client sends requests as soon as it encounters a referenced object as little as one RTT for all the referenced objects cmpe150 15 HTTP request message two types of HTTP messages 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 4 0 header Connection close lines Accept language sp Carriage return line feed indicates end of message Spring 2003 extra carriage return line feed UCSC cmpe150 16 HTTP request message general format Spring 2003 UCSC cmpe150 17 Uploading form input Post method Web page often includes form input Input is uploaded to server in entity body URL method Uses GET method Input is uploaded in URL field of request line www somesite com animalsearch monkeys banana Spring 2003 UCSC cmpe150 18 Method types HTTP 1 0 GET POST HEAD HTTP 1 1 GET POST HEAD PUT asks server to leave requested object out of response DELETE Spring 2003 UCSC uploads file in entity body to path specified in URL field deletes file specified in the URL field cmpe150 19 HTTP response message status line protocol status code status phrase header lines data e g requested HTML file Spring 2003 HTTP 1 1 200 OK Connection close Date Thu 06 Aug 1998 12 00 15 GMT Server Apache 1 3 0 Unix Last Modified Mon 22 Jun 1998 Content Length 6821 Content Type text html data data data data data UCSC cmpe150 20 HTTP response status codes In first line in server client response message A few sample 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 Spring 2003 UCSC cmpe150 21 Trying out HTTP client side for yourself 1 Telnet to your favorite Web server telnet www eurecom fr 80 Opens TCP connection to port 80 default HTTP server port at www eurecom fr Anything typed in sent to port 80 at www eurecom fr 2 Type in a GET HTTP request GET ross index html HTTP 1 0 By typing
View Full Document
Unlocking...