Skip to content

Instantly share code, notes, and snippets.

@thrawn01
Created June 5, 2019 19:49
Show Gist options
  • Save thrawn01/de7c732598ca64ceccf35649a978d647 to your computer and use it in GitHub Desktop.
Save thrawn01/de7c732598ca64ceccf35649a978d647 to your computer and use it in GitHub Desktop.
server := http2.Server{}
l, err := net.Listen("tcp", "0.0.0.0:1010")
checkErr(err, "while listening")
fmt.Printf("Listening [0.0.0.0:1010]...\n")
for {
conn, err := l.Accept()
checkErr(err, "during accept")
server.ServeConn(conn, &http2.ServeConnOpts{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %v, http: %v", r.URL.Path, r.TLS == nil)
}),
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment