Last active
November 8, 2023 11:42
-
-
Save thinktwice13/d619166a0c4aa700e506c3725cfd25ad to your computer and use it in GitHub Desktop.
Revisions
-
thinktwice13 revised this gist
Nov 8, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ func main() { panic(err) } h2s.ServeConn(conn, &http2.ServeConnOpts{ Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte("Hello World")) }), -
thinktwice13 created this gist
Nov 8, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ package main import ( "golang.org/x/net/http2" "net" "net/http" ) func main() { // curl -v --http2-prior-knowledge http://localhost:8080 listener, err := net.Listen("tcp", "0.0.0.0:8080") if err != nil { panic(err) } h2s := &http2.Server{} for { conn, err := listener.Accept() if err != nil { panic(err) } go h2s.ServeConn(conn, &http2.ServeConnOpts{ Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte("Hello World")) }), }) } }