Skip to content

Commit

Permalink
asdd
Browse files Browse the repository at this point in the history
  • Loading branch information
arloor committed Dec 27, 2023
1 parent c897cd6 commit 0ffdcc0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/server/httpHandlerFunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func writeIp(w http.ResponseWriter, r *http.Request) {
func fileHandlerFunc() http.HandlerFunc {

return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if config.Instance.Refer != "" && r.Header.Get("referer") != "" && !strings.Contains(r.Header.Get("referer"), config.Instance.Refer)&& (strings.HasSuffix(r.URL.Path,".html")||strings.HasSuffix(r.URL.Path,"/")) {
if config.Instance.Refer != "" && r.Header.Get("referer") != "" && !strings.Contains(r.Header.Get("referer"), config.Instance.Refer) && (strings.HasSuffix(r.URL.Path, ".html") || strings.HasSuffix(r.URL.Path, "/")) {
HttpRequst.WithLabelValues(r.Header.Get("referer"), r.URL.Path).Inc()
HttpRequst.WithLabelValues("all", "all").Inc()
}
Expand All @@ -47,8 +47,8 @@ func fileHandlerFunc() http.HandlerFunc {
func logRequest(r *http.Request) {
if r.Method == http.MethodConnect {
log.Println(fmt.Sprintf("%21s", r.RemoteAddr), fmt.Sprintf("%7s", r.Method), r.Host, r.Proto)
} else if r.URL.Path != "/metrics" {
log.Println(fmt.Sprintf("%21s", r.RemoteAddr), fmt.Sprintf("%7s", r.Method), r.URL.Path, r.Proto,fmt.Sprintf("Referer: %10s", r.Header.Get("referer")))
} else if r.URL.Path != "/metrics" && r.URL.Path != "/ip" {
log.Println(fmt.Sprintf("%21s", r.RemoteAddr), fmt.Sprintf("%7s", r.Method), r.URL.Path, r.Proto, fmt.Sprintf("Referer: %10s", r.Header.Get("referer")))
}
}

Expand Down

0 comments on commit 0ffdcc0

Please sign in to comment.