For blocking/accepting domains. A and B may be host domain names or IP addresses.
(A, B)
| 598 | return True |
| 599 | |
| 600 | def user_domain_match(A, B): |
| 601 | """For blocking/accepting domains. |
| 602 | |
| 603 | A and B may be host domain names or IP addresses. |
| 604 | |
| 605 | """ |
| 606 | A = A.lower() |
| 607 | B = B.lower() |
| 608 | if not (liberal_is_HDN(A) and liberal_is_HDN(B)): |
| 609 | if A == B: |
| 610 | # equal IP addresses |
| 611 | return True |
| 612 | return False |
| 613 | initial_dot = B.startswith(".") |
| 614 | if initial_dot and A.endswith(B): |
| 615 | return True |
| 616 | if not initial_dot and A == B: |
| 617 | return True |
| 618 | return False |
| 619 | |
| 620 | cut_port_re = re.compile(r":\d+$", re.ASCII) |
| 621 | def request_host(request): |
searching dependent graphs…