amate / Proxydomo

ローカルで動作するプロクシフィルタリングソフトです
http://www31.atwiki.jp/lafe/pages/37.html
GNU General Public License v2.0
74 stars 12 forks source link

Filter Processing Order: Reversed? #24

Closed Stone-D closed 8 years ago

Stone-D commented 8 years ago

In the filter manager, do the filters get processed from the bottom to the top, rather than top to bottom?

If you refer to the attached screenshot, the "Block 3" filters, followed by 2 then 1, seem to get processed before "Disable ALL".

It's counter-intuitive for me. Is there a way to reverse this behaviour, if true?

fm

amate commented 8 years ago

Filter processing order is as the arrow. filter order

filter order2

[HTTP headers]
Key = "Server: gws -> gws1"
In = TRUE
Out = FALSE
Version = ""
Author = ""
Comment = ""
Active = TRUE
Multi = FALSE
URL = "www.google.co.jp/"
Bounds = ""
Limit = 256
Match = "gws"
Replace = "gws1"

[HTTP headers]
Key = "Server: gws1 -> gws2"
In = TRUE
Out = FALSE
Version = ""
Author = ""
Comment = ""
Active = TRUE
Multi = FALSE
URL = "www.google.co.jp/"
Bounds = ""
Limit = 256
Match = "gws1"
Replace = "gws2"

[HTTP headers]
Key = "Server: gws2 -> gws3"
In = TRUE
Out = FALSE
Version = ""
Author = ""
Comment = ""
Active = TRUE
Multi = FALSE
URL = "www.google.co.jp/"
Bounds = ""
Limit = 256
Match = "gws2"
Replace = "gws3"

filter order3 filter order4

Stone-D commented 8 years ago

This video should clarify what I mean. I expect the "Disable ALL" to hit first, but it doesn't. Looking at the filter xml, there doesn't seem to be anything wrong. Here's a stripped down copy so you can test it:

<?xml version="1.0" encoding="UTF-8"?>
<ProxydomoFilter>
  <folder name="Headers" active="true">
    <folder name="Blocks" active="true">
      <filter>
        <Active>true</Active>
        <title>Disable ALL (out)</title>
        <version/>
        <author/>
        <comment/>
        <filterType>1</filterType>
        <headerName>URL</headerName>
        <multipleMatches>false</multipleMatches>
        <windowWidth>256</windowWidth>
        <boundsPattern/>
        <urlPattern>\0</urlPattern>
        <matchPattern>(http(s|)://)\1\2</matchPattern>
        <replacePattern>$RDIR(\1local.ptron/Disabled.htm)$LOG(R[HDR:URL] Block 0 - ALL)</replacePattern>
      </filter>
      <filter>
        <Active>true</Active>
        <title>Disabled: Net Failure (out)</title>
        <version/>
        <author/>
        <comment/>
        <filterType>1</filterType>
        <headerName>URL</headerName>
        <multipleMatches>false</multipleMatches>
        <windowWidth>256</windowWidth>
        <boundsPattern/>
        <urlPattern>\0</urlPattern>
        <matchPattern>\0</matchPattern>
        <replacePattern>$RDIR(http://local.ptron/NetFail.htm)$LOG(R[HDR:URL] Block 0 - NET)</replacePattern>
      </filter>
      <folder name="Fun" active="true">
        <filter>
          <Active>true</Active>
          <title>Block 3 - Social Networking (out)</title>
          <version/>
          <author/>
          <comment/>
          <filterType>1</filterType>
          <headerName>URL</headerName>
          <multipleMatches>false</multipleMatches>
          <windowWidth>256</windowWidth>
          <boundsPattern/>
          <urlPattern>(*$LST(Block-Social))\0</urlPattern>
          <matchPattern>\1</matchPattern>
          <replacePattern>$RDIR(http://local.ptron/Blocked-S.htm)$LOG(R[HDR:URL] Block 5 - Social \1)</replacePattern>
        </filter>
      </folder>
    </folder>
  </folder>
</ProxydomoFilter>
amate commented 8 years ago

It seems that "Disable ALL" is no doubt the first match. After the match, does $RDIR has been overwritten is a problem?

Stone-D commented 8 years ago

Wow. That never occurred to me! I'm now using $SET(BLOCKED=True) in Disable ALL, and & (^$TST(BLOCKED=True)) in all subsequent block filters. Works as expected.

Thanks, sorry for the confusion!