Skip to content

Python HTTP Server that accepts requests on top of the TCP. It can respond to GET, POST, PUT, DELETE, and HEAD requests and render all types of media files on the browser. It also includes request logging, handling of various status codes, multi-threading to handle multiple requests at once, and cookie management.

Notifications You must be signed in to change notification settings

kushalnl7/HTTP-Server-Computer-Networks

Repository files navigation

HTTP_Server_Computer_Networks

If you find the repository helpful, don’t forget to ⭐ it!

To Run the project:

  1. The main server file is https.py
  2. To run the server file: python3 https.py 12000 (Any Port number can be given by user, we are assuming it to be 12000)
  3. To run the automated testing file: python3 testing.py 12000
  4. Configuration file of the server is conf.py
  5. Log file of server is access.log and error logs are stored in errors.log and will get updated as you make new requests.
  6. Type 'quit' on server if you want to end the server program.

Project Features:

  1. HTTP Request Methods Implemented: GET, PUT, POST, DELETE, HEAD
  2. Implemented Status Codes: 200, 201, 202, 204, 304, 400, 403, 404, 408, 411, 413, 414, 415, 510
  3. Configurations file: For some server operations, a configuration file with Document Root was implemented.
  4. Implemented Cookies and handled Persistent and non-Persistent connections
  5. Multithreading in server: Implemented multithreading in server to run multiple requests simultaneously
  6. Logging: INFO logs and ERROR logs get stored for subsequesnt requests in access.log and errors.log respectively.
  7. Automated Tests: Implemented different tests using requests module and for sample website using webbrowser module
  8. Implemented Cookies and handled Persistent and non-Persistent connections

Steps To Use:

  1. Once you run the server file, you can make multiple requests using browser or using POSTMAN.
  2. To check on browser, you can:
    1. To view HTML file on browser, go to http://127.0.0.1:12000/index.html
    2. To view png image file on browser, go to http://127.0.0.1:12000/pic.png
    3. To view jpg image file on browser, go to http://127.0.0.1:12000/pic.jpg
    4. To view jpeg image file on browser, go to http://127.0.0.1:12000/pic.jpeg
    5. To view mp3 song file on browser, go to http://127.0.0.1:12000/song.mp3
    6. To view mp4 video file on browser, go to http://127.0.0.1:12000/video.mp4

Browser screenshots for different requests:

BrowserScreenshot

POSTMAN screenshots for requests with different status codes as responses:

404 Not Found 408 Request Timeout
Light Light
413 Request Entity Too Large 501 Not Implemented
Light Dark
DELETE Request 415 Unsupported Media Type
Light Dark

About

Python HTTP Server that accepts requests on top of the TCP. It can respond to GET, POST, PUT, DELETE, and HEAD requests and render all types of media files on the browser. It also includes request logging, handling of various status codes, multi-threading to handle multiple requests at once, and cookie management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published