Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python using tcp sockets, write an HTTP client and server. The client program will use the HTTP protocol to download a file from the

In python using tcp sockets, write an HTTP client and server. The client program will use the HTTP protocol to download a file from the server using HTTP GET method, and frequently use conditional GET operations to download file if it is changed.

a) The HTTP client will 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 The second step is use a HTTP GET operation to download the file named in the URL and print out the contents of the file. Then, 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 the second step, print output saying so (not necessary to print out file again). If not, the behavior is the same as the second step.

b) The HTTP server will open a TCP socket and listen for incoming HTTP Get and Conditional GET requests from one or more HTTP Clients. The second step is in the case of a HTTP Get request, read the named file and return a HTTP GET Response, including the Last-Modified header field. 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. If the file has been modified, return the file contents as in the second step. In case the named file does not exist, return the appropriate not found error return code 404. The server needs to 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 to Expert-Tailored 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

Recommended Textbook for

More Books

Students also viewed these Databases questions