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 server and listening to the specified port. We assume it is 8080but the port number is your choice.
3)In your web browser, if you type in http://localhost:8080/index.html, your webserver process shall fetch the index.html from the file system, compose the HTTP response, and send it backto the browser.
4)If your web browser can display the page correctly, the webserver process is functioning as required for a Status Code200 response.
5)You are required to implement 301, 404StatusCodes as well. You will need to study (BY YOURSELF) the meanings of these codes and how to implement the proper additional header fields if any.
More Explanation and Requirements:
Recall that HTTP 1.0 creates a separate TCP connection for each request/response pair. A separate thread handles each of these connections. There will also be the 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 hostname 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 webserver 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 on your HTML page. Please note the image object should be stored locally at your server, not referring to an URL to 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 corresponding HTTP messages and take screenshots.
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