summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Dumpleton <Graham.Dumpleton@gmail.com>2015-10-03 20:44:20 +1000
committerGraham Dumpleton <Graham.Dumpleton@gmail.com>2015-10-03 20:44:20 +1000
commit10f33c324c799b7f4153db0d1de1469ffca78f5d (patch)
tree9a64c3c562e05104176749e58ee0abd560c61f34
parent5ffdf0b64545e1c45663f3d41faf871bca03a41c (diff)
parent2765e78f23be8d129b4d9f3c7f542cac5ef4d443 (diff)
downloadmod_wsgi-4.4.14.tar.gz
Merge branch 'release/4.4.14'4.4.14
-rw-r--r--README.rst2
-rw-r--r--docs/configuration.rst21
-rw-r--r--docs/contributing.rst123
-rw-r--r--docs/dead-parrot.jpgbin99508 -> 0 bytes
-rw-r--r--docs/finding-help.rst94
-rw-r--r--docs/getting-started.rst36
-rw-r--r--docs/index.rst88
-rw-r--r--docs/installation.rst32
-rw-r--r--docs/project-status.rst41
-rw-r--r--docs/release-notes.rst68
-rw-r--r--docs/release-notes/index.rst67
-rw-r--r--docs/release-notes/version-4.4.14.rst49
-rw-r--r--docs/reporting-bugs.rst15
-rw-r--r--docs/requirements.rst32
-rw-r--r--docs/security-issues.rst16
-rw-r--r--docs/source-code.rst16
-rw-r--r--docs/troubleshooting.rst30
-rw-r--r--setup.py36
-rw-r--r--src/server/__init__.py82
-rw-r--r--src/server/wsgi_logger.c9
-rw-r--r--src/server/wsgi_memory.c2
-rw-r--r--src/server/wsgi_version.h4
22 files changed, 741 insertions, 122 deletions
diff --git a/README.rst b/README.rst
index 6de83f6..2027b4f 100644
--- a/README.rst
+++ b/README.rst
@@ -171,7 +171,7 @@ doing this, you will need to perform additional steps.
The first thing you must do is supply the ``--user`` and ``--group``
options to say what user and group your Python web application should run
-as. Most Linux distrbutions will pre define a special user for Apache to
+as. Most Linux distributions will pre define a special user for Apache to
run as, so you can use that. Alternatively you can use any other special
user account you have created for running the Python web application::
diff --git a/docs/configuration.rst b/docs/configuration.rst
new file mode 100644
index 0000000..df011dd
--- /dev/null
+++ b/docs/configuration.rst
@@ -0,0 +1,21 @@
+=============
+Configuration
+=============
+
+.. warning ::
+
+ Documentation linked here is actually located on the old Google Code
+ site and has not yet been transitioned to this site. Some documentation
+ on the old site may be out of date, especially anything related to
+ running mod_wsgi on Windows. For more details as to why and the links to
+ all the old documentation see :doc:`project-status`.
+
+In addition to the quick configuration guide found at:
+
+* `Quick Configuration Guide <https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide>`_
+
+additional details on the configuration directives in mod_wsgi and how to
+use them is available in the following documents:
+
+* `Configuration Guidelines <https://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines>`_
+* `Configuration Directives <https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives>`_
diff --git a/docs/contributing.rst b/docs/contributing.rst
new file mode 100644
index 0000000..8ad7752
--- /dev/null
+++ b/docs/contributing.rst
@@ -0,0 +1,123 @@
+============
+Contributing
+============
+
+The mod_wsgi package is a solo effort by Graham Dumpletaon.
+
+The package is developed purely in the author's spare time and is not
+funded in any way by a company, nor is it developed for a specific
+companies requirements. In fact the author doesn't even develop it for his
+own needs. It is developed purely because it represents an interesting
+technical challenge and not because the author needs it himself to host a
+significant web site.
+
+How to make a donation
+----------------------
+
+If you use mod_wsgi and wish to show your appreciation, donations can be
+made via `PayPal <https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=636842>`_, an Amazon (USA store only) gift certificate sent to Graham.Dumpleton
+at gmail dot com or using `Gratipay
+<https://gratipay.com/~GrahamDumpleton/>`_.
+
+A suggested formula for how much to donate is:
+
+* If using mod_wsgi for personal use, then consider donating what you would
+ pay for one months worth of a single host used to run your own site.
+
+* If using mod_wsgi for a company web site, then consider donating what you
+ would pay for two months worth of a single host used to run that site.
+
+* If using mod_wsgi as part of a web hosting service which you then charge
+ other people for using, then consider donating what you would pay for
+ three months worth of a single host used to run that site.
+
+In other words, if you feel inclined, donate an amount commensurate with
+how much benefit you are getting from mod_wsgi. The reference to the cost
+of hosting is used at it reflects in some way how much you can afford or
+might be willing to pay for a hosting service yourself.
+
+On that basis, donations might realistically range from $5 up to $150 or
+more. Obviously where your company spends ridiculous amounts of money on
+web hosting you can instead elect to donate something more within the range
+stated above rather than how much you actually spend on web hosting
+services.
+
+Now for the reality, which is that it is very rare that a company will ever
+donate any money to an Open Source project. As such, when donations have
+occassionally been received (which doesn't happen very often), they are
+from individuals using mod_wsgi themselves.
+
+Some people do openly begrudge Open Source projects soliciting donations,
+but the amounts received overall are so insignificant in comparison to how
+much effort is generally put into projects and what a developer would need
+to survive that anything received is more a symbolic gesture, more than
+anything else, of ones appreciation.
+
+Given that donations invariably are from individuals, do know that they are
+accepted with much gratitude and appreciation in return that you are at
+least, even if companies aren't, trying to help support Open Source
+projects in some way.
+
+How else can you donate
+-----------------------
+
+If you are an author of a book related to Apache, Python, Docker or any
+other technologies which go into providing web hosting services, then will
+also happily accept an electronic copy of the book for reference.
+
+Still don't think a monetary contribution is something you would do, you
+can also simply send a Twitter message to the author expressing your
+appreciation. You will be surprised how far positive encouragement and
+appreciation can go with people who work on Open Source projects. This is
+because in part satisfaction comes from knowing people are benefiting from
+the work being done. If you never do or say anything, then Open Source
+developers will never know that you do appreciate the work they do, so
+don't be quiet when an Open Source project is of value to you, at least say
+'Thank You'.
+
+How are donations used
+----------------------
+
+Any monetary donations typically go towards buying clothes, toys, music,
+books and apps for the authors 2 children. They are therefore used as a
+special treat for the authors kids.
+
+Source code contributions
+-------------------------
+
+You might be thinking, what about source code contributions. Although it
+would be great for this project to grow to have multiple developers working
+on the code and documentation, reality is that working inside of Apache and
+the Python C APIs is quite specialised. It isn't therefore the most
+attractive of projects in that regard. If however you are keen, then would
+love to hear from you.
+
+Open Source free loaders
+------------------------
+
+If you are the sort of person who thinks that the Internet exists only to
+provide you with free stuff and where you think everyone out there exists
+purely to help you work out your problems, then it may be better that you
+go free load off some other WSGI server project.
+
+Even if you don't contribute as described above, if you at least recognise
+that other people are giving up their time to help you and that you put in
+some effort yourself to resolve a problem first, and then explain it
+properly in some detail to others when seeking help, providing answers to
+any questions asked of you, then you will still be helped.
+
+The worst sort of people, which hopefully you don't want to be one of, are
+those who simply say something is broken but will not provide sufficient
+details, thereby forcing other people to waste huge amounts of time
+dragging out the information required to help you, or having to guess what
+your problem is.
+
+It is people in this latter category which are becoming a significant drain
+on the time of developers of Open Source projects and which are a part of
+why so many Open Source developers are experiencing burnout. So if you are
+the sort to expect people to help you, complain about things when the
+problem is really your own unwillingness to learn, and generally give
+nothing positive in return, even if only encouragement, then don't expect
+to be helped. Your like has caused too much damage in the past already to
+any number of Open Source projects and will not be tolerated here. The
+mental health of Open Source developers is more important than you are.
diff --git a/docs/dead-parrot.jpg b/docs/dead-parrot.jpg
deleted file mode 100644
index d51de87..0000000
--- a/docs/dead-parrot.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/finding-help.rst b/docs/finding-help.rst
new file mode 100644
index 0000000..f4c47dc
--- /dev/null
+++ b/docs/finding-help.rst
@@ -0,0 +1,94 @@
+============
+Finding Help
+============
+
+If after you have gone through all the available documentation you still
+cannot work out how to do something or can't resolve a problem you are
+having, use the mod_wsgi mailing list to post your question. The mailing
+list is hosted by Google Groups at:
+
+* http://groups.google.com/group/modwsgi
+
+You do not need to have a Google email account as Google Groups allows you
+to register external email addresses as well.
+
+Please use the mailing list in preference to raising a ticket in the issue
+tracker, unless you are somewhat certain that the problem is a bug in
+mod_wsgi and not just some environment issue related to your application,
+any third party packages being used or the operating system. It is much
+easier to have a discussion on the mailing list than the issue tracker.
+
+The mailing list also has many people participating, or at least reading,
+so you have people with a broad experience with many third party Python web
+packages and operating systems who may be able to help.
+
+If the problem is potentially more an issue with a third party package or
+the operating system rather than mod_wsgi, you might also consider asking
+on any mailing list related to the third party package instead.
+
+A further option is to ask your question on StackOverflow, if a programming
+question, or ServerFault, if an administration issue. These sites allow a
+broad range of questions about many topics with quite a large user base of
+sometimes knowledgeable people.
+
+A final option you might try is any IRC channels related to any third party
+package or the more general #wsgi.
+
+Do be aware though that the only forum that is guaranteed to be monitored
+is the mod_wsgi mailing list. Questions are not gauranteed to be answered
+on sites such as StackOverflow and ServerFault, on IRC, or mailing lists
+for other packages. So, it is much preferable to use the mod_wsgi mailing
+list if you want an informed answer for a mod_wsgi specific question.
+
+As a general rule, if you have never participated in public forums
+previously to seek answers to technical questions, including about Open
+Source software, it is highly recommended you have a read of.
+
+* http://www.catb.org/esr/faqs/smart-questions.html
+
+This will help you to ensure you have exhausted all possibilities as to
+where to find information and try and solve the problem yourself, as well
+as assist you in framing your question the best way so as to get the best
+response possible.
+
+Remember that people on the mailing list are volunteering their time to
+help and don't get paid for answering questions. Thus, it is in your
+interest not to annoy them too much.
+
+No matter which forum you use, when asking questions, it is always helpful
+to detail the following:
+
+1. Which version of mod_wsgi you are using and if using a packaged
+ distribution, who provided the distribution.
+
+ If you are not using the latest version, then upgrade first and verify
+ the problem still occurs with the latest version.
+
+2. Which version of Python you are using and if using a packaged
+ distribution, who provided the distribution.
+
+3. Which version of Apache you are using and if using a packaged
+ distribution, who provided the distribution.
+
+ If not using latest version of Apache available, then consider upgrading
+ and trying again. If at all possible, avoid using Apache 2.0 or 2.2. You
+ definitely shouldn't still be using Apache 1.3
+
+4. What operating system you are using.
+
+5. Details on any third party packages being used and what versions of
+ those packages.
+
+6. The mod_wsgi configuration you are using from Apache configuration files.
+
+ In particular you should indicate whether you are using mod_wsgi
+ embedded mode or daemon mode. Also can be helpful to indicate what MPM
+ Apache has been compiled for and whether mod_php or mod_python are being
+ loaded into the same Apache instance.
+
+7. Relevant error messages from the Apache error logs.
+
+ Specifically, don't just quote the single line you think shows the error
+ message. Instead, also show the lines before and after that point. These
+ other lines from the error logs may show supplemental error messages
+ from Apache or mod_wsgi or provide Python traceback information.
diff --git a/docs/getting-started.rst b/docs/getting-started.rst
new file mode 100644
index 0000000..991709b
--- /dev/null
+++ b/docs/getting-started.rst
@@ -0,0 +1,36 @@
+===============
+Getting Started
+===============
+
+.. warning ::
+
+ Documentation linked here is actually located on the old Google Code
+ site and has not yet been transitioned to this site. Some documentation
+ on the old site may be out of date, especially anything related to
+ running mod_wsgi on Windows. For more details as to why and the links to
+ all the old documentation see :doc:`project-status`.
+
+If starting out with mod_wsgi it is recommended you start out with a simple
+'Hello World!' type application.
+
+Do not attempt to use a Python web application dependent on a web framework
+such as Django, Flask or Pyramid until you have got a basic 'Hello World!'
+application running first. The simpler WSGI application will validate that
+your mod_wsgi installation is working okay and that you at least understand
+the basics of configuring Apache.
+
+You can find a simple 'Hello World!' WSGI application, along with setup
+instructions for the traditional way of setting up Apache and mod_wsgi,
+described in:
+
+* `Quick Configuration Guide <https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide>`_
+
+Note that unless you are using Windows, where such a choice is not
+available, you should always use daemon mode of mod_wsgi. This is not the
+default mode, so you will need to ensure you follow the instructions to
+enable daemon mode.
+
+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://pypi.python.org/pypi/mod_wsgi
diff --git a/docs/index.rst b/docs/index.rst
index ac08d10..fef557c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,48 +1,54 @@
-.. image:: dead-parrot.jpg
- :width: 250 px
- :align: right
-
-.. toctree::
- :maxdepth: 1
- :hidden:
-
- release-notes/index
-
+========
mod_wsgi
========
-The mod_wsgi package implements a simple to use Apache module which can
-host any Python application which supports the Python WSGI_ interface.
-
-.. _WSGI: http://www.python.org/dev/peps/pep-0333/
-
-Status
-======
+.. note::
-No mod_wsgi is not dead, it was just resting.
+ Documentation for mod_wsgi is being transitioned here from the old
+ Google Code site. For more details and links to the old documentation
+ see :doc:`project-status`.
-Renewed development on mod_wsgi began early 2014, with a considerable
-amount of new development work and fixes being performed. This included the
-ability to install mod_wsgi using 'pip', along with an admin command
-called ``mod_wsgi-express`` which provides a really simple way of starting
-up Apache/mod_wsgi with an automatically generated configuration.
-
-Completely revised documentation will eventually be incorporated here.
-Right now though I am having too much fun working on all the new features.
-
-In the mean time keep referring to the older documentation at:
-
- http://www.modwsgi.org/
-
-The new ``mod_wsgi-express`` feature is also documented in the PyPi
-entry for mod_wsgi at:
-
- http://pypi.python.org/pypi/mod_wsgi
-
-Due to security issues in versions of mod_wsgi up to and including
-version 3.4, it is recommended that version 3.5 or later be used.
+The mod_wsgi package implements a simple to use Apache module which can
+host any Python web application which supports the Python WSGI_
+specification. The package can be installed in two different ways
+depending on your requirements.
+
+The first is as a traditional Apache module installed into an existing
+Apache installation. Following this path you will need to manually
+configure Apache to load mod_wsgi and pass through web requests to your
+WSGI application.
+
+The second way of installing mod_wsgi is to install it from PyPi_ using the
+Python ``pip`` command. This builds and installs mod_wsgi into your Python
+installation or virtual environment. The program ``mod_wsgi-express`` will
+then be available, allowing you to run up Apache with mod_wsgi from the
+command line with an automatically generated configuration. This
+approach does not require you to perform any configuration of Apache
+yourself.
+
+Both installation types are suitable for production deployments. The latter
+approach using ``mod_wsgi-express`` is the best solution if wishing to use
+Apache and mod_wsgi within a Docker container to host your WSGI application.
+It is also a better choice when using mod_wsgi during the development of
+your Python web application as you will be able to run it directly from
+your terminal.
+
+.. _WSGI: http://www.python.org/dev/peps/pep-3333/
+.. _PyPi: http://pypi.python.org/pypi/mod_wsgi
-If you need help in using mod_wsgi, then use the mod_wsgi mailing list to
-ask your questions:
+.. toctree::
+ :maxdepth: 1
+ :hidden:
- http://groups.google.com/group/modwsgi
+ project-status
+ security-issues
+ getting-started
+ requirements
+ installation
+ configuration
+ troubleshooting
+ finding-help
+ reporting-bugs
+ contributing
+ source-code
+ release-notes
diff --git a/docs/installation.rst b/docs/installation.rst
new file mode 100644
index 0000000..95830e3
--- /dev/null
+++ b/docs/installation.rst
@@ -0,0 +1,32 @@
+============
+Installation
+============
+
+.. warning ::
+
+ Documentation linked here is actually located on the old Google Code
+ site and has not yet been transitioned to this site. Some documentation
+ on the old site may be out of date, especially anything related to
+ running mod_wsgi on Windows. For more details as to why and the links to
+ all the old documentation see :doc:`project-status`.
+
+The mod_wsgi package can be installed form 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 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
+mod_wsgi from source code.
+
+For instructions on how to compile mod_wsgi from source code for UNIX like
+operating systems such as Linux and MacOS X see:
+
+* `Installation Instructions <https://code.google.com/p/modwsgi/wiki/InstallationInstructions>`_
+
+If you are on Windows, you should instead use:
+
+* `Installation on Windows <https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst>`_
diff --git a/docs/project-status.rst b/docs/project-status.rst
new file mode 100644
index 0000000..6bd8dd5
--- /dev/null
+++ b/docs/project-status.rst
@@ -0,0 +1,41 @@
+==============
+Project Status
+==============
+
+No mod_wsgi is not dead, it was just resting.
+
+Development work on mod_wsgi did effectively stop there for a few years
+due to developer burnout and the fact that the project has a bus factor
+of one. Renewed development did however restart early 2014, with a
+considerable amount of new development work and fixes being performed
+since then.
+
+A lot of the changes being made were with the aim of making it a lot easier
+to deploy Apache with mod_wsgi in Docker based environments. Changes
+included the ability to install mod_wsgi using ``pip``, along with an
+admin command called ``mod_wsgi-express`` which provides a really simple
+way of starting up Apache and mod_wsgi from the command line with an
+automatically generated configuration.
+
+Completely revised documentation will eventually be incorporated here. To
+date though it has been seen as being a bit pointless spending huge amounts
+of time documenting all the new features given that Linux distributions
+have historically tended to supply quite old versions of mod_wsgi anyway.
+Most users tend to outright refuse to build mod_wsgi from source code
+themselves and so are stuck with the much older versions their Linux
+distribution provides.
+
+In the mean time keep referring to the older documentation located on
+the Google Code site at:
+
+ https://code.google.com/p/modwsgi/wiki/WhereToGetHelp
+
+The full documentation index on the Google Code site can be found at:
+
+ http://code.google.com/p/modwsgi/w/list
+
+Documentation for the new ``mod_wsgi-express`` feature will not be found
+on the Google Code site, but is documented in the PyPi entry for mod_wsgi
+at:
+
+ https://pypi.python.org/pypi/mod_wsgi
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
new file mode 100644
index 0000000..a41e0ff
--- /dev/null
+++ b/docs/release-notes.rst
@@ -0,0 +1,68 @@
+=============
+Release Notes
+=============
+
+.. toctree::
+ :maxdepth: 2
+
+ release-notes/version-4.4.14
+ release-notes/version-4.4.13
+ release-notes/version-4.4.12
+ release-notes/version-4.4.11
+ release-notes/version-4.4.10
+ release-notes/version-4.4.9
+ release-notes/version-4.4.8
+ release-notes/version-4.4.7
+ release-notes/version-4.4.6
+ release-notes/version-4.4.5
+ release-notes/version-4.4.4
+ release-notes/version-4.4.3
+ release-notes/version-4.4.2
+ release-notes/version-4.4.1
+ release-notes/version-4.4.0
+
+ release-notes/version-4.3.2
+ release-notes/version-4.3.1
+ release-notes/version-4.3.0
+
+ release-notes/version-4.2.8
+ release-notes/version-4.2.7
+ release-notes/version-4.2.6
+ release-notes/version-4.2.5
+ release-notes/version-4.2.4
+ release-notes/version-4.2.3
+ release-notes/version-4.2.2
+ release-notes/version-4.2.1
+ release-notes/version-4.2.0
+
+ release-notes/version-4.1.3
+ release-notes/version-4.1.2
+ release-notes/version-4.1.1
+ release-notes/version-4.1.0
+
+ release-notes/version-4.0
+
+ release-notes/version-3.5
+ release-notes/version-3.4
+ release-notes/version-3.3
+ release-notes/version-3.2
+ release-notes/version-3.1
+ release-notes/version-3.0
+
+ release-notes/version-2.8
+ release-notes/version-2.7
+ release-notes/version-2.6
+ release-notes/version-2.5
+ release-notes/version-2.4
+ release-notes/version-2.3
+ release-notes/version-2.2
+ release-notes/version-2.1
+ release-notes/version-2.0
+
+ release-notes/version-1.6
+ release-notes/version-1.5
+ release-notes/version-1.4
+ release-notes/version-1.3
+ release-notes/version-1.2
+ release-notes/version-1.1
+ release-notes/version-1.0
diff --git a/docs/release-notes/index.rst b/docs/release-notes/index.rst
deleted file mode 100644
index 6164659..0000000
--- a/docs/release-notes/index.rst
+++ /dev/null
@@ -1,67 +0,0 @@
-=============
-Release Notes
-=============
-
-.. toctree::
- :maxdepth: 2
-
- version-4.4.13.rst
- version-4.4.12.rst
- version-4.4.11.rst
- version-4.4.10.rst
- version-4.4.9.rst
- version-4.4.8.rst
- version-4.4.7.rst
- version-4.4.6.rst
- version-4.4.5.rst
- version-4.4.4.rst
- version-4.4.3.rst
- version-4.4.2.rst
- version-4.4.1.rst
- version-4.4.0.rst
-
- version-4.3.2.rst
- version-4.3.1.rst
- version-4.3.0.rst
-
- version-4.2.8.rst
- version-4.2.7.rst
- version-4.2.6.rst
- version-4.2.5.rst
- version-4.2.4.rst
- version-4.2.3.rst
- version-4.2.2.rst
- version-4.2.1.rst
- version-4.2.0.rst
-
- version-4.1.3.rst
- version-4.1.2.rst
- version-4.1.1.rst
- version-4.1.0.rst
-
- version-4.0.rst
-
- version-3.5.rst
- version-3.4.rst
- version-3.3.rst
- version-3.2.rst
- version-3.1.rst
- version-3.0.rst
-
- version-2.8.rst
- version-2.7.rst
- version-2.6.rst
- version-2.5.rst
- version-2.4.rst
- version-2.3.rst
- version-2.2.rst
- version-2.1.rst
- version-2.0.rst
-
- version-1.6.rst
- version-1.5.rst
- version-1.4.rst
- version-1.3.rst
- version-1.2.rst
- version-1.1.rst
- version-1.0.rst
diff --git a/docs/release-notes/version-4.4.14.rst b/docs/release-notes/version-4.4.14.rst
new file mode 100644
index 0000000..9b51eed
--- /dev/null
+++ b/docs/release-notes/version-4.4.14.rst
@@ -0,0 +1,49 @@
+==============
+Version 4.4.14
+==============
+
+Version 4.4.14 of mod_wsgi can be obtained from:
+
+ https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.4.14
+
+For details on the availability of Windows binaries see:
+
+ https://github.com/GrahamDumpleton/mod_wsgi/tree/master/win32
+
+Bugs Fixed
+----------
+
+1. The ``--compress-responses`` option of ``mod_wsgi-express`` was
+failing when Apache 2.4 was used. This was because ``mod_filter`` module
+is required when using Apache 2.4 and it wasn't being loaded.
+
+2. On Python 3, the IO object wrapped by ``sys.stdout`` and ``sys.stderr``,
+according to the Python documentation, must provide a ``fileno()`` method
+even though no file descriptor exists corresponding to the Apache error
+logs. The method should raise ``IOError`` if called to indicate not file
+descriptor can be returned.
+
+Previously, an attempt to use ``fileno()`` on ``sys.stdout`` and ``sys.stderr``
+would raise an ``AttributeError`` instead due to there being no ``fileno()``
+method.
+
+3. Use compiler include flags from running of ``apr-config`` and
+``apu-config`` when doing ``pip`` install of ``mod_wsgi-express``. This is
+necessary as on MacOS X 10.11 El Capitan the include flags for APR returned
+by ``apxs`` refer to the wrong location causing installation to fail.
+
+New Features
+------------
+
+1. When proxying a URL path or a virtual host, now setting request
+header for ``X-Forwarded-Port`` so back end knows correct port that
+front end used.
+
+2. When proxying a URL path, if the request came in over a secure HTTP
+connection, now setting request header for ``X-Forwarded-Scheme`` so back
+end knows that front end handled the request over a secure connection.
+The value of the header will be ``https``.
+
+3. When using ``mod_wsgi-express``, it is now possible to supply the
+``--with-cgi`` option, with any files in the document root directory with
+a '.cgi' extension then being processed as traditional CGI scripts.
diff --git a/docs/reporting-bugs.rst b/docs/reporting-bugs.rst
new file mode 100644
index 0000000..e760f81
--- /dev/null
+++ b/docs/reporting-bugs.rst
@@ -0,0 +1,15 @@
+==============
+Reporting Bugs
+==============
+
+If you believe you have uncovered a bug in mod_wsgi code then lodge a bug
+report on the mod_wsgi issue tracker. The issue tracker is located on
+GitHub at:
+
+* https://github.com/GrahamDumpleton/mod_wsgi/issues
+
+Before creating a ticket on the issue tracker, please do try and ensure you
+attempt to resolve issues using the mod_wsgi mailing list first as
+explained in :doc:`finding-help`. The majority of issues lodged via the
+issue tracker are not actually bugs in mod_wsgi but due to external factors
+or simply a failure to read the documentation.
diff --git a/docs/requirements.rst b/docs/requirements.rst
new file mode 100644
index 0000000..780b025
--- /dev/null
+++ b/docs/requirements.rst
@@ -0,0 +1,32 @@
+============
+Requirements
+============
+
+The mod_wsgi package can be compiled for and used with most recent patch
+revisions of Apache 2.0, 2.2 or 2.4 on UNIX like systems, such as Linux and
+MacOS X, as well as Windows.
+
+It is highly recommended that you use Apache 2.4. Older versions of Apache
+have architectural design problems and sub optimal configuration defaults,
+that can result in excessive memory usage in certain circumstances. More
+recent mod_wsgi versions attempt to protect against these problems in
+Apache 2.0 and 2.2, however it is still better to use Apache 2.4.
+
+Any of the single threaded 'prefork' or multithreaded 'worker' and 'event'
+Apache MPMs can be used when running on UNIX like systems.
+
+Both Python 2 and 3 are supported. The minimum recommended versions of each
+being Python 2.6 and 3.3 respectively. The Python installation must have
+been installed in a way that shared libraries for Python are provided such
+that embedding of Python in another application is possible.
+
+The mod_wsgi package should be able to host any Python web application
+which complies with the WSGI_ specification (PEP 3333). The
+implementation is very strict with its interpretation of the WSGI
+specification. Other WSGI servers available aren't as strict and allow
+Python web applications to run which do not comply with the WSGI
+specification. If your Python web application doesn't comply properly with
+the WSGI specification, then it may fail to run or may run sub optimally
+when using mod_wsgi.
+
+.. _WSGI: http://www.python.org/dev/peps/pep-3333/
diff --git a/docs/security-issues.rst b/docs/security-issues.rst
new file mode 100644
index 0000000..423e6ed
--- /dev/null
+++ b/docs/security-issues.rst
@@ -0,0 +1,16 @@
+===============
+Security Issues
+===============
+
+Due to security issues in versions of mod_wsgi up to and including version
+3.4, ensure that you are using version 3.5 or later.
+
+Release notes for versions containing security related fixes are:
+
+* :doc:`release-notes/version-3.5`
+
+Because many Linux distributions still ship ancient out of date versions,
+which are not supported, it is highly recommended you avoid using packaged
+binary versions provided by your Linux distribution. Instead install
+mod_wsgi from source code, ensuring you keep up to date with the most
+recent version.
diff --git a/docs/source-code.rst b/docs/source-code.rst
new file mode 100644
index 0000000..fdcd646
--- /dev/null
+++ b/docs/source-code.rst
@@ -0,0 +1,16 @@
+===========
+Source Code
+===========
+
+The source code repository for mod_wsgi is located on GitHub at:
+
+* https://github.com/GrahamDumpleton/mod_wsgi
+
+Downloadable tar balls of the source code can be found at:
+
+* https://github.com/GrahamDumpleton/mod_wsgi/releases
+
+A version of the source code which can be installed using ``pip`` can
+also be found on PyPi at:
+
+* https://pypi.python.org/pypi/mod_wsgi
diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst
new file mode 100644
index 0000000..b074639
--- /dev/null
+++ b/docs/troubleshooting.rst
@@ -0,0 +1,30 @@
+===============
+Troubleshooting
+===============
+
+.. warning ::
+
+ Documentation linked here is actually located on the old Google Code
+ site and has not yet been transitioned to this site. Some documentation
+ on the old site may be out of date, especially anything related to
+ running mod_wsgi on Windows. For more details as to why and the links to
+ all the old documentation see :doc:`project-status`.
+
+If you are having problems getting mod_wsgi to start up or do what you want
+it to do, first off ensure that you read the following documents:
+
+* `Installation Issues <https://code.google.com/p/modwsgi/wiki/InstallationIssues>`_
+* `Configuration Issues <https://code.google.com/p/modwsgi/wiki/ConfigurationIssues>`_
+* `Application Issues <https://code.google.com/p/modwsgi/wiki/ApplicationIssues>`_
+
+If none of the common issues match up with the problem you are seeing and
+are after other ideas, or you have the need to perform more low level
+debugging, check out the following document:
+
+* `Developer Guidelines <https://code.google.com/p/modwsgi/wiki/DeveloperGuidelines>`_
+
+You can also do some basic checking of your installation and configuration
+to validate that how it is setup is how you expect it to be. See the
+following document:
+
+* `Checking Your Installation <https://code.google.com/p/modwsgi/wiki/CheckingYourInstallation>`_
diff --git a/setup.py b/setup.py
index 569f3c8..76d23cb 100644
--- a/setup.py
+++ b/setup.py
@@ -187,6 +187,12 @@ if WITH_TARBALL_PACKAGE:
sub_value = expand_vars(value)
return sub_value.replace('/mod_wsgi-packages/', SCRIPT_DIR+'/')
+ def get_apr_includes(query):
+ return ''
+
+ def get_apu_includes(query):
+ return ''
+
CONFIG['PREFIX'] = get_apxs_config('prefix')
CONFIG['TARGET'] = get_apxs_config('target')
CONFIG['SYSCONFDIR'] = get_apxs_config('sysconfdir')
@@ -205,6 +211,28 @@ else:
out = out.decode('UTF-8')
return out.strip()
+ def get_apr_includes():
+ if not APR_CONFIG:
+ return ''
+
+ p = subprocess.Popen([APR_CONFIG, '--includes'],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = p.communicate()
+ if isinstance(out, bytes):
+ out = out.decode('UTF-8')
+ return out.strip()
+
+ def get_apu_includes():
+ if not APU_CONFIG:
+ return ''
+
+ p = subprocess.Popen([APU_CONFIG, '--includes'],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = p.communicate()
+ if isinstance(out, bytes):
+ out = out.decode('UTF-8')
+ return out.strip()
+
INCLUDEDIR = get_apxs_config('INCLUDEDIR')
CPPFLAGS = get_apxs_config('CPPFLAGS').split()
CFLAGS = get_apxs_config('CFLAGS').split()
@@ -213,6 +241,12 @@ EXTRA_INCLUDES = get_apxs_config('EXTRA_INCLUDES').split()
EXTRA_CPPFLAGS = get_apxs_config('EXTRA_CPPFLAGS').split()
EXTRA_CFLAGS = get_apxs_config('EXTRA_CFLAGS').split()
+APR_CONFIG = get_apxs_config('APR_CONFIG')
+APU_CONFIG = get_apxs_config('APU_CONFIG')
+
+APR_INCLUDES = get_apr_includes().split()
+APU_INCLUDES = get_apu_includes().split()
+
# Write out apxs_config.py which caches various configuration related to
# Apache. For the case of using our own Apache build, this needs to
# calculate values dynamically based on where binaries were installed.
@@ -312,7 +346,7 @@ if os.path.exists(os.path.join(PYTHON_CFGDIR,
INCLUDE_DIRS = [INCLUDEDIR]
EXTRA_COMPILE_FLAGS = (EXTRA_INCLUDES + CPPFLAGS + EXTRA_CPPFLAGS +
- CFLAGS + EXTRA_CFLAGS)
+ CFLAGS + EXTRA_CFLAGS + APR_INCLUDES + APU_INCLUDES)
EXTRA_LINK_ARGS = PYTHON_LDFLAGS + PYTHON_LDLIBS
# Force adding of LD_RUN_PATH for platforms that may need it.
diff --git a/src/server/__init__.py b/src/server/__init__.py
index d3ef0a3..b3c611c 100644
--- a/src/server/__init__.py
+++ b/src/server/__init__.py
@@ -173,6 +173,9 @@ LoadModule env_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_env.so'
<IfModule !headers_module>
LoadModule headers_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_headers.so'
</IfModule>
+<IfModule !filter_module>
+LoadModule filter_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_filter.so'
+</IfModule>
<IfDefine MOD_WSGI_DIRECTORY_LISTING>
<IfModule !autoindex_module>
@@ -230,6 +233,18 @@ LoadModule status_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_status.so'
</IfModule>
</IfDefine>
+<IfDefine MOD_WSGI_CGID_SCRIPT>
+<IfModule !cgid_module>
+LoadModule cgid_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_cgid.so'
+</IfModule>
+</IfDefine>
+
+<IfDefine MOD_WSGI_CGI_SCRIPT>
+<IfModule !cgi_module>
+LoadModule cgi_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_cgi.so'
+</IfModule>
+</IfDefine>
+
<IfVersion < 2.4>
DefaultType text/plain
</IfVersion>
@@ -599,6 +614,12 @@ DocumentRoot '%(document_root)s'
<IfDefine MOD_WSGI_DIRECTORY_LISTING>
Options +Indexes
</IfDefine>
+<IfDefine MOD_WSGI_CGI_SCRIPT>
+ Options +ExecCGI
+</IfDefine>
+<IfDefine MOD_WSGI_CGID_SCRIPT>
+ Options +ExecCGI
+</IfDefine>
<IfDefine !MOD_WSGI_STATIC_ONLY>
RewriteEngine On
RewriteCond %%{REQUEST_FILENAME} !-f
@@ -668,11 +689,27 @@ WSGIImportScript '%(server_root)s/handler.wsgi' \\
APACHE_PROXY_PASS_MOUNT_POINT_CONFIG = """
ProxyPass '%(mount_point)s' '%(url)s'
ProxyPassReverse '%(mount_point)s' '%(url)s'
+<Location '%(mount_point)s'>
+RewriteEngine On
+RewriteRule .* - [E=SERVER_PORT:%%{SERVER_PORT},NE]
+RequestHeader set X-Forwarded-Port %%{SERVER_PORT}e
+RewriteCond %%{HTTPS} on
+RewriteRule .* - [E=URL_SCHEME:https,NE]
+RequestHeader set X-Forwarded-Scheme %%{URL_SCHEME}e env=URL_SCHEME
+</Location>
"""
APACHE_PROXY_PASS_MOUNT_POINT_SLASH_CONFIG = """
ProxyPass '%(mount_point)s/' '%(url)s/'
ProxyPassReverse '%(mount_point)s/' '%(url)s/'
+<Location '%(mount_point)s/'>
+RewriteEngine On
+RewriteRule .* - [E=SERVER_PORT:%%{SERVER_PORT},NE]
+RequestHeader set X-Forwarded-Port %%{SERVER_PORT}e
+RewriteCond %%{HTTPS} on
+RewriteRule .* - [E=URL_SCHEME:https,NE]
+RequestHeader set X-Forwarded-Scheme %%{URL_SCHEME}e env=URL_SCHEME
+</Location>
<LocationMatch '^%(mount_point)s$'>
RewriteEngine On
RewriteRule - http://%%{HTTP_HOST}%%{REQUEST_URI}/ [R=302,L]
@@ -684,6 +721,11 @@ APACHE_PROXY_PASS_HOST_CONFIG = """
ServerName %(host)s
ProxyPass / '%(url)s'
ProxyPassReverse / '%(url)s'
+RequestHeader set X-Forwarded-Port %(port)s
+RewriteEngine On
+RewriteCond %%{HTTPS} on
+RewriteRule .* - [E=URL_SCHEME:https,NE]
+RequestHeader set X-Forwarded-Scheme %%{URL_SCHEME}e env=URL_SCHEME
</VirtualHost>
"""
@@ -744,13 +786,13 @@ APACHE_PASSENV_CONFIG = """
PassEnv '%(name)s'
"""
-APACHE_HANDLERS_CONFIG = """
+APACHE_HANDLER_SCRIPT_CONFIG = """
WSGIHandlerScript wsgi-resource '%(server_root)s/resource.wsgi' \\
process-group='%(host)s:%(port)s' application-group=%%{GLOBAL}
"""
-APACHE_EXTENSION_CONFIG = """
-AddHandler wsgi-resource %(extension)s
+APACHE_HANDLER_CONFIG = """
+AddHandler %(handler)s %(extension)s
"""
APACHE_INCLUDE_CONFIG = """
@@ -871,11 +913,15 @@ def generate_apache_config(options):
print(APACHE_PASSENV_CONFIG % dict(name=name), file=fp)
if options['handler_scripts']:
- print(APACHE_HANDLERS_CONFIG % options, file=fp)
+ print(APACHE_HANDLER_SCRIPT_CONFIG % options, file=fp)
for extension, script in options['handler_scripts']:
- print(APACHE_EXTENSION_CONFIG % dict(extension=extension),
- file=fp)
+ print(APACHE_HANDLER_CONFIG % dict(handler='wsgi-resource',
+ extension=extension), file=fp)
+
+ if options['with_cgi']:
+ print(APACHE_HANDLER_CONFIG % dict(handler='cgi-script',
+ extension='.cgi'), file=fp)
if options['service_scripts']:
service_log_files = {}
@@ -1586,8 +1632,11 @@ MOD_WSGI_HTTPS_PORT="%(https_port)s"
export MOD_WSGI_HTTP_PORT
export MOD_WSGI_HTTPS_PORT
-MOD_WSGI_USER="${MOD_WSGI_USER:-%(user)s}"
-MOD_WSGI_GROUP="${MOD_WSGI_GROUP:-%(group)s}"
+WSGI_RUN_USER="${WSGI_RUN_USER:-%(user)s}"
+WSGI_RUN_GROUP="${WSGI_RUN_GROUP:-%(group)s}"
+
+MOD_WSGI_USER="${MOD_WSGI_USER:-${WSGI_RUN_USER}}"
+MOD_WSGI_GROUP="${MOD_WSGI_GROUP:-${WSGI_RUN_GROUP}}"
export MOD_WSGI_USER
export MOD_WSGI_GROUP
@@ -1764,7 +1813,7 @@ option_list = (
'parent domain name to the \'www.\' server name will created.'),
optparse.make_option('--server-alias', action='append',
dest='server_aliases', metavar='HOSTNAME', help='A secondary '
- 'host name for the web server. May include wilcard patterns.'),
+ 'host name for the web server. May include wildcard patterns.'),
optparse.make_option('--allow-localhost', action='store_true',
default=False, help='Flag indicating whether access via '
'localhost should still be allowed when a server name has been '
@@ -2229,7 +2278,13 @@ option_list = (
'that should be used from New Relic agent configuration file.'),
optparse.make_option('--with-php5', action='store_true', default=False,
- help='Flag indicating whether PHP 5 support should be enabled.'),
+ help='Flag indicating whether PHP 5 support should be enabled. '
+ 'PHP code files must use the \'.php\' extension.'),
+
+ optparse.make_option('--with-cgi', action='store_true', default=False,
+ help='Flag indicating whether CGI script support should be '
+ 'enabled. CGI scripts must use the \'.cgi\' extension and be '
+ 'executable'),
optparse.make_option('--service-script', action='append', nargs=2,
dest='service_scripts', metavar='SERVICE SCRIPT-PATH',
@@ -2892,6 +2947,13 @@ def _cmd_setup_server(command, args, options):
if options['trusted_proxies']:
options['httpd_arguments_list'].append('-DMOD_WSGI_WITH_TRUSTED_PROXIES')
+ if options['with_cgi']:
+ if os.path.exists(os.path.join(options['modules_directory'],
+ 'mod_cgid.so')):
+ options['httpd_arguments_list'].append('-DMOD_WSGI_CGID_SCRIPT')
+ else:
+ options['httpd_arguments_list'].append('-DMOD_WSGI_CGI_SCRIPT')
+
options['httpd_arguments_list'].extend(
_mpm_module_defines(options['modules_directory'],
options['server_mpm_variables']))
diff --git a/src/server/wsgi_logger.c b/src/server/wsgi_logger.c
index 28f0728..aa8d727 100644
--- a/src/server/wsgi_logger.c
+++ b/src/server/wsgi_logger.c
@@ -449,6 +449,14 @@ static PyObject *Log_writable(LogObject *self, PyObject *args)
Py_INCREF(Py_True);
return Py_True;
}
+
+static PyObject *Log_fileno(LogObject *self, PyObject *args)
+{
+ PyErr_SetString(PyExc_IOError, "Apache/mod_wsgi log object is not "
+ "associated with a file descriptor.");
+
+ return NULL;
+}
#endif
static PyObject *Log_closed(LogObject *self, void *closure)
@@ -504,6 +512,7 @@ static PyMethodDef Log_methods[] = {
{ "readable", (PyCFunction)Log_readable, METH_NOARGS, 0 },
{ "seekable", (PyCFunction)Log_seekable, METH_NOARGS, 0 },
{ "writable", (PyCFunction)Log_writable, METH_NOARGS, 0 },
+ { "fileno", (PyCFunction)Log_fileno, METH_NOARGS, 0 },
#endif
{ NULL, NULL}
};
diff --git a/src/server/wsgi_memory.c b/src/server/wsgi_memory.c
index 5ff4aa7..89e3ceb 100644
--- a/src/server/wsgi_memory.c
+++ b/src/server/wsgi_memory.c
@@ -7,7 +7,9 @@
#if defined(_WIN32)
#include <windows.h>
+#define PSAPI_VERSION 1
#include <psapi.h>
+#pragma comment(lib, "psapi.lib")
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
diff --git a/src/server/wsgi_version.h b/src/server/wsgi_version.h
index a8c3937..59a09e8 100644
--- a/src/server/wsgi_version.h
+++ b/src/server/wsgi_version.h
@@ -25,8 +25,8 @@
#define MOD_WSGI_MAJORVERSION_NUMBER 4
#define MOD_WSGI_MINORVERSION_NUMBER 4
-#define MOD_WSGI_MICROVERSION_NUMBER 13
-#define MOD_WSGI_VERSION_STRING "4.4.13"
+#define MOD_WSGI_MICROVERSION_NUMBER 14
+#define MOD_WSGI_VERSION_STRING "4.4.14"
/* ------------------------------------------------------------------------- */