mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-10 22:56:11 +08:00
init
This commit is contained in:
26
handler/link_home.go
Normal file
26
handler/link_home.go
Normal 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")
|
||||
}
|
Reference in New Issue
Block a user