this is a simple http server written in go, using low-level socket programming with the net package. it listens on port 8000, serves an index.html file for get requests to /, and handles basic http/1.1 requests.
just a rudimentary http server.
- rfc 2616 (http/1.1): implements basic get request handling, parsing request lines and headers (method, uri, host, user-agent), and sending responses with status line, headers (content-type, content-length), and body. supports http/1.1 response formatting but not full protocol features (e.g., no keep-alive or chunked encoding).
- rfc 7230 (http/1.1 message syntax and routing): follows http/1.1 message format for requests and responses, including crlf line endings, header field syntax, and status line structure.
- built a tcp server using go's
netpackage, binding to port 8000, equivalent to c's socket, bind, and listen. - implemented manual http request parsing to extract method, uri, host, and user-agent.
- created http responses with status 200 (ok) or 500 (server error), serving
index.html
- install mise and run
mise installto set up go = 'latest'. - build:
go build . - run:
./go-http - test:
curl localhost:8000or just open your browser and navigate tohttp://localhost:8000