Accept authority or URI and extract only the authority and path.
(self, uri, default_port=True)
| 829 | return None, None |
| 830 | |
| 831 | def reduce_uri(self, uri, default_port=True): |
| 832 | """Accept authority or URI and extract only the authority and path.""" |
| 833 | # note HTTP URLs do not have a userinfo component |
| 834 | parts = urlsplit(uri) |
| 835 | if parts[1]: |
| 836 | # URI |
| 837 | scheme = parts[0] |
| 838 | authority = parts[1] |
| 839 | path = parts[2] or '/' |
| 840 | else: |
| 841 | # host or host:port |
| 842 | scheme = None |
| 843 | authority = uri |
| 844 | path = '/' |
| 845 | host, port = _splitport(authority) |
| 846 | if default_port and port is None and scheme is not None: |
| 847 | dport = {"http": 80, |
| 848 | "https": 443, |
| 849 | }.get(scheme) |
| 850 | if dport is not None: |
| 851 | authority = "%s:%d" % (host, dport) |
| 852 | return authority, path |
| 853 | |
| 854 | def is_suburi(self, base, test): |
| 855 | """Check if test is below base in a URI tree |
no test coverage detected