Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sourasishbasu/http-web-server-python
Simple web server for serving HTTP requests written in pure Python with only standard libraries
https://github.com/sourasishbasu/http-web-server-python
Last synced: about 18 hours ago
JSON representation
Simple web server for serving HTTP requests written in pure Python with only standard libraries
- Host: GitHub
- URL: https://github.com/sourasishbasu/http-web-server-python
- Owner: SourasishBasu
- License: mit
- Created: 2024-06-14T21:36:22.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-15T07:53:00.000Z (7 months ago)
- Last Synced: 2024-06-15T22:49:14.599Z (7 months ago)
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTTP Web Server
> Simple web server for handling concurrent connections and serving requests written in Python with only standard libraries.### Usage
```bash
./run.sh
```
Start the web server listening for requests on port `4221`.## Sending requests
- ### `GET`
```curl
$ curl -v http://localhost:4221/echo/abc
```
#### Response
```bash
HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 3\r\n\r\nabc
```- ### `GET` files
```bash
$ curl -i http://localhost:4221/files/foo
```
#### Success Response
```bash
HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nContent-Length: 14\r\n\r\nHello, World!
```
#### Failed Response
```bash
HTTP/1.1 404 Not Found\r\n\r\n
```- ### `POST`
```bash
$ curl -v --data "12345" -H "Content-Type: application/octet-stream" http://localhost:4221/files/file_123
```
#### Response
```bash
HTTP/1.1 201 Created\r\n\r\n
```