diff --git a/emmett/__main__.py b/emmett/__main__.py index d4b7ad2d..6dedb24f 100644 --- a/emmett/__main__.py +++ b/emmett/__main__.py @@ -9,7 +9,6 @@ :license: BSD-3-Clause """ -if __name__ == "__main__": - from .cli import main +from emmett.cli import main - main(as_module=True) +main(as_module=True) diff --git a/emmett/__version__.py b/emmett/__version__.py index 2e6e020c..472aa8d1 100644 --- a/emmett/__version__.py +++ b/emmett/__version__.py @@ -1 +1 @@ -__version__ = "2.5.8" +__version__ = "2.5.9" diff --git a/emmett/http.py b/emmett/http.py index da44e28b..c96aa3ea 100644 --- a/emmett/http.py +++ b/emmett/http.py @@ -221,7 +221,7 @@ async def asgi(self, scope, send): return self._headers.update(self._get_stat_headers(stat_data)) await self._send_headers(send) - if 'http.response.pathsend' in scope['extensions']: + if 'http.response.pathsend' in scope.get('extensions', {}): await send({ 'type': 'http.response.pathsend', 'path': str(self.file_path) diff --git a/emmett/rsgi/wrappers.py b/emmett/rsgi/wrappers.py index e6a189b6..0de63011 100644 --- a/emmett/rsgi/wrappers.py +++ b/emmett/rsgi/wrappers.py @@ -42,6 +42,12 @@ def __init__( def headers(self): return self._scope.headers + @cachedprop + def host(self) -> str: + if self._scope.http_version[0] == '1': + return self.headers.get('host') + return self._scope.authority + @cachedprop def query_params(self) -> sdict[str, Union[str, List[str]]]: rv: sdict[str, Any] = sdict() diff --git a/pyproject.toml b/pyproject.toml index 24c4949b..0986e5e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "emmett" [tool.poetry] name = "emmett" -version = "2.5.8" +version = "2.5.9" description = "The web framework for inventors" authors = ["Giovanni Barillari "] license = "BSD-3-Clause" @@ -47,7 +47,7 @@ emmett = "emmett.cli:main" [tool.poetry.dependencies] python = "^3.8" click = ">=6.0" -granian = "~1.0.0" +granian = "~1.0.2" emmett-crypto = "^0.5" pendulum = "~3.0.0" pyDAL = "17.3"