def _build_absolute_uri(environ, path='/'):
    """Constructs an absolute URI."""
    root = '%s://%s' % (environ['wsgi.url_scheme'], environ['HTTP_HOST'])
    path = not path.startswith('/') and environ['PATH_INFO'] + path or path
    return root + path
