Forum Discussion
f5_rocks
Nimbostratus
May 06, 2016Trying to correctly fformat multiple not statements
started with this...
when CLIENT_ACCEPTED {event HTTP_REQUEST enable}
when HTTP_REQUEST {
set MY_HOST [string tolower [HTTP::host]]
set MY_URI [string tolower [HTTP::uri]]
if {$MY_URI start...
- May 07, 2016
probably doesn't mean what you think. Considernot or not
. Assuming that A, B and C are mutually exclusive conditions, the statementnot A or not B
is true under all of the following conditions:not A or not B- A is true
- B is true
- C is true
That's because
is true if: A is not true, if B is not true, or if both are not true. In the first case (not A or not B
), B is not true, so the statement matches. In the second case (A is true
), A is not true, so the statement matches. In the third case, both A and B are not true, so the statement matches. Putting this in terms of your command, consider:B is truenot ($MY_URI starts_with "/abcd/web/abcdpayment.web/") or not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")If
starts_with "/abcd/web/abcdpayment.web/" this statement actually matches (that is, it evaluates to true) because the condition$MY_URI
is in fact true:not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
does NOT start with "/abcd/web/abcdpaymentprocessing.web/".$MY_URIYou want
. Considernot and not
. According to this:not A and not B- if A is true, the statement is false (because
is false)not A - if B is true, the statement is false (because
is false)not B - if C is true, the statement is true (because
is true andnot A
is true)not B
Again, matching against your logic:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") and not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")Now, if
starts with "/abcd/web/abcdpayment.web/", this statement is false.$MY_URIIncidentally, this is exactly equivalent to:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/" or $MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
VernonWells
Employee
May 07, 2016not or not probably doesn't mean what you think. Consider not A or not B. Assuming that A, B and C are mutually exclusive conditions, the statement not A or not B is true under all of the following conditions:
- A is true
- B is true
- C is true
That's because
not A or not B is true if: A is not true, if B is not true, or if both are not true. In the first case (A is true), B is not true, so the statement matches. In the second case (B is true), A is not true, so the statement matches. In the third case, both A and B are not true, so the statement matches. Putting this in terms of your command, consider:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") or not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
If
$MY_URI starts_with "/abcd/web/abcdpayment.web/" this statement actually matches (that is, it evaluates to true) because the condition not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/") is in fact true: $MY_URI does NOT start with "/abcd/web/abcdpaymentprocessing.web/".
You want
not and not. Consider not A and not B. According to this:
- if A is true, the statement is false (because
is false)not A - if B is true, the statement is false (because
is false)not B - if C is true, the statement is true (because
is true andnot A
is true)not B
Again, matching against your logic:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") and not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
Now, if
$MY_URI starts with "/abcd/web/abcdpayment.web/", this statement is false.
Incidentally, this is exactly equivalent to:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/" or $MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
f5_rocks
Nimbostratus
May 07, 2016I understand. The first example with the "and not", made it clear. Thanks.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects