Return the application's base URI (no PATH_INFO or QUERY_STRING)
(environ)
| 35 | return 'http' |
| 36 | |
| 37 | def application_uri(environ): |
| 38 | """Return the application's base URI (no PATH_INFO or QUERY_STRING)""" |
| 39 | url = environ['wsgi.url_scheme']+'://' |
| 40 | from urllib.parse import quote |
| 41 | |
| 42 | if environ.get('HTTP_HOST'): |
| 43 | url += environ['HTTP_HOST'] |
| 44 | else: |
| 45 | url += environ['SERVER_NAME'] |
| 46 | |
| 47 | if environ['wsgi.url_scheme'] == 'https': |
| 48 | if environ['SERVER_PORT'] != '443': |
| 49 | url += ':' + environ['SERVER_PORT'] |
| 50 | else: |
| 51 | if environ['SERVER_PORT'] != '80': |
| 52 | url += ':' + environ['SERVER_PORT'] |
| 53 | |
| 54 | url += quote(environ.get('SCRIPT_NAME') or '/', encoding='latin1') |
| 55 | return url |
| 56 | |
| 57 | def request_uri(environ, include_query=True): |
| 58 | """Return the full request URI, optionally including the query string""" |
no test coverage detected
searching dependent graphs…