A Closer Look at HTTP HyperText Transfer Protocol
HTTP: A Closer Look World Wide Web Standards –HTTP (HyperText Transfer Protocol) governs requests and responses between the browser and the webserver application program –HTML (HyperText Markup Language) governs the structure of the HTML webpage Browser Webserver Program HTML HTTP
HTTP: A Closer Look Sample HTTP Request Line –All text, often only a single line –Keyword absolute path HTTP/ version –Keyword is GET for Retrievals GET must be capitalized –Absolute path is URL without GET /report1/home.htm HTTP/1.1 Absolute Path
HTTP: A Closer Look Sample HTTP Request Header –Although the book only discusses the request-line, if only the absolute path is give, the request line is supposed to be followed by a header line naming the host. –So if the host is puka.hawaii.edu, the request-line and header would be (where CRLF is carriage return followed by line feed): GET /report1/home.htm HTTP/1.1[CRLF] Host:puka.hawaii.edu[CRLF] New
HTTP: A Closer Look Sample HTTP Response Message –Header is multiple lines of text –Each ends with [CRLF] HTTP/ OK[CRLF] Date: Tuesday, 20-JAN :32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.
HTTP: A Closer Look Sample HTTP Response Message –200 is a code for a successful retrieval, followed by the humanly readable code, OK HTTP/ OK[CRLF] Date: Tuesday, 20-JAN :32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.
HTTP: A Closer Look Sample HTTP Response Message –There are other codes, indicating errors, such as 404 –Followed by a humanly readable code, such as, host not found HTTP/ Host not Found[CRLF] Date: Tuesday, 20-JAN :32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.
HTTP: A Closer Look Sample HTTP Response Message –MIME-version and Content-type tell the type of file being retrieved –For HTML document, text/plain HTTP/ OK[CRLF] Date: Tuesday, 20-JAN :32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.
HTTP: A Closer Look HTML Pages Contain Text –To be displayed HTML Pages Contain Tags –Some tags say “place a graphic here”, “place a JAVA applet in a box here”, etc. –For instance, the tag says “Get file big.jpg and place it here in the HTML document” –Graphics, Java programs, etc. are separate files
HTTP: A Closer Look Downloading a “page” may require several downloads –One for the HTML document –One each for the other files it calls for HTML Big. jpg App. java Webserver User PC File Downloads 2 3 1
HTTP: A Closer Look Each download requires a separate HTTP request-response cycle! –So downloading complex webpages may require many HTTP request-response cycles HTML Big. jpg App. java Webserver User PC HTTP Request-Response Cycle 1 2 3
HTTP: A Closer Look How Many HTTP messages will be created to download the three files? –3 HTTP request-response cycles –2 HTTP messages per cycle (request and response) –6 HTTP messages total HTML Big. jpg App. java Webserver User PC HTTP Request-Response Cycle 1 2 3
HTTP: A Closer Look HTTP is Unreliable –There is no error detection and correction for transmission errors –This helps makes HTTP simple, allowing browsers and webserver application programs to be simple and inexpensive –As we will see later, TCP at the transport layer is reliable, offering error detection and correction –TCP gives HTTP clean data, so there is no need for HTTP to do error checking
HTTP: A Closer Look HTTP is Connectionless –No connection (agreement to communicate) is made between the browser and webserver application before an HTTP message is sent –Like sending a letter or an message (connectionless) as compared to taking on the telephone, where a conversation (connection) must be opened, managed, and closed Browser Webserver Application HTTP Request