PoorWSGI 2.7.0__tar.gz → 2.8.0__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.
- poorwsgi-2.8.0/CONTRIBUTION.rst +113 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/PKG-INFO +29 -10
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/PoorWSGI.egg-info/PKG-INFO +29 -10
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/PoorWSGI.egg-info/SOURCES.txt +13 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/README.rst +10 -6
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/ChangeLog +23 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_poorwsgi_api.html +1 -0
- poorwsgi-2.8.0/doc/about.rst +111 -0
- poorwsgi-2.8.0/doc/documentation.rst +1437 -0
- poorwsgi-2.8.0/examples/__pycache__/aes_session.cpython-313-pytest-9.0.3.pyc +0 -0
- poorwsgi-2.8.0/examples/__pycache__/openapi3.cpython-313.pyc +0 -0
- poorwsgi-2.8.0/examples/__pycache__/poor_session.cpython-313.pyc +0 -0
- poorwsgi-2.8.0/examples/__pycache__/session.cpython-313.pyc +0 -0
- poorwsgi-2.8.0/examples/__pycache__/simple.cpython-313.pyc +0 -0
- poorwsgi-2.8.0/examples/aes_session.py +155 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/http_digest.py +15 -15
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/large_file.py +25 -26
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/metrics.py +7 -7
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/openapi3.py +33 -26
- poorwsgi-2.8.0/examples/poor_session.py +150 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/put_file.py +6 -6
- poorwsgi-2.8.0/examples/response_closed.py +42 -0
- poorwsgi-2.8.0/examples/session.py +161 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/simple.py +47 -92
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/simple_json.py +10 -10
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/websocket.py +14 -14
- poorwsgi-2.8.0/poorwsgi/__init__.py +28 -0
- poorwsgi-2.8.0/poorwsgi/aes_session.py +153 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/digest.py +24 -25
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/fieldstorage.py +157 -140
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/headers.py +62 -59
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/openapi_wrapper.py +20 -19
- poorwsgi-2.8.0/poorwsgi/request.py +1121 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/response.py +426 -302
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/results.py +310 -215
- poorwsgi-2.8.0/poorwsgi/session.py +471 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/state.py +5 -4
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/wsgi.py +501 -391
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/setup.py +4 -5
- poorwsgi-2.8.0/tests/test_aes_session.py +102 -0
- poorwsgi-2.8.0/tests/test_application_error.py +40 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/tests/test_digest.py +12 -3
- poorwsgi-2.8.0/tests/test_header.py +81 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/tests/test_request.py +71 -11
- poorwsgi-2.8.0/tests/test_responses.py +697 -0
- poorwsgi-2.8.0/tests/test_route_validation.py +228 -0
- poorwsgi-2.8.0/tests/test_session.py +318 -0
- poorwsgi-2.7.0/CONTRIBUTION.rst +0 -36
- poorwsgi-2.7.0/doc/about.rst +0 -111
- poorwsgi-2.7.0/doc/documentation.rst +0 -1327
- poorwsgi-2.7.0/poorwsgi/__init__.py +0 -26
- poorwsgi-2.7.0/poorwsgi/request.py +0 -1024
- poorwsgi-2.7.0/poorwsgi/session.py +0 -312
- poorwsgi-2.7.0/tests/test_header.py +0 -67
- poorwsgi-2.7.0/tests/test_responses.py +0 -573
- poorwsgi-2.7.0/tests/test_session.py +0 -164
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/MANIFEST.in +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/PoorWSGI.egg-info/dependency_links.txt +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/PoorWSGI.egg-info/requires.txt +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/PoorWSGI.egg-info/top_level.txt +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_documentation.html +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_footer.html +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_header.html +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_install.html +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_licence.html +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_poorwsgi.html +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_reference.html +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/_text.html +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/install.rst +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/licence.txt +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/small-logo.png +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/style.css +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/doc/web.css +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/openapi.json +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/examples/test.digest +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/poorwsgi/py.typed +0 -0
- {poorwsgi-2.7.0 → poorwsgi-2.8.0}/setup.cfg +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Contributing to the Project
|
|
2
|
+
===========================
|
|
3
|
+
|
|
4
|
+
Thank you for your interest in contributing to the PoorWSGI project! Every contribution is welcome. This document will guide you through the process of reporting a bug, suggesting an enhancement, or directly contributing code.
|
|
5
|
+
|
|
6
|
+
Reporting Bugs
|
|
7
|
+
--------------
|
|
8
|
+
If you encounter a bug, please ensure that you:
|
|
9
|
+
|
|
10
|
+
1. Search the existing `issues <https://github.com/PoorHttp/PoorWSGI/issues>`_ to ensure the bug has not already been reported.
|
|
11
|
+
2. If you cannot find the bug, create a new issue.
|
|
12
|
+
3. In the description, provide as much information as possible:
|
|
13
|
+
|
|
14
|
+
* The version of PoorWSGI you are using.
|
|
15
|
+
* The Python version and operating system.
|
|
16
|
+
* A short but descriptive summary of the bug.
|
|
17
|
+
* Steps to reproduce the bug.
|
|
18
|
+
* What you expected to happen and what actually happened.
|
|
19
|
+
|
|
20
|
+
Suggesting Enhancements
|
|
21
|
+
-----------------------
|
|
22
|
+
Do you have an idea for a new feature or improvement?
|
|
23
|
+
|
|
24
|
+
1. Create a new issue and describe your suggestion.
|
|
25
|
+
2. Explain why this feature would be useful and how it should work.
|
|
26
|
+
|
|
27
|
+
Development and Code Contribution
|
|
28
|
+
---------------------------------
|
|
29
|
+
If you want to contribute code, please follow these steps. The project is developed using a **Test-Driven Development (TDD)** approach. This means that for every new feature or bug fix, a failing test should be written first, followed by the code that makes the test pass.
|
|
30
|
+
|
|
31
|
+
1. Setting Up the Development Environment
|
|
32
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
33
|
+
|
|
34
|
+
First, prepare your local development environment.
|
|
35
|
+
|
|
36
|
+
.. code-block:: bash
|
|
37
|
+
|
|
38
|
+
# 1. Fork the repository and clone it
|
|
39
|
+
git clone https://github.com/YOUR-USERNAME/PoorWSGI.git
|
|
40
|
+
cd PoorWSGI
|
|
41
|
+
|
|
42
|
+
# 2. Create and activate a virtual environment
|
|
43
|
+
python3 -m venv .venv
|
|
44
|
+
source .venv/bin/activate
|
|
45
|
+
|
|
46
|
+
# 3. Install the project in editable mode and the development dependencies
|
|
47
|
+
python -m pip install --upgrade pip
|
|
48
|
+
pip install -e .
|
|
49
|
+
pip install -U pre-commit flake8 setuptools pytest pytest-doctestplus pytest-pylint pytest-mypy ruff isort
|
|
50
|
+
pip install -U openapi-core uwsgi simplejson WSocket requests websocket-client
|
|
51
|
+
pip install -U types-simplejson types-requests types-PyYAML
|
|
52
|
+
|
|
53
|
+
# 4. Activate pre-commit hooks for automatic code checking
|
|
54
|
+
pre-commit install
|
|
55
|
+
|
|
56
|
+
2. Code Style and Automatic Checks (pre-commit)
|
|
57
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
58
|
+
|
|
59
|
+
To maintain a consistent style and code quality, the project **requires the use of `pre-commit`**. This tool automatically runs a set of checks (called "hooks") before each commit. These checks include formatting, linting, and other code analyses. The configuration is defined in the `.pre-commit-config.yaml` file.
|
|
60
|
+
|
|
61
|
+
Thanks to `pre-commit`, you don't have to run all the tools manually. If a commit fails due to a check, `pre-commit` will often fix the code for you automatically. In that case, you just need to add the modified files again (`git add`) and repeat the commit.
|
|
62
|
+
|
|
63
|
+
If you still wish to run the checks manually during development (outside of a commit), you can use the following commands:
|
|
64
|
+
|
|
65
|
+
.. code-block:: bash
|
|
66
|
+
|
|
67
|
+
# Manually run all pre-commit hooks on all files
|
|
68
|
+
pre-commit run --all-files
|
|
69
|
+
|
|
70
|
+
# Alternatively, individual tools:
|
|
71
|
+
ruff format . # Formatting
|
|
72
|
+
ruff check . # Linting
|
|
73
|
+
pylint poorwsgi/ # In-depth analysis
|
|
74
|
+
isort . # Sorting imports
|
|
75
|
+
|
|
76
|
+
3. Running Tests
|
|
77
|
+
~~~~~~~~~~~~~~~~
|
|
78
|
+
|
|
79
|
+
As mentioned, TDD is a key part of development. All tests must pass before you submit a Pull Request.
|
|
80
|
+
|
|
81
|
+
* `tests/`: Contains unit tests.
|
|
82
|
+
* `tests_integrity/`: Contains integration tests, which may run real servers from the `examples/` directory.
|
|
83
|
+
|
|
84
|
+
You can run the tests using `pytest`:
|
|
85
|
+
|
|
86
|
+
.. code-block:: bash
|
|
87
|
+
|
|
88
|
+
# Run all tests (unit and integration)
|
|
89
|
+
pytest -v
|
|
90
|
+
|
|
91
|
+
# Run only unit tests
|
|
92
|
+
pytest -v tests/
|
|
93
|
+
|
|
94
|
+
# Run integration tests
|
|
95
|
+
pytest -v tests_integrity/
|
|
96
|
+
|
|
97
|
+
4. Submitting Changes (Pull Request)
|
|
98
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
99
|
+
|
|
100
|
+
1. Create a new branch for your changes: `git checkout -b feature/my-new-feature`.
|
|
101
|
+
2. Make your code changes and write tests for them.
|
|
102
|
+
3. Ensure that all local tests pass (`pytest -v`).
|
|
103
|
+
4. Create a commit. At this point, `pre-commit` will automatically check and possibly fix your code. If it fails, make the necessary adjustments and repeat the commit.
|
|
104
|
+
|
|
105
|
+
.. code-block:: bash
|
|
106
|
+
|
|
107
|
+
git add .
|
|
108
|
+
git commit -m "A brief description of the changes"
|
|
109
|
+
|
|
110
|
+
5. Push the changes to your fork: `git push origin feature/my-new-feature`.
|
|
111
|
+
6. Open a `Pull Request <https://github.com/PoorHttp/PoorWSGI/pulls>`_ to the `main` branch of the main repository.
|
|
112
|
+
|
|
113
|
+
Your Pull Request will be reviewed by automated tests (CI) and one of the project maintainers. Thank you for your help!
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: PoorWSGI
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0
|
|
4
4
|
Summary: Poor WSGI connector for Python
|
|
5
5
|
Home-page: http://poorhttp.zeropage.cz/poorwsgi
|
|
6
6
|
Author: Ondřej Tůma
|
|
@@ -16,7 +16,6 @@ Keywords: web wsgi development
|
|
|
16
16
|
Classifier: Development Status :: 5 - Production/Stable
|
|
17
17
|
Classifier: Environment :: Web Environment
|
|
18
18
|
Classifier: Intended Audience :: Developers
|
|
19
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
20
19
|
Classifier: Natural Language :: English
|
|
21
20
|
Classifier: Natural Language :: Czech
|
|
22
21
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
@@ -27,10 +26,26 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
27
26
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
28
27
|
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
|
|
29
28
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
30
|
-
Requires-Python: >=3.
|
|
29
|
+
Requires-Python: >=3.11
|
|
31
30
|
Description-Content-Type: text/x-rst
|
|
31
|
+
License-File: doc/licence.txt
|
|
32
32
|
Provides-Extra: jsongeneratorresponse
|
|
33
33
|
Requires-Dist: simplejson; extra == "jsongeneratorresponse"
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: author-email
|
|
36
|
+
Dynamic: classifier
|
|
37
|
+
Dynamic: description
|
|
38
|
+
Dynamic: description-content-type
|
|
39
|
+
Dynamic: home-page
|
|
40
|
+
Dynamic: keywords
|
|
41
|
+
Dynamic: license
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
Dynamic: maintainer
|
|
44
|
+
Dynamic: maintainer-email
|
|
45
|
+
Dynamic: project-url
|
|
46
|
+
Dynamic: provides-extra
|
|
47
|
+
Dynamic: requires-python
|
|
48
|
+
Dynamic: summary
|
|
34
49
|
|
|
35
50
|
.. image:: https://img.shields.io/pypi/v/PoorWSGI.svg
|
|
36
51
|
:target: https://pypi.python.org/pypi/poorwsgi/
|
|
@@ -44,9 +59,13 @@ Requires-Dist: simplejson; extra == "jsongeneratorresponse"
|
|
|
44
59
|
:target: https://pypi.python.org/pypi/poorwsgi/
|
|
45
60
|
:alt: Development Status
|
|
46
61
|
|
|
47
|
-
.. image:: https://img.shields.io/
|
|
48
|
-
:target: https://
|
|
49
|
-
:alt: Build Status
|
|
62
|
+
.. image:: https://img.shields.io/github/actions/workflow/status/PoorHTTP/PoorWSGI/python-package.yml?branch=master
|
|
63
|
+
:target: https://github.com/PoorHttp/PoorWSGI/actions/workflows/python-package.yml
|
|
64
|
+
:alt: GitHub Build Workflow Status
|
|
65
|
+
|
|
66
|
+
.. image:: https://img.shields.io/github/actions/workflow/status/PoorHTTP/PoorWSGI/codeql-analysis.yml?branch=master&label=CodeQL
|
|
67
|
+
:target: https://github.com/PoorHttp/PoorWSGI/actions/workflows/codeql-analysis.yml
|
|
68
|
+
:alt: GitHub CodeQL Workflow Status
|
|
50
69
|
|
|
51
70
|
.. image:: https://img.shields.io/pypi/l/PoorWSGI.svg
|
|
52
71
|
:target: https://pypi.python.org/pypi/poorwsgi/
|
|
@@ -55,8 +74,8 @@ Requires-Dist: simplejson; extra == "jsongeneratorresponse"
|
|
|
55
74
|
Poor WSGI for Python
|
|
56
75
|
====================
|
|
57
76
|
|
|
58
|
-
Poor WSGI for Python is
|
|
59
|
-
and your application. The simplest way to run and test it looks like
|
|
77
|
+
Poor WSGI for Python is a lightweight WSGI connector with URI routing between the WSGI server
|
|
78
|
+
and your application. The simplest way to run and test it looks like this:
|
|
60
79
|
|
|
61
80
|
.. code-block:: python
|
|
62
81
|
|
|
@@ -73,7 +92,7 @@ and your application. The simplest way to run and test it looks like that:
|
|
|
73
92
|
httpd = make_server('127.0.0.1', 8080, app)
|
|
74
93
|
httpd.serve_forever()
|
|
75
94
|
|
|
76
|
-
You can use
|
|
95
|
+
You can use Python's wsgiref.simple_server to test it:
|
|
77
96
|
|
|
78
97
|
.. code-block::
|
|
79
98
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: PoorWSGI
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0
|
|
4
4
|
Summary: Poor WSGI connector for Python
|
|
5
5
|
Home-page: http://poorhttp.zeropage.cz/poorwsgi
|
|
6
6
|
Author: Ondřej Tůma
|
|
@@ -16,7 +16,6 @@ Keywords: web wsgi development
|
|
|
16
16
|
Classifier: Development Status :: 5 - Production/Stable
|
|
17
17
|
Classifier: Environment :: Web Environment
|
|
18
18
|
Classifier: Intended Audience :: Developers
|
|
19
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
20
19
|
Classifier: Natural Language :: English
|
|
21
20
|
Classifier: Natural Language :: Czech
|
|
22
21
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
@@ -27,10 +26,26 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
27
26
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
28
27
|
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
|
|
29
28
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
30
|
-
Requires-Python: >=3.
|
|
29
|
+
Requires-Python: >=3.11
|
|
31
30
|
Description-Content-Type: text/x-rst
|
|
31
|
+
License-File: doc/licence.txt
|
|
32
32
|
Provides-Extra: jsongeneratorresponse
|
|
33
33
|
Requires-Dist: simplejson; extra == "jsongeneratorresponse"
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: author-email
|
|
36
|
+
Dynamic: classifier
|
|
37
|
+
Dynamic: description
|
|
38
|
+
Dynamic: description-content-type
|
|
39
|
+
Dynamic: home-page
|
|
40
|
+
Dynamic: keywords
|
|
41
|
+
Dynamic: license
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
Dynamic: maintainer
|
|
44
|
+
Dynamic: maintainer-email
|
|
45
|
+
Dynamic: project-url
|
|
46
|
+
Dynamic: provides-extra
|
|
47
|
+
Dynamic: requires-python
|
|
48
|
+
Dynamic: summary
|
|
34
49
|
|
|
35
50
|
.. image:: https://img.shields.io/pypi/v/PoorWSGI.svg
|
|
36
51
|
:target: https://pypi.python.org/pypi/poorwsgi/
|
|
@@ -44,9 +59,13 @@ Requires-Dist: simplejson; extra == "jsongeneratorresponse"
|
|
|
44
59
|
:target: https://pypi.python.org/pypi/poorwsgi/
|
|
45
60
|
:alt: Development Status
|
|
46
61
|
|
|
47
|
-
.. image:: https://img.shields.io/
|
|
48
|
-
:target: https://
|
|
49
|
-
:alt: Build Status
|
|
62
|
+
.. image:: https://img.shields.io/github/actions/workflow/status/PoorHTTP/PoorWSGI/python-package.yml?branch=master
|
|
63
|
+
:target: https://github.com/PoorHttp/PoorWSGI/actions/workflows/python-package.yml
|
|
64
|
+
:alt: GitHub Build Workflow Status
|
|
65
|
+
|
|
66
|
+
.. image:: https://img.shields.io/github/actions/workflow/status/PoorHTTP/PoorWSGI/codeql-analysis.yml?branch=master&label=CodeQL
|
|
67
|
+
:target: https://github.com/PoorHttp/PoorWSGI/actions/workflows/codeql-analysis.yml
|
|
68
|
+
:alt: GitHub CodeQL Workflow Status
|
|
50
69
|
|
|
51
70
|
.. image:: https://img.shields.io/pypi/l/PoorWSGI.svg
|
|
52
71
|
:target: https://pypi.python.org/pypi/poorwsgi/
|
|
@@ -55,8 +74,8 @@ Requires-Dist: simplejson; extra == "jsongeneratorresponse"
|
|
|
55
74
|
Poor WSGI for Python
|
|
56
75
|
====================
|
|
57
76
|
|
|
58
|
-
Poor WSGI for Python is
|
|
59
|
-
and your application. The simplest way to run and test it looks like
|
|
77
|
+
Poor WSGI for Python is a lightweight WSGI connector with URI routing between the WSGI server
|
|
78
|
+
and your application. The simplest way to run and test it looks like this:
|
|
60
79
|
|
|
61
80
|
.. code-block:: python
|
|
62
81
|
|
|
@@ -73,7 +92,7 @@ and your application. The simplest way to run and test it looks like that:
|
|
|
73
92
|
httpd = make_server('127.0.0.1', 8080, app)
|
|
74
93
|
httpd.serve_forever()
|
|
75
94
|
|
|
76
|
-
You can use
|
|
95
|
+
You can use Python's wsgiref.simple_server to test it:
|
|
77
96
|
|
|
78
97
|
.. code-block::
|
|
79
98
|
|
|
@@ -24,17 +24,27 @@ doc/licence.txt
|
|
|
24
24
|
doc/small-logo.png
|
|
25
25
|
doc/style.css
|
|
26
26
|
doc/web.css
|
|
27
|
+
examples/aes_session.py
|
|
27
28
|
examples/http_digest.py
|
|
28
29
|
examples/large_file.py
|
|
29
30
|
examples/metrics.py
|
|
30
31
|
examples/openapi.json
|
|
31
32
|
examples/openapi3.py
|
|
33
|
+
examples/poor_session.py
|
|
32
34
|
examples/put_file.py
|
|
35
|
+
examples/response_closed.py
|
|
36
|
+
examples/session.py
|
|
33
37
|
examples/simple.py
|
|
34
38
|
examples/simple_json.py
|
|
35
39
|
examples/test.digest
|
|
36
40
|
examples/websocket.py
|
|
41
|
+
examples/__pycache__/aes_session.cpython-313-pytest-9.0.3.pyc
|
|
42
|
+
examples/__pycache__/openapi3.cpython-313.pyc
|
|
43
|
+
examples/__pycache__/poor_session.cpython-313.pyc
|
|
44
|
+
examples/__pycache__/session.cpython-313.pyc
|
|
45
|
+
examples/__pycache__/simple.cpython-313.pyc
|
|
37
46
|
poorwsgi/__init__.py
|
|
47
|
+
poorwsgi/aes_session.py
|
|
38
48
|
poorwsgi/digest.py
|
|
39
49
|
poorwsgi/fieldstorage.py
|
|
40
50
|
poorwsgi/headers.py
|
|
@@ -46,8 +56,11 @@ poorwsgi/results.py
|
|
|
46
56
|
poorwsgi/session.py
|
|
47
57
|
poorwsgi/state.py
|
|
48
58
|
poorwsgi/wsgi.py
|
|
59
|
+
tests/test_aes_session.py
|
|
60
|
+
tests/test_application_error.py
|
|
49
61
|
tests/test_digest.py
|
|
50
62
|
tests/test_header.py
|
|
51
63
|
tests/test_request.py
|
|
52
64
|
tests/test_responses.py
|
|
65
|
+
tests/test_route_validation.py
|
|
53
66
|
tests/test_session.py
|
|
@@ -10,9 +10,13 @@
|
|
|
10
10
|
:target: https://pypi.python.org/pypi/poorwsgi/
|
|
11
11
|
:alt: Development Status
|
|
12
12
|
|
|
13
|
-
.. image:: https://img.shields.io/
|
|
14
|
-
:target: https://
|
|
15
|
-
:alt: Build Status
|
|
13
|
+
.. image:: https://img.shields.io/github/actions/workflow/status/PoorHTTP/PoorWSGI/python-package.yml?branch=master
|
|
14
|
+
:target: https://github.com/PoorHttp/PoorWSGI/actions/workflows/python-package.yml
|
|
15
|
+
:alt: GitHub Build Workflow Status
|
|
16
|
+
|
|
17
|
+
.. image:: https://img.shields.io/github/actions/workflow/status/PoorHTTP/PoorWSGI/codeql-analysis.yml?branch=master&label=CodeQL
|
|
18
|
+
:target: https://github.com/PoorHttp/PoorWSGI/actions/workflows/codeql-analysis.yml
|
|
19
|
+
:alt: GitHub CodeQL Workflow Status
|
|
16
20
|
|
|
17
21
|
.. image:: https://img.shields.io/pypi/l/PoorWSGI.svg
|
|
18
22
|
:target: https://pypi.python.org/pypi/poorwsgi/
|
|
@@ -21,8 +25,8 @@
|
|
|
21
25
|
Poor WSGI for Python
|
|
22
26
|
====================
|
|
23
27
|
|
|
24
|
-
Poor WSGI for Python is
|
|
25
|
-
and your application. The simplest way to run and test it looks like
|
|
28
|
+
Poor WSGI for Python is a lightweight WSGI connector with URI routing between the WSGI server
|
|
29
|
+
and your application. The simplest way to run and test it looks like this:
|
|
26
30
|
|
|
27
31
|
.. code-block:: python
|
|
28
32
|
|
|
@@ -39,7 +43,7 @@ and your application. The simplest way to run and test it looks like that:
|
|
|
39
43
|
httpd = make_server('127.0.0.1', 8080, app)
|
|
40
44
|
httpd.serve_forever()
|
|
41
45
|
|
|
42
|
-
You can use
|
|
46
|
+
You can use Python's wsgiref.simple_server to test it:
|
|
43
47
|
|
|
44
48
|
.. code-block::
|
|
45
49
|
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
==== 2.8.0 ====
|
|
2
|
+
* Fix I/O operation on closed file/buffer error in Response classes (#21)
|
|
3
|
+
* Validate route filter definitions to reject spaces with clear error
|
|
4
|
+
messages (#25)
|
|
5
|
+
* Bad PATH_INFO encoding exception handling (#37, #38)
|
|
6
|
+
* Updated openapi3.py example to openapi-core 0.23+ API (Spec replaced
|
|
7
|
+
by OpenAPI)
|
|
8
|
+
* Drop Python 3.9 and 3.10 support, require Python >= 3.11
|
|
9
|
+
* Session base class - plain cookie wrapper for server-side session IDs or
|
|
10
|
+
JWTs; PoorSession inherits from Session
|
|
11
|
+
* PoorSession cookie encryption - ! existing cookies are invalidated !
|
|
12
|
+
- Self-contained encrypted session cookie using shake_256 XOF keystream
|
|
13
|
+
(1024 B) and byte-substitution (no external dependencies)
|
|
14
|
+
- HMAC-SHA256 authentication (Encrypt-then-MAC); tampered or forged
|
|
15
|
+
cookies are rejected
|
|
16
|
+
- Domain-separated key derivation for keystream, MAC and permutation
|
|
17
|
+
- Users will be logged out after upgrading from a previous version
|
|
18
|
+
* AESSession - stronger self-contained session cookie (requires pyaes)
|
|
19
|
+
- AES-256-CTR encryption with a fresh random 16-byte nonce per write
|
|
20
|
+
(prevents CTR nonce-reuse attacks)
|
|
21
|
+
- HMAC-SHA256 authentication with domain-separated keys (Encrypt-then-MAC)
|
|
22
|
+
- Inherits from Session; same interface as PoorSession
|
|
23
|
+
|
|
1
24
|
==== 2.7.0 ====
|
|
2
25
|
* Reserved Request.db attribute for usage
|
|
3
26
|
* Right HTTPException type annotation
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
{% set api = api + load_module('headers') %}
|
|
8
8
|
{% set api = api + load_module('fieldstorage') %}
|
|
9
9
|
{% set api = api + load_module('session') %}
|
|
10
|
+
{% set api = api + load_module('aes_session') %}
|
|
10
11
|
{% set api = api + load_module('digest') %}
|
|
11
12
|
{% set api = api + load_module('results') %}
|
|
12
13
|
{% set api = api + load_module('state') %}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
About PoorWSGI
|
|
2
|
+
==============
|
|
3
|
+
PoorWSGI for Python is a lightweight WSGI connector with URI routing between the WSGI
|
|
4
|
+
server and your application. It has a request object similar to mod_python,
|
|
5
|
+
which is passed to all URI or HTTP state handlers. The simplest way to run and
|
|
6
|
+
test it with wsgiref.simple_server looks like this:
|
|
7
|
+
|
|
8
|
+
.. code:: python
|
|
9
|
+
|
|
10
|
+
from wsgiref.simple_server import make_server
|
|
11
|
+
from poorwsgi import Application
|
|
12
|
+
|
|
13
|
+
app = Application('test')
|
|
14
|
+
|
|
15
|
+
@app.route('/test')
|
|
16
|
+
def root_uri(req):
|
|
17
|
+
return 'Hello world'
|
|
18
|
+
|
|
19
|
+
if __name__ == '__main__':
|
|
20
|
+
httpd = make_server('127.0.0.1', 8080, app)
|
|
21
|
+
httpd.serve_forever()
|
|
22
|
+
|
|
23
|
+
.. code:: sh
|
|
24
|
+
|
|
25
|
+
~$ python simple.py
|
|
26
|
+
|
|
27
|
+
It has basic error pages like 403, 404, 405, 500, or 501. A 500 internal server
|
|
28
|
+
error will have debug output if poor_Debug is set. Additionally, there is a special debug page
|
|
29
|
+
on the ``/debug-info`` URI, which is also available when poor_Debug is set.
|
|
30
|
+
|
|
31
|
+
.. code:: sh
|
|
32
|
+
|
|
33
|
+
~$ poor_Debug=On python simple.py
|
|
34
|
+
|
|
35
|
+
PoorWSGI has some functions that you can use as a real HTTP server, which can
|
|
36
|
+
send files with the correct MIME type from disk, or generate directory listings.
|
|
37
|
+
See the Configuration section for more info.
|
|
38
|
+
|
|
39
|
+
.. code:: sh
|
|
40
|
+
|
|
41
|
+
~$ poor_DocumentRoot=./web poor_DocumentIndex=On python simple.py
|
|
42
|
+
|
|
43
|
+
The Story
|
|
44
|
+
=========
|
|
45
|
+
Once upon a time, there was a King. Or there was a Prince. Oh, maybe, there wasn't a
|
|
46
|
+
prince, but probably there was a Programmer, hmm, okay, a programmer. And this
|
|
47
|
+
programmer knew Apache's mod_python. Yes, it was a very, very bad paragon, but
|
|
48
|
+
before Python, he was programming in PHP. So mod_python was a big movement in the
|
|
49
|
+
right direction at that time.
|
|
50
|
+
|
|
51
|
+
He was finding out how he could write and host Python applications on a server.
|
|
52
|
+
And as he knew some closed-source framework that worked correctly, he wrote
|
|
53
|
+
another similar one for his own use. That is the basis of Poor Publisher. But WSGI was
|
|
54
|
+
coming, so he had an idea to write a new backend for his applications. That
|
|
55
|
+
is the basis of Poor HTTP and PoorWSGI.
|
|
56
|
+
|
|
57
|
+
Sometimes, Poor HTTP and PoorWSGI were one project. It was a better way, but
|
|
58
|
+
that wasn't the right way. After some time, he divided these two projects into
|
|
59
|
+
PoorWSGI and Poor HTTP projects. But there was a flawed concept in the PoorWSGI
|
|
60
|
+
framework, which wasn't a framework in fact. So he looked for other projects and
|
|
61
|
+
saw how nice it could be to create a WSGI application for the user. That is when
|
|
62
|
+
PoorWSGI was rewritten into library-type code, and the application became a
|
|
63
|
+
callable class with some nice routing methods and decorators.
|
|
64
|
+
|
|
65
|
+
This is the story of one programmer and his WSGI framework, which is not a
|
|
66
|
+
framework in fact, because it only handles URI requests with some mod_python
|
|
67
|
+
compatibility layer. As you can see, there are several ways this project can
|
|
68
|
+
evolve. Its author, the programmer, uses it on his projects, and it would be
|
|
69
|
+
very nice if there were more programmers than just him who used this little
|
|
70
|
+
project. Let's call it a WSGI connector.
|
|
71
|
+
|
|
72
|
+
If you have any questions, proposals, bug fixes, text corrections, or any
|
|
73
|
+
other matters, please send me an email to *mcbig at zeropage.cz*, or you can
|
|
74
|
+
create an issue on GitHub: https://github.com/PoorHttp/PoorWSGI/issues.
|
|
75
|
+
Thank you so much.
|
|
76
|
+
|
|
77
|
+
ChangeLog
|
|
78
|
+
=========
|
|
79
|
+
For release history or differences between releases, you can use git diff, diff
|
|
80
|
+
log, the git2cl tool, or consult the ChangeLog from the source code or on the Git
|
|
81
|
+
repository's web page. See:
|
|
82
|
+
|
|
83
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/doc/ChangeLog
|
|
84
|
+
|
|
85
|
+
Examples
|
|
86
|
+
========
|
|
87
|
+
These are published application test files. You can download them, study them,
|
|
88
|
+
test them, or use them as you wish. See:
|
|
89
|
+
|
|
90
|
+
**http_digest.py**
|
|
91
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/examples/http_digest.py
|
|
92
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/examples/test.digest
|
|
93
|
+
|
|
94
|
+
**large_file.py**
|
|
95
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/examples/large_file.py
|
|
96
|
+
|
|
97
|
+
**put_file.py**
|
|
98
|
+
|
|
99
|
+
Example of uploading a file via the PUT method, similar to WebDAV.
|
|
100
|
+
|
|
101
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/examples/put_file.py
|
|
102
|
+
|
|
103
|
+
**openapi3.py**
|
|
104
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/examples/openapi3.py
|
|
105
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/examples/openapi.json
|
|
106
|
+
|
|
107
|
+
**simple.py**
|
|
108
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/examples/simple.py
|
|
109
|
+
|
|
110
|
+
**websocket.py**
|
|
111
|
+
https://github.com/PoorHttp/PoorWSGI/blob/master/examples/websocket.py
|