Skip to content

Commit

Permalink
0.7.19 banned list added
Browse files Browse the repository at this point in the history
  • Loading branch information
jolav committed Feb 6, 2023
1 parent 5caabec commit 20e9f5f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
we "github.com/jolav/codetabs/weather"
)

var version = "0.7.18"
var version = "0.7.19"
var when = "undefined"

type Conf struct {
Expand Down Expand Up @@ -95,6 +95,12 @@ func main() {
func mw(next http.HandlerFunc, service string, c Conf) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
go u.AddHit(w, r, service, c.Mode, c.hitsLog)
if service == "proxy" {
if isBanned(r) {
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
}
next.ServeHTTP(w, r)
})
}
Expand Down

0 comments on commit 20e9f5f

Please sign in to comment.