waf: refusedWhateverTheAnswer in lookup.go, beside its only caller
check / check (push) Failing after 1m47s
check / check (push) Failing after 1m47s
It decides whether a request skips the wait for GeoJS, and only startLookUp calls it. It is not question or report code, so in questionsandreports.go the file's name did not say what it held. Model: opus-5-5
This commit is contained in:
1 parent
f9cb1f9c6b
commit
02f9134a05
2 files changed
+20
-20
No files matched your search
@@ -80,6 +80,26 @@ func (rq *request) startLookUp(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// refusedWhateverTheAnswer reports whether the request is one that does not wait
|
||||||
|
// for GeoJS, since the checks will refuse it at now whatever GeoJS answers about
|
||||||
|
// its client: a heuristic of afterLookup that implements refusesWithoutLookup
|
||||||
|
// says it will refuse it. In observe mode, which refuses nothing, none is.
|
||||||
|
// rproxy lets a request through when waf answers too late.
|
||||||
|
func (rq *request) refusedWhateverTheAnswer(now time.Time) bool {
|
||||||
|
if rq.h.config.Observe {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, each := range rq.h.afterLookup {
|
||||||
|
knows, ok := each.(refusesWithoutLookup)
|
||||||
|
if ok && knows.refusesWhateverTheLookupAnswers(rq, now) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// noteLookup notes result for the log line and as the request's asn= and
|
// noteLookup notes result for the log line and as the request's asn= and
|
||||||
// country= tags.
|
// country= tags.
|
||||||
func (rq *request) noteLookup(result lookupResult) {
|
func (rq *request) noteLookup(result lookupResult) {
|
||||||
|
|||||||
@@ -11,26 +11,6 @@ import (
|
|||||||
"sneak.berlin/go/smallwebwaf/internal/wafprotocol"
|
"sneak.berlin/go/smallwebwaf/internal/wafprotocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
// refusedWhateverTheAnswer reports whether the request is one that does not wait
|
|
||||||
// for GeoJS, since the checks will refuse it at now whatever GeoJS answers about
|
|
||||||
// its client: a heuristic of afterLookup that implements refusesWithoutLookup
|
|
||||||
// says it will refuse it. In observe mode, which refuses nothing, none is.
|
|
||||||
// rproxy lets a request through when waf answers too late.
|
|
||||||
func (rq *request) refusedWhateverTheAnswer(now time.Time) bool {
|
|
||||||
if rq.h.config.Observe {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, each := range rq.h.afterLookup {
|
|
||||||
knows, ok := each.(refusesWithoutLookup)
|
|
||||||
if ok && knows.refusesWhateverTheLookupAnswers(rq, now) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// answerQuestion runs the checks on the visitor's request a question
|
// answerQuestion runs the checks on the visitor's request a question
|
||||||
// carries, and answers rproxy what to do with it. A denied request's counting
|
// carries, and answers rproxy what to do with it. A denied request's counting
|
||||||
// is finished here, and an allowed one's by its report.
|
// is finished here, and an allowed one's by its report.
|
||||||
|
|||||||
Reference in new issue
Block a user