World Wide Web (HTTP and HTML)

Context: FIT1047_MOC Β· the Application-layer flagship: browser ↔ server via HTTP, pages described in HTML Β· Berners-Lee 1989, built on hypertext + URLs

Quick Revision

  • 🎯 Objective: read/write a raw HTTP exchange βž” request line + headers ⟢ status line + headers + body; one page = MANY request-response cycles (each <img> is a new GET).
  • ⚑ Key Constraint: the anatomy labels β€” request line / request header / response status / response header / response body β€” exams mark by part-name.

πŸ“ Core

  • Two technologies βž” HTTP = the browser↔server conversation protocol; HTML = the page description format.
  • Two founding ideas βž” hypertext (documents linking documents) + URL (a standard way to name them).
  • Request–response cycle βž” browser sends request through the stack, server answers with the document; embedded resources trigger further GETs.

πŸ“Š Exam Execution Trace β€” lecture session, verbatim

client:  GET /~john/test.html HTTP/1.1        ← request line (method, path, version)
         Host: www.stanford.edu              ← request header
 
server:  HTTP/1.1 200 OK                        ← response status
         Date: Thu, 05 Mar 2015 08:30:48 GMT    ← response headers
         Server: Apache/1.3.26 (Unix)
         Content-Type: text/html
                                                 ← blank line separates
         <html><body><h1>John</h1>        ← response body (HTML)
         <img src="images/john.jpg">…

Then the <img> tag causes a second cycle: GET /~john/images/john.jpg β†’ 200 OK, Content-Type: image/jpeg, binary body.

πŸŽ› HTTP Methods

MethodDoes
GETretrieve the URL
HEADretrieve headers only
POSTsend body data to the URL (forum post, cart item) β€” also returns a document
othersPUT, DELETE, OPTIONS… less common

⚠️ Common Mistakes

  • πŸ’‘ One page β‰  one request βž” every embedded image/script/stylesheet is its own request-response cycle.
  • πŸ’‘ POST also retrieves βž” it sends data AND gets a response document back β€” β€œPOST only uploads” is wrong.
  • πŸ’‘ HTTP is plain text βž” human-readable on the wire (until TLS wraps it) β€” which is why exams can show raw sessions.

🧠 Active Recall