github.com/Psiphon-Labs/tls-tris@v0.0.0-20230824155421-58bf6d336a9a/_dev/caddy/echo.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "html" 6 "log" 7 "net/http" 8 "os" 9 ) 10 11 var htmlBody = []byte(` 12 <!DOCTYPE html> 13 <p>Hello! 14 <code><pre> 15 `) 16 17 func main() { 18 http.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) { 19 rw.Write(htmlBody) 20 for name, value := range r.Header { 21 fmt.Fprintf(rw, "%s: %s\n", name, html.EscapeString(value[0])) 22 } 23 }) 24 log.Println(http.ListenAndServe(os.Args[1], nil)) 25 }