README.md 1.09 KB
Newer Older
Ivaylo Ivanov's avatar
Ivaylo Ivanov committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# http
The aim of these two modules is to implement a client and a server that partially implement HTTP 1.1

## client

The client takes a URL as input, connects to the corresponding server on the corresponding port(`80` by default) and requests the file specified in
the URL. The transmitted content of that file is written to `stdout`, to a file or to a directory.

    SYNOPSIS
    client [-p PORT] [ -o FILE | -d DIR ] URL

    EXAMPLE
    client http://ivayloivanov.eu/en/


## server

18 19 20 21 22 23
The server takes a document root as input, reads it and serves it on the port specified(`8080` by default). If the `-i` flag is specified, the server uses its value as an index file. If not, it takes index.html as a default. The server supports **ONLY** GET requests. If it receives another request type it will return a response status **501** (Not implemented). If the file requested is not found, the server returns a response status **404** (Not found).

    SYNOPSIS
    server [-p PORT] [-i INDEX] DOC_ROOT
    EXAMPLE
    server -p 1280 -i index.html ./public/
Ivaylo Ivanov's avatar
Ivaylo Ivanov committed
24 25

**Note: The description is from the task I got from TU.**