270 likes | 476 Views
HTTP Overview. Part 1. HTTP HyperText Transfer Protocol. HTTP and OSI Layer model HTTP and TCP/IP Layer Standards: IETF HTTP/1.1, RFC 2616 (1998-) HTTP/1.0, RFC 1945 (-1997). HTTP CLIENT. REQ. HTTP SERVER. RESP. IP Address, Port. TCP Connection. IP Address, port.
E N D
HTTP Overview Part 1
HTTPHyperText Transfer Protocol • HTTP and OSI Layer model • HTTP and TCP/IP Layer • Standards: IETF • HTTP/1.1, RFC 2616 (1998-) • HTTP/1.0, RFC 1945 (-1997)
HTTP CLIENT REQ. HTTP SERVER RESP. IP Address, Port TCP Connection IP Address, port Transport Layer Transport Layer Network Layer Network Layer Data Link Layer Data Link Layer Physical Layer Physical Layer Architecture Overview Physical Media
Browser and WEB Servers • Browser is a user agent, or HTTP Client: • Netscape • Microsoft IE • WEB Server: • Apache • Microsoft Internet Information Server
HTTP Architecture BROWSER WEB SERVER HTTP requests HTTPCLIENT HTTPSERVER HTTP responses
Concepts • WEB Page, or document: an HTML file • Consists of objects. • An object could contain more objects: • HTML file • JPEG/GIF image file • JAVA Applet file
Concepts, cont II • URL, Universal Resource Locator, e.g.: • an absolute address of an HTTP Object • a relative address, uses the base address: • RFC3986: http://tools.ietf.org/html/rfc3986#section-1.1.2 • HTML Language (HyperText Markup Language) • HTML defines the structure and layout of a Web document by using a variety of tags and attributes.
HTTP Requests and Responses • REQUEST message, e.g., requests an object. Direction: from Client to Server • RESPONSE message, returns with data, status code. Direction: from Server to Client
FORMAT REQUES MESSAGE Method sp URL sp Version cr lf Request Line lf Header field name: sp value cr HeaderLines lf sp value cr Header field name BlankLine lf cr Entity Body
FORMAT RESPONSE MESSAGE sp sp cr lf Status Line cr lf : sp HeaderLines sp cr lf BlankLine cr lf Entity Body
GET Method • Allows the HTTP Client to request an object from an HTTP Server.Contains the Host domain, the URL of the object. • The Server responds to the Client with a message. Contains Status and the requested Object.
Experiment with GET • - Open the console or command (cmd) window - Open Notepad 2. Execute in the console window telnet<sp>elmhurst.edu<sp>80 This would open a TCP connection from your cmd window process to host elmhurst.edu at port 80. This is the port of the web server process at elmhurst.edu
Experiment with GET, cont I 3. In the notepad type: GET<sp>/~pturcu/<sp>HTTP/1.1<enter>Host:<sp>elmhurst.edu<enter>Paint and Copy the above two lines. 4. Paste in the telnet command window the above And then type <enter><enter>
Experiment with GET, cont II 4. Note the response from the server: • Copy all text from the cmd window to the notepad new file window. 5. Save it as response.html (use Save as type “All Files”.) 6. Open response.html using Internet Explorer. 7. Have you seen this file before?
View Of a Web Page 1. Get to the URL link: http://www.elmhurst.edu/~pturcu/ Go to IE View -> Source, click 2. Note: text shown on your manual browsing similar to the one in the responses above.
Exercise • Show that the Exercise above makes sense based on HTTP protocol, GET makes sense and the response does also • Use the example above and get another object from the same server: http://www.elmhurst.edu/~pturcu/2011-2012/ELM/it328-88/correspondence.htm Analyze again. Why is the connection lost?
Conclusion • HTTP – exchange between client and server information • Requests and Responses. • Exchanged based on reliable transport: TCP connections • Important subjects not covered: • Cookies • security.
HTTP Overview Part 2
HTTP Messages • Requests • Contains Method line: GET, POST, HEAD, PUT and DELETE • Response:- Contains Status line
GET METHOD • Example of a GET request messageGET /dir/page.html HTTP/1/1 CrLf(request line GET)Host: www.some.school.edu CrLf(header line HOST)ww.someschool.eduConnection: close (header line Connection) User-agent: Mozilla/4.0 (header line User-agent)Accept-language: fr(header line Accept-language) • CrLf (Blank line)(Entity Body, i.e., Data.. Data..) • CrLfCrLf
Response Message • Example
Meaning of Response Message • Meaning of the example