Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.18 KB

README.md

File metadata and controls

42 lines (32 loc) · 1.18 KB

A shitty http server build for learning purposes

I am not doing any directory sanitization nor am I doing any verification if the flag is --directory only

EndPoints

A GET request to files/{filename} will give back the content of the file if that exists in the directory you mentioned while starting the server using the --directory flag.

A POST request to files/{filename} with the data in the body will fetch the contents of the file from the request body and save it to / on the given directory.

Command to Start the server

./server.sh

OR

./server.sh --directory `pwd`

use ^ to access all 4 endpoints

Example Commands to Request Data

curl -v http://127.0.0.1:4221/echo/oooooooo
curl -v http://127.0.0.1:4221/echo/user-agent

NOTE:- In order for these commands to work you need the --directory flag.

curl -v http://127.0.0.1:4221/echo/files/Cargo.toml
curl -d 'ooooooooo' -v http://127.0.0.1:4221/files/test.txt