A HTTP server implementation in Python using TCP protocol for Socket communication. This server is able to handle GET and POST requests
- Python 3.x
-
Clone this repository:
git clone https://github.com/your-username/simple-http-server.git
-
Navigate to the directory containing the
main.py
file:cd http-server
-
Run the server:
python main.py
-
The HTTP server will run on port 4221. You can check for server connection by running the following command on a different terminal.
nc -vz 127.0.0.1 4221
-
To perform a POST request, make sure the server is running and on a different terminal run the following command.
curl -vvv -d "Greetings from the second terminal" localhost:4221/files/readme.txt
You should see a new file "readme.txt" created in your project directory with the content as the content being passed in the POST request.
- You can customize the behavior of the server by modifying the
main.py
file. For example, you can add support for other HTTP methods, or implement additional functionality.