Return reach of host h, as defined by RFC 2965, section 1. The reach R of a host name H is defined as follows: * If - H is the host domain name of a host; and, - H has the form A.B; and - A has no embedded (that is, interior) dots; and
(h)
| 689 | return path |
| 690 | |
| 691 | def reach(h): |
| 692 | """Return reach of host h, as defined by RFC 2965, section 1. |
| 693 | |
| 694 | The reach R of a host name H is defined as follows: |
| 695 | |
| 696 | * If |
| 697 | |
| 698 | - H is the host domain name of a host; and, |
| 699 | |
| 700 | - H has the form A.B; and |
| 701 | |
| 702 | - A has no embedded (that is, interior) dots; and |
| 703 | |
| 704 | - B has at least one embedded dot, or B is the string "local". |
| 705 | then the reach of H is .B. |
| 706 | |
| 707 | * Otherwise, the reach of H is H. |
| 708 | |
| 709 | >>> reach("www.acme.com") |
| 710 | '.acme.com' |
| 711 | >>> reach("acme.com") |
| 712 | 'acme.com' |
| 713 | >>> reach("acme.local") |
| 714 | '.local' |
| 715 | |
| 716 | """ |
| 717 | i = h.find(".") |
| 718 | if i >= 0: |
| 719 | #a = h[:i] # this line is only here to show what a is |
| 720 | b = h[i+1:] |
| 721 | i = b.find(".") |
| 722 | if is_HDN(h) and (i >= 0 or b == "local"): |
| 723 | return "."+b |
| 724 | return h |
| 725 | |
| 726 | def is_third_party(request): |
| 727 | """ |
no test coverage detected