In this assignment, you will develop a simple Web server in Python that is capable of processing only one request. Specifically, your Web server will (i) Create a connection socket when contacted by a client (browser) (ii) Receive the HTTP request from this connection (iii) Parse the request to determine the specific file being requested (iv) Get the requested file from the server’s file system (v) Create an HTTP response message consisting of the requested file preceded by header lines (vi) Send the response over the TCP connection to the requesting browser. If a browser requests a file that is not present in your server, your server should return a “404 Not Found” error message. Your job is to code the steps above, run your server, and then test your server by sending requests from browsers running on different hosts. If you run your server on a host that already has a Web server running on it, then you should use a different port than port 80 for your Web server.  Make sure to test your program before submission, if your programs contains syntax errors, the grade is zero.  Include a README file for instructions on how to run your program.  Documentation, write comments in your source code so that anyone reading your code will be able to understand it

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In this assignment, you will develop a simple Web server in Python that is capable
of processing only one request. Specifically, your Web server will
(i) Create a connection socket when contacted by a client (browser)
(ii) Receive the HTTP request from this connection
(iii) Parse the request to determine the specific file being requested
(iv) Get the requested file from the server’s file system
(v) Create an HTTP response message consisting of the requested file
preceded by header lines
(vi) Send the response over the TCP connection to the requesting browser.
If a browser requests a file that is not present in your server, your server should
return a “404 Not Found” error message.
Your job is to code the steps above, run your server, and then test your server by
sending requests from browsers running on different hosts. If you run your server
on a host that already has a Web server running on it, then you should use a different
port than port 80 for your Web server.
 Make sure to test your program before submission, if your programs contains
syntax errors, the grade is zero.
 Include a README file for instructions on how to run your program.
 Documentation, write comments in your source code so that anyone reading your code will be able to understand it

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

File "chegg.py", line 144, in <module>

    sys.exit(main())

  File "chegg.py", line 32, in main

    server_socket.bind(('', args.port))

OSError: [Errno 48] Address already in use

error occurs

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Network Protocols
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education