Persistent vs Non-Persistent HTTP Connections
10 Questions
0 Views
3.6 Stars

Persistent vs Non-Persistent HTTP Connections

Learn about the differences between persistent and non-persistent HTTP connections in this quiz. Explore how maintaining the past history (state) is crucial, and how to reconcile inconsistent views of 'state' when servers or clients crash.

Created by
@AwestruckYew

Questions and Answers

What HTTP response status code indicates that the requested object has been moved to a new location?

301 Moved Permanently

In the context of HTTP, what does a 404 status code signify?

Requested document not found on this server

When establishing a TCP connection to an HTTP server, what is the default port used?

80

What does a 400 status code signify in the context of HTTP?

<p>Request message not understood by server</p> Signup and view all the answers

Which HTTP version is mentioned in the request message 'GET /fee/NewsDetails/142317/en HTTP/1.1'?

<p>HTTP/1.1</p> Signup and view all the answers

What does sending a minimal GET request involve in terms of communication with an HTTP server?

<p>Sending a minimal but complete request via port 80</p> Signup and view all the answers

Which status code indicates that the HTTP version used in the request is not supported?

<p>505 HTTP Version Not Supported</p> Signup and view all the answers

'ncat www.menofia.edu.eg 80' is an example of what kind of connection in the context of HTTP?

<p>'Persistent' connection</p> Signup and view all the answers

'GET /fee/NewsDetails/142317/en HTTP/1.1' is an example of what part of an HTTP transaction?

<p>'Request message'</p> Signup and view all the answers

'Host: www.menofia.edu.eg' is typically found in which part of an HTTP request message?

<p>'Request header'</p> Signup and view all the answers

Study Notes

HTTP Protocol

  • Past history (state) must be maintained, and reconciled in case of server/client crashes
  • HTTP connections have two types: non-persistent and persistent

Non-Persistent HTTP

  • One TCP connection is opened and closed for each object
  • Example: user enters URL www.someSchool.edu/someDepartment/home.index containing text and references to 10 jpeg images
  • Steps:
    • HTTP client initiates TCP connection to HTTP server at port 80
    • HTTP client sends HTTP request message containing URL
    • HTTP server receives request message, forms response message, and sends message into its socket
    • HTTP server closes TCP connection
  • This process is repeated for each of the 10 jpeg objects
  • RTT (Round Trip Time) is the time for a small packet to travel from client to server and back
  • HTTP response time per object: 2RTT + file transmission time

Issues with Non-Persistent HTTP

  • Requires 2 RTTs per object
  • OS overhead for each TCP connection
  • Browsers often open multiple parallel TCP connections to fetch referenced objects in parallel

Persistent HTTP (HTTP 1.1)

  • Server leaves connection open after sending response
  • Subsequent HTTP messages between same client/server are sent over open connection
  • Client sends requests as soon as it encounters a referenced object
  • Response time is reduced to as little as one RTT for all referenced objects

HTTP Request and Response Messages

  • Two types of HTTP messages: request and response
  • HTTP request message:
    • ASCII (human-readable format)
    • Request line (GET, POST, HEAD commands)
    • Header lines
  • HTTP response message:
    • Status codes (e.g. 200 OK, 301 Moved Permanently, 400 Bad Request, 404 Not Found, 505 HTTP Version Not Supported)

Trying out HTTP (Client Side)

  • Use ncat tool to connect to a web server (e.g. www.menofia.edu.eg)
  • Type in a GET HTTP request message (e.g. GET /fee/NewsDetails/142317/en HTTP/1.1)
  • Observe the response message sent by the HTTP server

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Quizzes Like This

Use Quizgecko on...
Browser
Browser