NAME : Sarvesh Bodakhe MIS : 111803149 TY COMP DIV 2
HTTP WEB SERVER IN PYTHON
GET, POST, PUT, HEAD, DELETE, Cookies, Headers, non-persistent connections, Multiple clients at the same time (with a sepearate program to test this), logging with levels of logging, handling file permissions; Server configuration - config file with DocumentRoot, log file name, max simulateneous connections ;
==========================================================================================================================
- How to run the server ? $ python3 server.py port_number Ex : python3 server.py 2000
===========================================================================================================================
This testing program is for testing multithreading
- How to run multiple client testing program ? $ python3 testing.py port_number Ex : python3 requests_testing.py 2000 (same port number on which server has started)
==========================================================================================================================
RUN THE SERVER BEFORE AUTOMATED TESTING This Automated testing tests differents requests made to the server
- How to run Automated testing program ? $ python3 stress_testing.py port_number
===========================================================================================================================
CONFIGURE THE server_config.py FILE BEFORE RUNNING THE SERVER MAKE CHANGES ACCORDINGLY
===========================================================================================================================
ALL FILE PERMISSIONS ARE HANDLED FOR EVERY METHOD IMPLEMENTED MOST OF THE HEADERS ARE HANDLED
METHODS IMPLEMENTED :
- GET
- HEAD
- POST
- PUT
- DELETE
-
Multithreaded Web Server
-
GET METHOD
- All types of files can be requested from the server. Ex : text files, .png files, .jpeg files
- Implemented Conditional Get
- Queried GET request is also handle by the server for json files
- Whenever a directory is requested all the files are listed
- Try URLS: "http://localhost:2000/form.html" "http://localhost:2000/form2.html" "http://localhost:2000/" View posted( by form) data at: "http://localhost:2000/data/data/data_file3.json" "http://localhost:2000/data/data/data_file1.json"
- HEAD METHOD
- All get methods implemented
- POST METHOD
- Created a simple form at "http://localhost:2000/form.html"
- Form data submitted is stored in the specified csv file
- If file is not there then a new file is created
- Accordinly status codes are handled
- Form with files is handled at url : "http://localhost:2000/form2.html"
- PUT METHOD
- Implemented for any type of file data of any length
- DELETE METHOD
- Delete files which are requested(All file types have been handled)
- Authorization is required
- If file not found then give status codes accordingly
================================================================================================================================== Log file locations in config file There are two logs:
- ACCESS LOG
- ERROR LOG
===================================================================================================================================
- Cookies : Whenever a new page is requested a cookie is set if cookie is not present in request headers . Checks for a cookie header when client connects again