Question
In python, develop a multi-thread web server, capable of serving multiple requests in parallel. The basic functional requirements of the web server areas below: 1)A
In python, develop a multi-thread web server, capable of serving multiple requests in parallel.
The basic functional requirements of the web server areas below:
1)A webpage is stored on your server (assuming it is localhost). We assume it is index.HTML but the name is your choice.
2)A process will be running on the serverand listeningto the specified port. Weassume it is 8080but the port number is your choice.
3)In your webbrowser, if youtype in http://localhost:8080/index.html, your webserver process shall fetch the index.html from the file system, compose thehttp response, and send it backto the browser.
4)If you web browser can display the page correctly, the web server process is functioning as requiredfor a Status Code200 response.
5)You are required to implement 301, 404StatusCodes as well. You will need to study (BY YOURSELF)meanings of these codesand how to implement the properadditionalheaderfields, if any.
More Explanationand Requirements:
Recall that HTTP 1.0 createsa separate TCP connection for each request/response pair. A separate thread handles each of these connections.There will also be a main thread, in which the server listens for clients that want to establish connections. To simplify the programming task, you can develop the code in two stages. In the first stage, you can write a multi-thread server that simply displays the contents of the HTTP request message that it receives. After this program is running properly, you will add the code required to generate an appropriate response. As you develop the code, you can test your server with a web browser. Remember that you are not serving through the standard port 80. You will need to specify the port number within the URL given to the web browser. For example, if your host name is host.someschool.edu, your server is listening on port 6789, and you want to retrieve the file index.html, then you would specify the URL in the browser as http://host.somechool.edu:6789/index.html.You can test the web server on your own machine using:http://localhost:6789/index.htmlorhttp://127.0.0.1:6789/index.html.Notice that while there are multiple types of methods in the HTTP protocol, you are required mainly to implement the response for the GET method. Also, while there may be multiple status codes possible in the response as in the HTTP protocol, you are required only to implement the 200, 301, and 404 codes, where the browser should be able to display properly the responses.Also, when testing your server code, at least use one image object in your html page.Please note the image object should be stored locally at your server, not referring to an URLto other servers.
you should also include screenshots of the outgoing http requests and incoming http responses (for codes 200, 301, and 404).This can be done using WireShark to capture the correspondinghttp messages and take screen shots.
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