Skip to content

Commit 3bbc810

Browse files
Merge branch 'release/5.0.1'
2 parents f54eadd + 1e61f7e commit 3bbc810

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+313
-87
lines changed

.github/workflows/main.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
19+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
2020
steps:
2121
- uses: "actions/checkout@v4"
22-
- uses: "actions/setup-python@v4"
22+
- uses: "actions/setup-python@v5"
2323
with:
2424
python-version: "${{ matrix.python-version }}"
2525
- name: "Update package details"
@@ -29,7 +29,7 @@ jobs:
2929
- name: "Build mod_wsgi packages"
3030
run: ./package.sh && ls -las dist
3131
- name: "Store built packages"
32-
uses: actions/upload-artifact@v3
32+
uses: "actions/upload-artifact@v4"
3333
with:
3434
name: dist ${{ matrix.python-version }}
3535
path: dist/*
@@ -42,14 +42,14 @@ jobs:
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
45+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
4646
steps:
4747
- uses: "actions/checkout@v4"
48-
- uses: "actions/setup-python@v4"
48+
- uses: "actions/setup-python@v5"
4949
with:
5050
python-version: "${{ matrix.python-version }}"
5151
- name: "Download built packages"
52-
uses: actions/download-artifact@v3
52+
uses: "actions/download-artifact@v4"
5353
with:
5454
name: dist ${{ matrix.python-version }}
5555
path: dist
@@ -66,7 +66,7 @@ jobs:
6666
- name: "Uninstall mod_wsgi"
6767
run: pip uninstall --yes mod_wsgi
6868
- name: "Install mod_wsgi-standalone"
69-
run: python -m pip install --verbose dist/mod_wsgi-standalone-[0-9].*.tar.gz
69+
run: python -m pip install --verbose dist/mod_wsgi[-_]standalone-[0-9].*.tar.gz
7070
- name: "Run mod_wsgi-express test #2"
7171
run: scripts/run-single-test.sh
7272
- name: "Uninstall mod_wsgi-standalone"

README-standalone.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ installed, with it using the version of Apache installed by the
2222
This method of installation is only suitable for where you want to use
2323
``mod_wsgi-express``. It cannot be used to build mod_wsgi for use with
2424
your system Apache installation. This installation method will not
25-
work on Windows, and also currently fails on macOS because the Apache
26-
Runtime (APR) library, has not been updated to latest macOS versions.
25+
work on Windows.
2726

2827
When installing mod_wsgi using this method, except that you will install
2928
the ``mod_wsgi-standalone`` package instead of the ``mod_wsgi`` package,

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl vim: set sw=4 expandtab :
22
dnl
3-
dnl Copyright 2007-2023 GRAHAM DUMPLETON
3+
dnl Copyright 2007-2024 GRAHAM DUMPLETON
44
dnl
55
dnl Licensed under the Apache License, Version 2.0 (the "License");
66
dnl you may not use this file except in compliance with the License.

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
# General information about the project.
4343
project = u'mod_wsgi'
44-
copyright = u'2007-2023, Graham Dumpleton'
44+
copyright = u'2007-2024, Graham Dumpleton'
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the

docs/configuration-directives/WSGIDaemonProcess.rst

+6
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,12 @@ Options which can be supplied to the ``WSGIDaemonProcess`` directive are:
375375
to handle more requests, restarting of the process will be delayed
376376
if possible.
377377

378+
Note that when a process is restarted due to a request timeout, if the
379+
Apache ``LogLevel`` is set to ``info`` or higher, or ``wsgi:info`` applied
380+
for ``LogLevel```, messages will be logged to the Apache error log file for
381+
the request which gives the Python stack trace for any request handler
382+
threads so you can work out where the request is blocking.
383+
378384
.. _deadlock-timeout:
379385

380386
**deadlock-timeout=sss**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
======================
2+
WSGIDestroyInterpreter
3+
======================
4+
5+
:Description: Enable/disable cleanup of Python interpreter.
6+
:Syntax: ``WSGIDestroyInterpreter On|Off``
7+
:Default: ``WSGIDestroyInterpreter On``
8+
:Context: server config
9+
10+
The ``WSGIDestroyInterpreter`` directive is used to control whether the Python
11+
interpreter is destroyed when processes are shutdown or restarted. By default
12+
the Python interpreter is destroyed when the process is shutdown or restarted.
13+
14+
This directive was added due to changes in Python 3.9 where the Python cleanup
15+
behaviour was changed such that it would wait on daemon threads to complete.
16+
This could cause cleanup of the Python interpreter to hang in the some cases
17+
where threads were created external to Python, as is the case where Python is
18+
embedded in a C program such as mod_wsgi with Apache.
19+
20+
This problem of hanging when cleanup of the Python interpreter was attempted
21+
was especially noticeable when using mod_wsgi to host Trac.
22+
23+
Note that it is not known whether versions of Python newer than 3.9 still have
24+
this problem or whether further changes were made in Python interpreter cleanup
25+
code.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=================
2+
WSGIErrorOverride
3+
=================
4+
5+
:Description: Enable/disable use of Apache error documents.
6+
:Syntax: ``WSGIErrorOverride On|Off``
7+
:Default: ``WSGIErrorOverride Off``
8+
:Context: server config, virtual host, directory, .htaccess
9+
10+
The ``WSGIErrorOverride`` directive when set to ``On``, and the WSGI application
11+
is running in daemon mode, will result in Apache error documents being used
12+
rather than those passed back by the WSGI application. This allows error
13+
documents to match any web site that the WSGI application may be integrated as a
14+
part of. This feature is akin to the ``ProxyErrorOverride`` directive of Apache
15+
but for mod_wsgi only.
16+
17+
Note that this directive has no effect when the WSGI application is running in
18+
embedded mode.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
================
2+
WSGIMapHEADToGET
3+
================
4+
5+
:Description: Enable/disable mapping of HEAD request to GET.
6+
:Syntax: ``WSGIMapHEADToGET On|Off|Auto``
7+
:Default: ``WSGIMapHEADToGET Auto``
8+
:Context: server config, virtual host, directory, .htaccess
9+
10+
The ``WSGIMapHEADToGET`` directive controls the behaviour of automatically
11+
mapping any ``HEAD`` request to a ``GET`` request when an Apache output filter
12+
is registered that may want to see the complete response in order to generate
13+
correct response headers.
14+
15+
The directive can be set to be either ``Auto`` (the default), ``On`` which
16+
will always map a ``HEAD`` to ``GET`` even if no output filters detected and
17+
``Off`` to always preserve the original request method type.
18+
19+
The directive may be required where a WSGI application tries to optimize and
20+
avoid doing work for a ``HEAD`` request by not actually generating a response
21+
so that complete response headers can still be generated. By doing this the
22+
WSGI application can break Apache filters for caching, so the mapping of
23+
``HEAD`` to ``GET`` can be required to avoid problems.

docs/configuration.rst

+3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ Configuration
1414
configuration-directives/WSGICaseSensitivity
1515
configuration-directives/WSGIChunkedRequest
1616
configuration-directives/WSGIDaemonProcess
17+
configuration-directives/WSGIDestroyInterpreter
18+
configuration-directives/WSGIErrorOverride
1719
configuration-directives/WSGIImportScript
1820
configuration-directives/WSGILazyInitialization
21+
configuration-directives/WSGIMapHEADToGET
1922
configuration-directives/WSGIPassAuthorization
2023
configuration-directives/WSGIProcessGroup
2124
configuration-directives/WSGIPythonEggs

docs/installation.rst

+7-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Installation
55
The mod_wsgi package can be installed from source code or may also be
66
available as a pre built binary package as part of your Linux distribution.
77

8-
Do be aware though that Linux distributions generally ship out of date
9-
versions of mod_wsgi and for long term support (LTS) versions of Linux can
10-
be anything up to about 5 years old. Those older versions are not supported
11-
in any way even though they are part of a so called LTS version of Linux.
8+
Do be aware though that Linux distributions can sometimes ship out of date
9+
versions of mod_wsgi, especially for long term support (LTS) versions of Linux.
10+
Those older versions are not supported in any way even though they are part of a
11+
so called LTS version of Linux.
1212

1313
If you want support and want to ensure you have the most up to date and
1414
bug free version of mod_wsgi, you should consider building and installing
@@ -20,6 +20,7 @@ operating systems such as Linux and MacOS X see:
2020
* :doc:`user-guides/quick-installation-guide`
2121
* :doc:`user-guides/installation-on-macosx`
2222

23-
If you are on Windows, you should instead use:
23+
For a simpler way of running a Python WSGI application using mod_wsgi, also
24+
checkout ``mod_wsgi-express``, details of which can currently be found at:
2425

25-
* https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst
26+
https://pypi.python.org/pypi/mod_wsgi

docs/release-notes.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Release Notes
55
.. toctree::
66
:maxdepth: 2
77

8+
release-notes/version-5.0.1
89
release-notes/version-5.0.0
910

1011
release-notes/version-4.9.4

docs/release-notes/version-5.0.1.rst

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
=============
2+
Version 5.0.1
3+
=============
4+
5+
Version 5.0.1 of mod_wsgi can be obtained from:
6+
7+
https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/5.0.1
8+
9+
Features Changed
10+
----------------
11+
12+
* Internally, when using Python 3.8 or newer, the PyConfig API will now be used
13+
due to deprecation and future removal of older C API alternatives. This was
14+
required to support Python 3.13.
15+
16+
Bugs Fixed
17+
----------
18+
19+
* Fix issue which could result in process crashing when values were supplied
20+
for user/password/realm of HTTP basic authentication which weren't compliant
21+
with UTF-8 encoding format.
22+
23+
* Fix memory leak in `check_password()` authentication hook handler.
24+
25+
* Change use of deprecated `thread.setDaemon` to `thread.daemon`.

docs/user-guides/application-issues.rst

-7
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,6 @@ Python::
162162
All up, configuring SELinux is a bit of a black art and so you are wise
163163
to do your research.
164164

165-
For some information about using mod_wsgi in a SELinux enabled environment
166-
check out:
167-
168-
* http://www.packtpub.com/article/selinux-secured-web-hosting-python-based-web-applications
169-
* http://www.globalherald.net/jb01/weblog/21.html
170-
* http://blog.endpoint.com/2010/02/selinux-httpd-modwsgi-26-rhel-centos-5.html
171-
172165
If you suspect that an issue may be caused by SELinux, you could
173166
temporarily try disabling it and doing a restart to verify whether it is
174167
the cause, but always re-enable it and do not disable it completely.

docs/user-guides/debugging-techniques.rst

+7-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ your prime source of information when things go wrong.
3030
Do note though that log messages generated by mod_wsgi are logged with
3131
various severity levels and which ones will be output to the Apache error
3232
log files will depend on how Apache has been configured. The standard
33-
configuration for Apache has the !LogLevel directive being set to 'warn'.
33+
configuration for Apache has the ``LogLevel`` directive being set to 'warn'.
3434
With this setting any important error messages will be output, but
3535
informational messages generated by mod_wsgi which can assist in working
3636
out what it is doing are not. Thus, if new to mod_wsgi or trying to debug a
@@ -39,6 +39,11 @@ log level instead::
3939

4040
LogLevel info
4141

42+
If you don't want to turn up log verbosity for the whole server, you can
43+
also set the log level for just the mod_wsgi module::
44+
45+
LogLevel warn mod_wsgi:info
46+
4247
If your Apache web server is only providing services for one host, it is
4348
likely that you will only have one error log file. If however the Apache
4449
web server is configured for multiple virtual hosts, then it is possible
@@ -1075,7 +1080,7 @@ going to need it because of a recurring problem::
10751080
pass
10761081

10771082
_thread = threading.Thread(target=_monitor)
1078-
_thread.setDaemon(True)
1083+
_thread.daemon = True
10791084

10801085
def _exiting():
10811086
try:

docs/user-guides/reloading-source-code.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ with how mod_wsgi works is shown below::
355355
pass
356356

357357
_thread = threading.Thread(target=_monitor)
358-
_thread.setDaemon(True)
358+
_thread.daemon = True
359359

360360
def _exiting():
361361
try:

pyproject.toml.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
2-
requires = ["setuptools>=40.8.0", "wheel", "mod_wsgi-httpd==2.4.54.1"]
2+
requires = ["setuptools>=40.8.0", "wheel", "mod_wsgi-httpd==2.4.62.1"]
33
build-backend = "setuptools.build_meta:__legacy__"

setup.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,21 @@ def get_apu_includes():
300300
if not os.path.exists(PYTHON_CFGDIR):
301301
PYTHON_CFGDIR = '%s-%s' % (PYTHON_CFGDIR, sys.platform)
302302

303-
PYTHON_LDFLAGS = ['-L%s' % PYTHON_CFGDIR]
303+
PYTHON_LDFLAGS = []
304304
if PYTHON_LIBDIR != APXS_LIBDIR:
305-
PYTHON_LDFLAGS.insert(0, '-L%s' % PYTHON_LIBDIR)
305+
PYTHON_LDFLAGS.append('-L%s' % PYTHON_LIBDIR)
306306

307307
PYTHON_LDLIBS = ['-lpython%s' % PYTHON_LDVERSION]
308308

309309
if os.path.exists(os.path.join(PYTHON_LIBDIR,
310310
'libpython%s.a' % PYTHON_VERSION)):
311311
PYTHON_LDLIBS = ['-lpython%s' % PYTHON_VERSION]
312+
PYTHON_LDFLAGS.append('-L%s' % PYTHON_CFGDIR)
312313

313314
if os.path.exists(os.path.join(PYTHON_CFGDIR,
314315
'libpython%s.a' % PYTHON_VERSION)):
315316
PYTHON_LDLIBS = ['-lpython%s' % PYTHON_VERSION]
317+
PYTHON_LDFLAGS.append('-L%s' % PYTHON_CFGDIR)
316318

317319
# Create the final set of compilation flags to be used.
318320

@@ -326,13 +328,16 @@ def get_apu_includes():
326328
LD_RUN_PATHS = []
327329
if os.name != 'nt':
328330
LD_RUN_PATH = os.environ.get('LD_RUN_PATH', '')
329-
LD_RUN_PATHS = [PYTHON_CFGDIR]
331+
LD_RUN_PATHS = []
332+
if '-L%s' % PYTHON_CFGDIR in PYTHON_LDFLAGS:
333+
LD_RUN_PATHS.append(PYTHON_CFGDIR)
330334
if PYTHON_LIBDIR != APXS_LIBDIR:
331335
LD_RUN_PATHS.insert(0, PYTHON_LIBDIR)
332336
LD_RUN_PATH += ':' + ':'.join(LD_RUN_PATHS)
333337
LD_RUN_PATH = LD_RUN_PATH.lstrip(':')
334338

335-
os.environ['LD_RUN_PATH'] = LD_RUN_PATH
339+
if LD_RUN_PATH:
340+
os.environ['LD_RUN_PATH'] = LD_RUN_PATH
336341

337342
# On MacOS X, recent versions of Apple's Apache do not support compiling
338343
# Apache modules with a target older than 10.8. This is because it
@@ -460,6 +465,6 @@ def _version():
460465
entry_points = { 'console_scripts':
461466
['mod_wsgi-express = mod_wsgi.server:main'],},
462467
zip_safe = False,
463-
install_requires = standalone and ['mod_wsgi-httpd==2.4.54.1'] or [],
468+
install_requires = standalone and ['mod_wsgi-httpd==2.4.62.1'] or [],
464469
python_requires='>=3.8',
465470
)

src/server/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ def _monitor():
12671267
pass
12681268

12691269
_thread = threading.Thread(target=_monitor)
1270-
_thread.setDaemon(True)
1270+
_thread.daemon = True
12711271

12721272
def _exiting():
12731273
try:

0 commit comments

Comments
 (0)