servestatic 4.3.3__tar.gz → 4.3.4__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.
- {servestatic-4.3.3 → servestatic-4.3.4}/PKG-INFO +23 -2
- {servestatic-4.3.3 → servestatic-4.3.4}/README.md +22 -1
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/__init__.py +1 -1
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/base.py +9 -2
- {servestatic-4.3.3 → servestatic-4.3.4}/.gitignore +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/LICENSE.md +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/pyproject.toml +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/apps.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/asgi.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/checks.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/cli.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/compress.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/management/__init__.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/management/commands/__init__.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/management/commands/runserver.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/manifest_hash.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/media_types.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/middleware.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/responders.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/runserver_nostatic/__init__.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/runserver_nostatic/apps.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/runserver_nostatic/management/__init__.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/runserver_nostatic/management/commands/__init__.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/runserver_nostatic/management/commands/runserver.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/storage.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/utils.py +0 -0
- {servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/wsgi.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: servestatic
|
|
3
|
-
Version: 4.3.
|
|
3
|
+
Version: 4.3.4
|
|
4
4
|
Summary: Production-grade static file server for Python WSGI & ASGI.
|
|
5
5
|
Project-URL: Changelog, https://archmonger.github.io/ServeStatic/latest/changelog/
|
|
6
6
|
Project-URL: Documentation, https://archmonger.github.io/ServeStatic/
|
|
@@ -63,7 +63,28 @@ When using `ServeStatic`, best practices are automatically handled such as:
|
|
|
63
63
|
- Proper handling of `Accept-Encoding` and `Vary` headers
|
|
64
64
|
- Setting far-future cache headers for immutable static files.
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
Here is a short example of ASGI standalone mode:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
# filename: my_project.py
|
|
73
|
+
from servestatic import ServeStaticASGI
|
|
74
|
+
|
|
75
|
+
asgi_app = ServeStaticASGI(
|
|
76
|
+
application=None, # `application=None` will run ServeStatic in standalone mode.
|
|
77
|
+
root="/path/to/static/files",
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Now, use any webserver CLI to serve static files. Since this example uses ASGI, here is a sample command for `uvicorn` (a popular ASGI webserver):
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
uvicorn my_project:asgi_app
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Visit the [documentation](https://archmonger.github.io/ServeStatic/) to get started, or learn more about `ServeStatic` .
|
|
67
88
|
|
|
68
89
|
## Frequently Asked Questions
|
|
69
90
|
|
|
@@ -29,7 +29,28 @@ When using `ServeStatic`, best practices are automatically handled such as:
|
|
|
29
29
|
- Proper handling of `Accept-Encoding` and `Vary` headers
|
|
30
30
|
- Setting far-future cache headers for immutable static files.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
Here is a short example of ASGI standalone mode:
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
# filename: my_project.py
|
|
39
|
+
from servestatic import ServeStaticASGI
|
|
40
|
+
|
|
41
|
+
asgi_app = ServeStaticASGI(
|
|
42
|
+
application=None, # `application=None` will run ServeStatic in standalone mode.
|
|
43
|
+
root="/path/to/static/files",
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Now, use any webserver CLI to serve static files. Since this example uses ASGI, here is a sample command for `uvicorn` (a popular ASGI webserver):
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
uvicorn my_project:asgi_app
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Visit the [documentation](https://archmonger.github.io/ServeStatic/) to get started, or learn more about `ServeStatic` .
|
|
33
54
|
|
|
34
55
|
## Frequently Asked Questions
|
|
35
56
|
|
|
@@ -162,8 +162,15 @@ class ServeStaticBase:
|
|
|
162
162
|
if getattr(self, "allow_unsafe_symlinks", False):
|
|
163
163
|
return True
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
try:
|
|
166
|
+
resolved_root = os.path.realpath(normalized_root)
|
|
167
|
+
resolved_path = os.path.realpath(normalized_path)
|
|
168
|
+
except ValueError:
|
|
169
|
+
# A raw NUL byte (e.g. from a request path containing %00) survives
|
|
170
|
+
# normpath() but makes realpath() raise. Treat such a path as being
|
|
171
|
+
# outside the root (i.e. not found/forbidden) rather than letting an
|
|
172
|
+
# unhandled ValueError propagate and crash the request.
|
|
173
|
+
return False
|
|
167
174
|
return self._path_is_within(resolved_root, resolved_path)
|
|
168
175
|
|
|
169
176
|
@staticmethod
|
|
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
|
{servestatic-4.3.3 → servestatic-4.3.4}/src/servestatic/runserver_nostatic/management/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|