Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go http server

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.

rfcs touched

  • 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.

what i have done

  • built a tcp server using go's net package, 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

setup

  • install mise and run mise install to set up go = 'latest'.
  • build: go build .
  • run: ./go-http
  • test: curl localhost:8000 or just open your browser and navigate to http://localhost:8000

resources

About

A rudimentary http server written in Go

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages