dnsfilter -- compare full hashes when parsing parental lookup result.
Closes #337.
This commit is contained in:
parent
548010e002
commit
dcbe3dd405
|
@ -542,6 +542,7 @@ func (d *Dnsfilter) checkParental(host string) (Result, error) {
|
||||||
Blocked bool `json:"blocked"`
|
Blocked bool `json:"blocked"`
|
||||||
ClientTTL int `json:"clientTtl"`
|
ClientTTL int `json:"clientTtl"`
|
||||||
Reason string `json:"reason"`
|
Reason string `json:"reason"`
|
||||||
|
Hash string `json:"hash"`
|
||||||
}
|
}
|
||||||
err := json.Unmarshal(body, &m)
|
err := json.Unmarshal(body, &m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -553,6 +554,9 @@ func (d *Dnsfilter) checkParental(host string) (Result, error) {
|
||||||
result := Result{}
|
result := Result{}
|
||||||
|
|
||||||
for i := range m {
|
for i := range m {
|
||||||
|
if !hashes[m[i].Hash] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if m[i].Blocked {
|
if m[i].Blocked {
|
||||||
result.IsFiltered = true
|
result.IsFiltered = true
|
||||||
result.Reason = FilteredParental
|
result.Reason = FilteredParental
|
||||||
|
|
|
@ -356,6 +356,8 @@ func TestParentalControl(t *testing.T) {
|
||||||
if stats.Parental.Requests != l {
|
if stats.Parental.Requests != l {
|
||||||
t.Errorf("Parental lookup negative cache is not working")
|
t.Errorf("Parental lookup negative cache is not working")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.checkMatchEmpty(t, "api.jquery.com")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSafeSearch(t *testing.T) {
|
func TestSafeSearch(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue