fix block asn superfluous write header calls by returning after errors
This commit is contained in:
@@ -31,11 +31,13 @@ func (b *ASNBlocker) BlockASN(next http.Handler) http.Handler {
|
|||||||
parsed, err := netip.ParseAddr(ip)
|
parsed, err := netip.ParseAddr(ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Pages.HTTPError(w, r, "couldn't idenitify client address", http.StatusInternalServerError)
|
b.Pages.HTTPError(w, r, "couldn't idenitify client address", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result := b.DB.Lookup(parsed)
|
result := b.DB.Lookup(parsed)
|
||||||
if !result.Found() {
|
if !result.Found() {
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var record ASNRecord
|
var record ASNRecord
|
||||||
|
|||||||
Reference in New Issue
Block a user