Skip to content

Commit 8d80731

Browse files
committed
[feature] add simple validator
1 parent 72f141a commit 8d80731

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ func init() {
2121

2222
// ServerHandle handle proxy logic
2323
func ServerHandle(w http.ResponseWriter, req *http.Request) {
24-
if req.Method != "GET" {
24+
if req.Method != "GET" ||
25+
len(req.Referer()) == 0 || len(req.FormValue("ga")) == 0 {
26+
w.WriteHeader(http.StatusBadRequest)
2527
return
2628
}
2729

@@ -30,7 +32,7 @@ func ServerHandle(w http.ResponseWriter, req *http.Request) {
3032

3133
uid := GetOrSetUUID(w, req)
3234

33-
w.WriteHeader(http.StatusNoContent)
35+
w.WriteHeader(http.StatusOK)
3436

3537
go SendData(uid, req)
3638
}

0 commit comments

Comments
 (0)