Skip to content

Commit

Permalink
Merge branch 'release/5.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Oct 1, 2024
2 parents f54eadd + 1e61f7e commit 3bbc810
Show file tree
Hide file tree
Showing 47 changed files with 313 additions and 87 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
- name: "Update package details"
Expand All @@ -29,7 +29,7 @@ jobs:
- name: "Build mod_wsgi packages"
run: ./package.sh && ls -las dist
- name: "Store built packages"
uses: actions/upload-artifact@v3
uses: "actions/upload-artifact@v4"
with:
name: dist ${{ matrix.python-version }}
path: dist/*
Expand All @@ -42,14 +42,14 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
- name: "Download built packages"
uses: actions/download-artifact@v3
uses: "actions/download-artifact@v4"
with:
name: dist ${{ matrix.python-version }}
path: dist
Expand All @@ -66,7 +66,7 @@ jobs:
- name: "Uninstall mod_wsgi"
run: pip uninstall --yes mod_wsgi
- name: "Install mod_wsgi-standalone"
run: python -m pip install --verbose dist/mod_wsgi-standalone-[0-9].*.tar.gz
run: python -m pip install --verbose dist/mod_wsgi[-_]standalone-[0-9].*.tar.gz
- name: "Run mod_wsgi-express test #2"
run: scripts/run-single-test.sh
- name: "Uninstall mod_wsgi-standalone"
Expand Down
3 changes: 1 addition & 2 deletions README-standalone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ installed, with it using the version of Apache installed by the
This method of installation is only suitable for where you want to use
``mod_wsgi-express``. It cannot be used to build mod_wsgi for use with
your system Apache installation. This installation method will not
work on Windows, and also currently fails on macOS because the Apache
Runtime (APR) library, has not been updated to latest macOS versions.
work on Windows.

When installing mod_wsgi using this method, except that you will install
the ``mod_wsgi-standalone`` package instead of the ``mod_wsgi`` package,
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dnl vim: set sw=4 expandtab :
dnl
dnl Copyright 2007-2023 GRAHAM DUMPLETON
dnl Copyright 2007-2024 GRAHAM DUMPLETON
dnl
dnl Licensed under the Apache License, Version 2.0 (the "License");
dnl you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

# General information about the project.
project = u'mod_wsgi'
copyright = u'2007-2023, Graham Dumpleton'
copyright = u'2007-2024, Graham Dumpleton'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
6 changes: 6 additions & 0 deletions docs/configuration-directives/WSGIDaemonProcess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ Options which can be supplied to the ``WSGIDaemonProcess`` directive are:
to handle more requests, restarting of the process will be delayed
if possible.

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

.. _deadlock-timeout:

**deadlock-timeout=sss**
Expand Down
25 changes: 25 additions & 0 deletions docs/configuration-directives/WSGIDestroyInterpreter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
======================
WSGIDestroyInterpreter
======================

:Description: Enable/disable cleanup of Python interpreter.
:Syntax: ``WSGIDestroyInterpreter On|Off``
:Default: ``WSGIDestroyInterpreter On``
:Context: server config

The ``WSGIDestroyInterpreter`` directive is used to control whether the Python
interpreter is destroyed when processes are shutdown or restarted. By default
the Python interpreter is destroyed when the process is shutdown or restarted.

This directive was added due to changes in Python 3.9 where the Python cleanup
behaviour was changed such that it would wait on daemon threads to complete.
This could cause cleanup of the Python interpreter to hang in the some cases
where threads were created external to Python, as is the case where Python is
embedded in a C program such as mod_wsgi with Apache.

This problem of hanging when cleanup of the Python interpreter was attempted
was especially noticeable when using mod_wsgi to host Trac.

Note that it is not known whether versions of Python newer than 3.9 still have
this problem or whether further changes were made in Python interpreter cleanup
code.
18 changes: 18 additions & 0 deletions docs/configuration-directives/WSGIErrorOverride.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
=================
WSGIErrorOverride
=================

:Description: Enable/disable use of Apache error documents.
:Syntax: ``WSGIErrorOverride On|Off``
:Default: ``WSGIErrorOverride Off``
:Context: server config, virtual host, directory, .htaccess

The ``WSGIErrorOverride`` directive when set to ``On``, and the WSGI application
is running in daemon mode, will result in Apache error documents being used
rather than those passed back by the WSGI application. This allows error
documents to match any web site that the WSGI application may be integrated as a
part of. This feature is akin to the ``ProxyErrorOverride`` directive of Apache
but for mod_wsgi only.

Note that this directive has no effect when the WSGI application is running in
embedded mode.
23 changes: 23 additions & 0 deletions docs/configuration-directives/WSGIMapHEADToGET.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
================
WSGIMapHEADToGET
================

:Description: Enable/disable mapping of HEAD request to GET.
:Syntax: ``WSGIMapHEADToGET On|Off|Auto``
:Default: ``WSGIMapHEADToGET Auto``
:Context: server config, virtual host, directory, .htaccess

The ``WSGIMapHEADToGET`` directive controls the behaviour of automatically
mapping any ``HEAD`` request to a ``GET`` request when an Apache output filter
is registered that may want to see the complete response in order to generate
correct response headers.

The directive can be set to be either ``Auto`` (the default), ``On`` which
will always map a ``HEAD`` to ``GET`` even if no output filters detected and
``Off`` to always preserve the original request method type.

The directive may be required where a WSGI application tries to optimize and
avoid doing work for a ``HEAD`` request by not actually generating a response
so that complete response headers can still be generated. By doing this the
WSGI application can break Apache filters for caching, so the mapping of
``HEAD`` to ``GET`` can be required to avoid problems.
3 changes: 3 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ Configuration
configuration-directives/WSGICaseSensitivity
configuration-directives/WSGIChunkedRequest
configuration-directives/WSGIDaemonProcess
configuration-directives/WSGIDestroyInterpreter
configuration-directives/WSGIErrorOverride
configuration-directives/WSGIImportScript
configuration-directives/WSGILazyInitialization
configuration-directives/WSGIMapHEADToGET
configuration-directives/WSGIPassAuthorization
configuration-directives/WSGIProcessGroup
configuration-directives/WSGIPythonEggs
Expand Down
13 changes: 7 additions & 6 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Installation
The mod_wsgi package can be installed from source code or may also be
available as a pre built binary package as part of your Linux distribution.

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

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

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

* https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst
https://pypi.python.org/pypi/mod_wsgi
1 change: 1 addition & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release Notes
.. toctree::
:maxdepth: 2

release-notes/version-5.0.1
release-notes/version-5.0.0

release-notes/version-4.9.4
Expand Down
25 changes: 25 additions & 0 deletions docs/release-notes/version-5.0.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
=============
Version 5.0.1
=============

Version 5.0.1 of mod_wsgi can be obtained from:

https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/5.0.1

Features Changed
----------------

* Internally, when using Python 3.8 or newer, the PyConfig API will now be used
due to deprecation and future removal of older C API alternatives. This was
required to support Python 3.13.

Bugs Fixed
----------

* Fix issue which could result in process crashing when values were supplied
for user/password/realm of HTTP basic authentication which weren't compliant
with UTF-8 encoding format.

* Fix memory leak in `check_password()` authentication hook handler.

* Change use of deprecated `thread.setDaemon` to `thread.daemon`.
7 changes: 0 additions & 7 deletions docs/user-guides/application-issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,6 @@ Python::
All up, configuring SELinux is a bit of a black art and so you are wise
to do your research.

For some information about using mod_wsgi in a SELinux enabled environment
check out:

* http://www.packtpub.com/article/selinux-secured-web-hosting-python-based-web-applications
* http://www.globalherald.net/jb01/weblog/21.html
* http://blog.endpoint.com/2010/02/selinux-httpd-modwsgi-26-rhel-centos-5.html

If you suspect that an issue may be caused by SELinux, you could
temporarily try disabling it and doing a restart to verify whether it is
the cause, but always re-enable it and do not disable it completely.
Expand Down
9 changes: 7 additions & 2 deletions docs/user-guides/debugging-techniques.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ your prime source of information when things go wrong.
Do note though that log messages generated by mod_wsgi are logged with
various severity levels and which ones will be output to the Apache error
log files will depend on how Apache has been configured. The standard
configuration for Apache has the !LogLevel directive being set to 'warn'.
configuration for Apache has the ``LogLevel`` directive being set to 'warn'.
With this setting any important error messages will be output, but
informational messages generated by mod_wsgi which can assist in working
out what it is doing are not. Thus, if new to mod_wsgi or trying to debug a
Expand All @@ -39,6 +39,11 @@ log level instead::

LogLevel info

If you don't want to turn up log verbosity for the whole server, you can
also set the log level for just the mod_wsgi module::

LogLevel warn mod_wsgi:info

If your Apache web server is only providing services for one host, it is
likely that you will only have one error log file. If however the Apache
web server is configured for multiple virtual hosts, then it is possible
Expand Down Expand Up @@ -1075,7 +1080,7 @@ going to need it because of a recurring problem::
pass

_thread = threading.Thread(target=_monitor)
_thread.setDaemon(True)
_thread.daemon = True

def _exiting():
try:
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guides/reloading-source-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ with how mod_wsgi works is shown below::
pass

_thread = threading.Thread(target=_monitor)
_thread.setDaemon(True)
_thread.daemon = True

def _exiting():
try:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools>=40.8.0", "wheel", "mod_wsgi-httpd==2.4.54.1"]
requires = ["setuptools>=40.8.0", "wheel", "mod_wsgi-httpd==2.4.62.1"]
build-backend = "setuptools.build_meta:__legacy__"
15 changes: 10 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,21 @@ def get_apu_includes():
if not os.path.exists(PYTHON_CFGDIR):
PYTHON_CFGDIR = '%s-%s' % (PYTHON_CFGDIR, sys.platform)

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

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

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

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

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

Expand All @@ -326,13 +328,16 @@ def get_apu_includes():
LD_RUN_PATHS = []
if os.name != 'nt':
LD_RUN_PATH = os.environ.get('LD_RUN_PATH', '')
LD_RUN_PATHS = [PYTHON_CFGDIR]
LD_RUN_PATHS = []
if '-L%s' % PYTHON_CFGDIR in PYTHON_LDFLAGS:
LD_RUN_PATHS.append(PYTHON_CFGDIR)
if PYTHON_LIBDIR != APXS_LIBDIR:
LD_RUN_PATHS.insert(0, PYTHON_LIBDIR)
LD_RUN_PATH += ':' + ':'.join(LD_RUN_PATHS)
LD_RUN_PATH = LD_RUN_PATH.lstrip(':')

os.environ['LD_RUN_PATH'] = LD_RUN_PATH
if LD_RUN_PATH:
os.environ['LD_RUN_PATH'] = LD_RUN_PATH

# On MacOS X, recent versions of Apple's Apache do not support compiling
# Apache modules with a target older than 10.8. This is because it
Expand Down Expand Up @@ -460,6 +465,6 @@ def _version():
entry_points = { 'console_scripts':
['mod_wsgi-express = mod_wsgi.server:main'],},
zip_safe = False,
install_requires = standalone and ['mod_wsgi-httpd==2.4.54.1'] or [],
install_requires = standalone and ['mod_wsgi-httpd==2.4.62.1'] or [],
python_requires='>=3.8',
)
2 changes: 1 addition & 1 deletion src/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ def _monitor():
pass

_thread = threading.Thread(target=_monitor)
_thread.setDaemon(True)
_thread.daemon = True

def _exiting():
try:
Expand Down
Loading

0 comments on commit 3bbc810

Please sign in to comment.