Computer Networks 1 (CSE 231) - HTTP Protocol
24 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the purpose of the status code in an HTTP response message?

  • To indicate the success or failure of a request (correct)
  • To specify the client's IP address
  • To specify the HTTP version
  • To specify the type of request
  • What does the HTTP status code 404 indicate?

  • The HTTP version is not supported
  • The request was bad
  • The requested document was not found (correct)
  • The request was successful
  • What is the default port number used by HTTP servers?

  • 22
  • 443
  • 8080
  • 80 (correct)
  • What is the purpose of the 'Host:' header in an HTTP request?

    <p>To specify the hostname of the server</p> Signup and view all the answers

    What is the format of an HTTP request?

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

    What tool can be used to establish a TCP connection to an HTTP server?

    <p>ncat</p> Signup and view all the answers

    What is the purpose of the 'Location:' header in an HTTP response?

    <p>To specify the new location of the requested object</p> Signup and view all the answers

    What is the HTTP status code for a bad request?

    <p>400</p> Signup and view all the answers

    What is necessary to maintain in HTTP communication between the browser and the web server?

    <p>The past history of the state</p> Signup and view all the answers

    What is the primary difference between Non-Persistent HTTP and Persistent HTTP connections?

    <p>The number of objects sent over a single TCP connection</p> Signup and view all the answers

    What happens when an HTTP client initiates a TCP connection to an HTTP server?

    <p>The HTTP server accepts the connection and notifies the client</p> Signup and view all the answers

    What is the purpose of the HTTP client sending an HTTP request message?

    <p>To retrieve an object from the HTTP server</p> Signup and view all the answers

    What is the consequence of a server or client crash in HTTP communication?

    <p>The views of the state may be inconsistent</p> Signup and view all the answers

    How many TCP connections are required to download multiple objects using Non-Persistent HTTP?

    <p>Multiple TCP connections</p> Signup and view all the answers

    What is the benefit of using Persistent HTTP connections?

    <p>Fewer TCP connections</p> Signup and view all the answers

    What is the role of the HTTP server in the HTTP communication process?

    <p>To receive HTTP request messages</p> Signup and view all the answers

    What is the primary role of a client in the HTTP client-server model?

    <p>To request, receive, and display Web objects</p> Signup and view all the answers

    What is the default port number used by HTTP?

    <p>80</p> Signup and view all the answers

    What is the characteristic of HTTP that makes it 'stateless'?

    <p>It does not maintain information about past client requests</p> Signup and view all the answers

    What is the purpose of the TCP connection in HTTP?

    <p>To send HTTP requests to the server</p> Signup and view all the answers

    What is the component of a URL that specifies the protocol being used?

    <p>Scheme</p> Signup and view all the answers

    What is the primary advantage of using HTTP as a stateless protocol?

    <p>It reduces the complexity of the server</p> Signup and view all the answers

    What is the role of the server in the HTTP client-server model?

    <p>To send Web objects in response to client requests</p> Signup and view all the answers

    What is the transport protocol used by HTTP?

    <p>TCP</p> Signup and view all the answers

    Study Notes

    HTTP Overview

    • HTTP is the application-layer protocol of the web
    • It uses a client-server model
    • Client: a browser that requests, receives, and displays web objects
    • Server: a web server that sends objects in response to requests
    • HTTP uses TCP, typically on port 80
    • HTTP is "stateless", meaning the server maintains no information about past client requests

    Persistent vs Non-Persistent HTTP

    • Non-persistent HTTP:
      • A new TCP connection is opened for each object sent
      • At most one object is sent over a TCP connection
      • TCP connection is closed after each object is sent
    • Persistent HTTP:
      • A single TCP connection is opened to a server
      • Multiple objects can be sent over a single TCP connection
      • TCP connection is closed after all objects are sent

    Non-Persistent HTTP Example

    • A user enters a URL: www.someSchool.edu/someDepartment/home.index
    • The URL contains text and references to 10 jpeg images
    • The HTTP client initiates a TCP connection to the HTTP server
    • The HTTP client sends an HTTP request message containing the URL
    • The HTTP server receives the request message and sends the HTML file

    HTTP Response Status Codes

    • Status code appears in the first line of the server-to-client response message
    • Sample codes:
      • 200 OK: request succeeded, requested object is later in the message
      • 301 Moved Permanently: requested object moved, new location specified later in the message
      • 400 Bad Request: request message not understood by server
      • 404 Not Found: requested document not found on this server
      • 505 HTTP Version Not Supported: server does not support the HTTP version used in the request

    Trying out HTTP

    • Use ncat to connect to a web server and send an HTTP request
    • Example: ncat www.menofia.edu.eg 80
    • Type in a GET HTTP request, e.g., GET /fee/NewsDetails/142317/en HTTP/1.1
    • The HTTP server will respond with a response message

    Web and HTTP

    • A web page consists of objects, each of which can be stored on different web servers
    • An object can be an HTML file, JPEG image, Java applet, audio file, etc.
    • A web page consists of a base HTML file which includes several referenced objects, each addressable by a URL

    Studying That Suits You

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

    Quiz Team

    Description

    This quiz covers the basics of HTTP protocol, including messages exchanged between HTTP client and server, and the importance of maintaining state in the presence of crashes.

    Use Quizgecko on...
    Browser
    Browser