This project contains solutions for the first two assignments for the Data Communications & Computer Networks course.
The parent directory is a package exposing partial http/1.0 client and server implementation similar to net/http.
The ./httpc and ./httpfs directories contain a curl-like command line tool and a simple file server respectively.
$ go get -u github.com/g-harel/http/httpc
Executes a HTTP GET request for a given URL.
Usage:
httpc get [-v] [-h key:value] [-o filename] URL
Flags:
-v Prints the detail of the response such as protocol, status, and headers.
-h key:value Associates headers to HTTP Request with the format 'key:value'.
-o filename Writes response body to specified file.
Executes a HTTP POST request for a given URL with inline data or from file.
Usage:
httpc post [-v] [-h key:value] [-d inline-data] [-f file] [-o filename] URL
Flags:
-v Prints the detail of the response such as protocol, status, and headers.
-h key:value Associates headers to HTTP Request with the format 'key:value'.
-d string Associates an inline data to the body HTTP POST request.
-f filename Associates the content of a file to the body HTTP POST request.
-o filename Writes response body to specified file.
Either -d or -f can be used but not both.
$ go get -u github.com/g-harel/http/httpfs
Starts a simple file server.
Usage:
httpfs [-v] [-p port] [-d directory]
Flags:
-v Prints debugging messages.
-p port Specifies the port for the server to listen to (default "8080").
-d directory Specifies the file server's root directory (default ".").