This commit is contained in:
bjdgyc
2020-08-18 16:39:46 +08:00
parent 7f2d405b72
commit eee99fcb0d
27 changed files with 1551 additions and 3 deletions

26
handler/link_home.go Normal file
View File

@@ -0,0 +1,26 @@
package handler
import (
"fmt"
"net/http"
"net/http/httputil"
"strings"
"github.com/julienschmidt/httprouter"
)
func LinkHome(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
hu, _ := httputil.DumpRequest(r, true)
fmt.Println("DumpHome: ", string(hu))
fmt.Println(r.RemoteAddr)
connection := strings.ToLower(r.Header.Get("Connection"))
if connection == "close" {
w.Header().Set("Connection", "close")
w.WriteHeader(http.StatusBadRequest)
return
}
w.WriteHeader(http.StatusOK)
fmt.Fprintln(w, "hello world")
}