HTTP Exercise 01
Three Internet Protocols IP TCP HTTP Routes messages thru “Inter-network “ 2-way Connection between programs on 2 computers So they can exchange messages Used by browser to communicate with web server Like telephone connection between 2 people So they can talk to the other
TCPConnection between programs on 2 computers so they can talk program Computer-1Computer-2 TCP connection (like a browser) program (like a web server) listens on port (80) port: 80 port telnet google.com 80 Establish with: telnet domain-name port
HTTP Protocol to exchange message requests & responses between browser and web server 2-way TCP connection Browser Web server port: 80 HTTP request Message GET HTTP response Message Common HTTP command
Example HTTP Exchange Computer-1web.njit.edu TCP connection GET /~ mchugh/test/b.html HTTP/1.0 test/b.html web server telnet web.njit.edu 80 http request http response
argerich-17 mchugh>: telnet web.njit.edu 80 Trying Connected to pathos.njit.edu. Escape character is '^]'. HTTP/ OK Date: Wed, 28 Jan :34:37 GMT Server: Apache Last-Modified: Wed, 03 Sep :29:48 GMT ETag: "19a834c " Accept-Ranges: bytes Content-Length: 133 Connection: close Content-Type: text/html Makes TCP connection to web server at web.njit.edu listening on port 80 HTTP Get request for file test/b.html on server HTTP response message Header [from server] GET /~mchugh/test/b.html HTTP/1.0 Byte length File type Check file size Status Web sever PREVIOUS EXAMPLE
US Flag HTTP Response Message Body TCP connection closed Connection to pathos.njit.edu closed by foreign host. Browser must “parse” html page Requires another HTTP request to retrieve image Content Not “rendered” here as would be in browser Firefox > Tools > Page Info > Headers ( HTTP)
Trying Connected to potomac.nist.gov. Escape character is '^]'. telnet 80 GET /public_affairs/images/bullet.gif HTTP/1.0 HTTP/ OK Server: Netscape-Enterprise/4.1 Date: Wed, 28 Jan :52:00 GMT Content-type: image/gif Last-modified: Thu, 14 Dec :11:03 GMT Content-length: 54 Accept-ranges: bytes Connection: close GIF89a ÿÿÌ!ù, ©ËíbPr¦Jå); Connection to potomac.nist.gov closed by foreign host. Makes TCP connection to web server at listening on port 80 HTTP Get request for file on server HTTP response message header from server HTTP response message body TCP connection closed
telnet time-a.nist.gov :02: UTC(NIST) * Connection to time-a.nist.gov closed by foreign host. Trying Connected to time-a.nist.gov. Escape character is '^]'. Makes TCP connection To time-of-day program Listening on port 13 time of day TCP connection closed TCP connection Not an HTTP exchange No input required ! date Program response not HTTP response Response by program listening at port 13
TCP protocol IP protocol HTTP protocol port HTTP message request HTTP message response HTTP response header HTTP response body Numeric IP address – dotted quad