from https://practicingruby.com/articles/implementing-an-http-file-server?u=2c59db4496