Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

?ddfdfdf Programming Assignment 2: Simple HTTP Client and Server Using TCP sockets, you will write a simplified version of a HTTP client and server. The

?ddfdfdfimage text in transcribed

Programming Assignment 2: Simple HTTP Client and Server Using TCP sockets, you will write a simplified version of a HTTP client and server. The client program will use the HTTP protocol to download a file from the server using the HTTP GET method, and then subsequently use conditional GET operations to download the file only if it has been modified The HTTP client will perform the following functions 1. Take in a single command line argument that specifies a web url containing the hostname and port where the server is running, as well as the name of the file to be downloaded, in the appropriate format. Example: localhost:12000/filename.html Use a HTTP GET operation to download the file named in the URL 2. a. Print out the contents of the file 3. Use a Conditional GET operation to download the file named in the URL again If the server indicates the file has not been modified since step 2, print output saying so (not necessary to print out file again) a. b. Otherwise, the behavior is the same as 2a) The HTTP server will perform the following functions 1. Open a TCP socket and listen for incoming HTTP Get and Conditional GET requests from one or more HTTP Clients 2. In the case of a HTTP Get request: a. Read the named file and return a HTTP GET Response, including the Last-Modified header field 3. In the case of a HTTP Conditional Get Request If the file has not been modified since that indicated by If-Modified-Since, return the appropriate Not Modified response (return code 304) a. b. If the file has been modified, return the file contents as in step 2 4. In the case that the named file does not exist, return the appropriate "Not Found" error (return code 404) 5. The server must ignore all header fields in HTTP Requests it does not understand Programming Assignment 2: Simple HTTP Client and Server Using TCP sockets, you will write a simplified version of a HTTP client and server. The client program will use the HTTP protocol to download a file from the server using the HTTP GET method, and then subsequently use conditional GET operations to download the file only if it has been modified The HTTP client will perform the following functions 1. Take in a single command line argument that specifies a web url containing the hostname and port where the server is running, as well as the name of the file to be downloaded, in the appropriate format. Example: localhost:12000/filename.html Use a HTTP GET operation to download the file named in the URL 2. a. Print out the contents of the file 3. Use a Conditional GET operation to download the file named in the URL again If the server indicates the file has not been modified since step 2, print output saying so (not necessary to print out file again) a. b. Otherwise, the behavior is the same as 2a) The HTTP server will perform the following functions 1. Open a TCP socket and listen for incoming HTTP Get and Conditional GET requests from one or more HTTP Clients 2. In the case of a HTTP Get request: a. Read the named file and return a HTTP GET Response, including the Last-Modified header field 3. In the case of a HTTP Conditional Get Request If the file has not been modified since that indicated by If-Modified-Since, return the appropriate Not Modified response (return code 304) a. b. If the file has been modified, return the file contents as in step 2 4. In the case that the named file does not exist, return the appropriate "Not Found" error (return code 404) 5. The server must ignore all header fields in HTTP Requests it does not understand

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions