Created
June 5, 2019 19:49
-
-
Save thrawn01/de7c732598ca64ceccf35649a978d647 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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