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, e.g.,

    스크린샷 2021-08-04 오후 5 08 42

HTTP overview

HTTP: hypertext transfer protocol

  • Web’s application layer protocol
  • client/server model
    • client: browser that requests, revceives, (using HTTP protocol) and displays Web objects
    • server: Web server sends (using HTTP protocol) objects in response to requests
스크린샷 2021-08-04 오후 5 11 59
  • uses TCP
    1. client initiates TCP connection(creates socket) to server, port 80
    2. server accepts TCP connection from client
    3. HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)
    4. TCP connection closed
  • HTTP is “stateless”
    • 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

HTTP connections

  • non-persistent HTTP
    • at most one object sent over TCP connection
      • connection then closed
    • downloading multiple obejcts requires multiple connections
  • persistent HTTP
    • multiple objects can be sent over single TCP connection between client, server

Non-persistent HTTP

suppose user enters URL:

www.someSchool.edu/someDepartment/home.index

스크린샷 2021-08-04 오후 6 39 30 스크린샷 2021-08-04 오후 6 39 52

Non-persistent HTTP: response time

  • RTT (definition): time for a small packet to travel from client to server and back
  • HTTP response time
    • one RTT to initiate TCP connection
    • one RTT for HTTP request and first few bytes of HTTP response to return
    • file transmission time
    • non-persistent HTTP response time = 2RTT + file transmission time
스크린샷 2021-08-04 오후 6 45 50

Persistent HTTP

  • non-persistent HTTP issues
    • requires 2 RTTs per object
    • browsers often open parallel TCP connections to fetch referenced objects
    • OS overhead for each TCP connection (each tcp buffer, socket)
  • persistent HTTP
    • server leaves connection open after sending response
    • subsequent HTTP messages between same client/server sent over open connection
    • client sends request as soon as it encounters a referenced object
    • as little as one RTT for all the referenced objects

HTTP request message

  • two types of HTTP messages: request, response
  • HTTP request message
    • ASCII (human-readable format)
스크린샷 2021-08-04 오후 6 57 53

Keep-Alive Header is persistent HTTP configure

general format

스크린샷 2021-08-04 오후 7 00 07

Uploading form input

Method types

  • HTTP/1.0
    • GET
    • POST
    • HEAD
      • asks server to leave requested object out of response
  • HTTP/1.1
    • GET, POST, HEAD
    • PUT
      • uploads file in entity body to path specified in URL field
    • DELETE
      • deletes file specified in the URL field

HTTP response message

스크린샷 2021-08-04 오후 7 07 22

HTTP response status codes

  • status code appears in 1st line in server to client response message
  • some sample codes
    • 200 OK
      • request succeeded, requested object later in this msg
    • 301 Moved Permanently
      • request object moved, new location specified later in this msg (Location Header)
    • 400 Bad Request
      • request msg not understood by server
    • 404 Not Found
      • requested document not found on this server
    • 505 HTTP Version Not Supported

User-server state: cookies

  • many Web sites use cookies four components
    1. cookie header line of HTTP response message
    2. cookie header line in next HTTP request message
    3. cookie file kept on user’s host, managed by user’s browser
    4. back-end database at Web site
  • example
    • Susan always access Internet from PC
    • visits specific e-commerce site for first time
    • when initial HTTP requests arrives at site, site creates
      • unique ID
      • entry in backend database for ID
스크린샷 2021-08-04 오후 4 19 27
  • what cookies can be used for
    • authorization
    • shopping carts
    • recommendations
    • user session state (Web e-mail)
  • how to keep “state”
    • protocol endpoint: maintain stat at sender/receiver over multiple transactions
    • cookies: http messages carry state
  • aside : cookies and privacy
    • cookies permit sites to learn a lot about you
    • you may supply name and e-amil to sites

Web caches (proxy server)

  • goal: satisfy client request with out involving origin server
  • user sets browser: Web access via cache
  • browser sends all HTTP requests to cache
    • object in cache: cache returns object
  • else cache requets object from origin server, then returns object to client
스크린샷 2021-08-04 오후 7 28 32
  • cache acts as both client and server
    • server for original requesting client
    • client to origin server
  • typically cache is installed by ISP (university, company, residential ISP)
  • why Web cacing?
    • reduce response time for cient request
    • reduce traffic on an institution’s access link
    • Internet dense with caches: enables “poor” content providers to effectively deliver content (so Too does P2P file sharing)

Conditional GET

  • Goal: don’t send object if cache has up-to-date cached version
    • reduce delay
    • lower link utilization
  • cache: specify date of cached copy in HTTP request
    • If-modified-since: date
  • server response contatins no object if cached copy is up-to-date
    • HTTP/1.0 304 Not Modified
스크린샷 2021-08-04 오후 7 37 57

참조

  • 컴퓨터 네트워크 이미정 교수님 강의
  • Computer Networking: A Top-Down Approach Featuring the Internet