Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please provide the C-language CODE(GET request) for both the server and the client. This is my second time posting this question so please do not
Please provide the C-language CODE(GET request) for both the server and the client. This is my second time posting this question so please do not answer with steps. I need the code. Explain the steps for 15 points question. I have all three .html files in my directory, please write the code accordingly.
3 Part B: Develop Your Web Server over HTTP/1.1(25 points) Please read Chapter 2 of the textbook carefully. The textbook will help you to understand how HTTP works. Instead of using port 80 or 8080 or 6789 for the listening socket, you should pick your own to avoid conflicts. It is suggested not to use port numbers 01024. This simple web server needs to implement the following features: 1 - When the client sends GET to request for one .html which exists, it should respond "200 OK " and return this .html file. - When the client sends GET to request for one .html which doesn't exist, it should send the response "404 Not found". - When the client sends GET with the wrong format (e.g. URL String Syntax Error), it should send the response "400 Bad Request". - When the client sends GET with a different HTTP version, it should send the response "505 HTTP Version Not Supported ". Please save your server code as server1.c. If you also revise the client code to test all the above features and save your client code as client1. c. Several files are provided to test with your web server. Of course, please feel free to create and use your own test files. - text.html: a html file which contains text only. - picture.html: a html file which contains text and a small picture (1MB). You need to test your server: - You can put all the html files in the directory of your server, or more exactly, wherever you run your server. - (5 points) For your server, you should be able to see the HTTP request format in the console of your server machine. For your client, you should be able to show the specific response given different HTTP requests and the content of the requested file. In the following test, please copy the print on the console at the server side into your lab report. - (15 points, 5 points per one test html file) Connect to your server from a browser with the URL of http:// :/ and see if it works. For example, you can try http: //localhost:8888/index.html if your web server uses the port number of 8888 and has a file called index.html in its root folder for all the web contents. Please make sure the server should work with the existing browser (Chrome, Firefox etc) to get the test webpages. - (5 points) Test with other HTTP responses (404, 400 and 505)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started