asgi-tools 1.3.1__tar.gz → 1.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {asgi_tools-1.3.1/asgi_tools.egg-info → asgi_tools-1.3.3}/PKG-INFO +2 -2
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/middleware.py +2 -2
- {asgi_tools-1.3.1 → asgi_tools-1.3.3/asgi_tools.egg-info}/PKG-INFO +2 -2
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools.egg-info/requires.txt +1 -1
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/pyproject.toml +2 -2
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_middlewares.py +9 -1
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/LICENSE +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/MANIFEST.in +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/README.rst +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/__init__.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/_compat.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/app.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/constants.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/errors.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/forms.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/forms.pyx +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/logs.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/multipart.pxd +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/multipart.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/multipart.pyx +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/py.typed +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/request.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/response.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/router.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/tests.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/types.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/utils.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools/view.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools.egg-info/SOURCES.txt +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools.egg-info/dependency_links.txt +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/asgi_tools.egg-info/top_level.txt +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/setup.cfg +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/setup.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_app.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_benchmarks.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_client.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_compat.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_compatibility.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_examples.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_formdata.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_request.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_responses.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_types.py +0 -0
- {asgi_tools-1.3.1 → asgi_tools-1.3.3}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: asgi-tools
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.3
|
4
4
|
Summary: ASGI Toolkit to build web applications
|
5
5
|
Author-email: Kirill Klenov <horneds@gmail.com>
|
6
6
|
License: MIT License
|
@@ -33,7 +33,7 @@ Requires-Dist: async-timeout; python_version < "3.11"
|
|
33
33
|
Provides-Extra: tests
|
34
34
|
Requires-Dist: aiofile; extra == "tests"
|
35
35
|
Requires-Dist: pytest; extra == "tests"
|
36
|
-
Requires-Dist: pytest-aio[curio,trio]>=1.3.
|
36
|
+
Requires-Dist: pytest-aio[curio,trio]>=1.3.3; extra == "tests"
|
37
37
|
Requires-Dist: pytest-benchmark; extra == "tests"
|
38
38
|
Requires-Dist: PyYAML; extra == "tests"
|
39
39
|
Requires-Dist: ruff; extra == "tests"
|
@@ -392,7 +392,7 @@ class StaticFilesMiddleware(BaseMiddleware):
|
|
392
392
|
super().__init__(app)
|
393
393
|
self.url_prefix = url_prefix
|
394
394
|
folders = folders or []
|
395
|
-
self.folders: list[Path] = [Path(folder) for folder in folders]
|
395
|
+
self.folders: list[Path] = [Path(folder).resolve() for folder in folders]
|
396
396
|
|
397
397
|
async def __process__(self, scope: TASGIScope, receive: TASGIReceive, send: TASGISend) -> None:
|
398
398
|
"""Serve static files for self url prefix."""
|
@@ -403,7 +403,7 @@ class StaticFilesMiddleware(BaseMiddleware):
|
|
403
403
|
filename = path[len(url_prefix) :].strip("/")
|
404
404
|
for folder in self.folders:
|
405
405
|
filepath = folder.joinpath(filename).resolve()
|
406
|
-
if
|
406
|
+
if not filepath.is_file() or not filepath.is_relative_to(folder):
|
407
407
|
continue
|
408
408
|
with suppress(ASGIError):
|
409
409
|
response = ResponseFile(filepath, headers_only=scope["method"] == "HEAD")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: asgi-tools
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.3
|
4
4
|
Summary: ASGI Toolkit to build web applications
|
5
5
|
Author-email: Kirill Klenov <horneds@gmail.com>
|
6
6
|
License: MIT License
|
@@ -33,7 +33,7 @@ Requires-Dist: async-timeout; python_version < "3.11"
|
|
33
33
|
Provides-Extra: tests
|
34
34
|
Requires-Dist: aiofile; extra == "tests"
|
35
35
|
Requires-Dist: pytest; extra == "tests"
|
36
|
-
Requires-Dist: pytest-aio[curio,trio]>=1.3.
|
36
|
+
Requires-Dist: pytest-aio[curio,trio]>=1.3.3; extra == "tests"
|
37
37
|
Requires-Dist: pytest-benchmark; extra == "tests"
|
38
38
|
Requires-Dist: PyYAML; extra == "tests"
|
39
39
|
Requires-Dist: ruff; extra == "tests"
|
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel", "Cython"]
|
|
3
3
|
|
4
4
|
[project]
|
5
5
|
name = "asgi-tools"
|
6
|
-
version = "1.3.
|
6
|
+
version = "1.3.3"
|
7
7
|
description = "ASGI Toolkit to build web applications"
|
8
8
|
readme = "README.rst"
|
9
9
|
requires-python = ">=3.10"
|
@@ -43,7 +43,7 @@ documentation = "https://klen.github.io/asgi-tools"
|
|
43
43
|
tests = [
|
44
44
|
"aiofile",
|
45
45
|
"pytest",
|
46
|
-
"pytest-aio[curio,trio] >= 1.3.
|
46
|
+
"pytest-aio[curio,trio] >= 1.3.3",
|
47
47
|
"pytest-benchmark",
|
48
48
|
"PyYAML",
|
49
49
|
"ruff",
|
@@ -192,7 +192,7 @@ async def test_staticfiles_middleware(client_cls, app):
|
|
192
192
|
|
193
193
|
from asgi_tools import StaticFilesMiddleware
|
194
194
|
|
195
|
-
app = StaticFilesMiddleware(app, folders=["
|
195
|
+
app = StaticFilesMiddleware(app, folders=["tests"])
|
196
196
|
|
197
197
|
client = client_cls(app)
|
198
198
|
res = await client.get("/")
|
@@ -210,6 +210,14 @@ async def test_staticfiles_middleware(client_cls, app):
|
|
210
210
|
text = await res.text()
|
211
211
|
assert text.startswith('"""test middlewares"""')
|
212
212
|
|
213
|
+
res = await client.get("/static/fixtures/multipart/CR_in_header.http")
|
214
|
+
assert res.status_code == 200
|
215
|
+
text = await res.text()
|
216
|
+
assert text.startswith("------WebKitFormBoundaryT")
|
217
|
+
|
218
|
+
res = await client.get("/static/../asgi_tools/__init__.py")
|
219
|
+
assert res.status_code == 404
|
220
|
+
|
213
221
|
res = await client.get("/static/unknown")
|
214
222
|
assert res.status_code == 404
|
215
223
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|