mod_python.c

Checkout Tools
  • last updated 6 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
(MODPYTHON-195) Fix potential Win32 resource leaks in parent Apache process

when process restarts occur.

  1. … 3 more files in changeset.
(MODPYTHON-193) Added new req.hlist.location attribute so that value to a

Location/LocationMatch directive can be determined. Also fixed crash when

req.hlist is accessed from inside a filter and do some restructuring of how

errors are logged and displayed back to browser.

  1. … 9 more files in changeset.
(MODPYTHON-196) Added log_error() methods to server and connection objects.

Also removed some unused variables which were causing compiler warnings.

  1. … 8 more files in changeset.
(MODPYTHON-194) Fixed potential memory leak when thread state objects weren't

cleared before they were being deleted.

  1. … 3 more files in changeset.
(MODPYTHON-109) Amend comment relating to disabling of Python cleanup on

shutdown.

Thread locks not being released when fatal error condition occurs. Remove

duplicate method listing.

  1. … 1 more file in changeset.
Borrowed references incorrectly having their reference counts decremented

in debugging code invoked when mod_python couldn't start up properly.

(MODPYTHON-165) Exported functions from mod_python module to be used in

other third party modules for Apache. The purpose of these functions is to

allow those other modules to access the mechanics of how mod_python creates

interpreters, thereby allowing other modules to also embed Python and for

there not to be a conflict with mod_python.

  1. … 3 more files in changeset.
When handler directives are used within Directory or DirectoryMatch

directives where wildcards or regular expressions are used, the handler

directory will now be correctly set to the shortest directory matched by

the directory pattern, whereas previously it was being left as the

pattern which meant that modules located with that directory weren't

able to be loaded.

  1. … 11 more files in changeset.
(MODPYTHON-63) Fixes to code previously set down for handling <Directory ~>

and <DirectoryMatch> as it wasn't decoding configuration correctly and in

case of <DirectoryMatch> could cause Apache to crash.

  1. … 2 more files in changeset.
(MODPYTHON-155) Improve memory efficiency related to req.add_handler()

and construction of handler list objects.

(MODPYTHON-181) Fix problems with req.add_handler() introduced when memory

leaks were eliminated related to handler list object.

  1. … 6 more files in changeset.
(MODPYTHON-181) Fixed memory leak when mod_python handlers are defined

for more than one phase at the same time.

  1. … 3 more files in changeset.
(MODPYTHON-155) Modifications to handler and filter lists so that

references can be maintained back to parent handler of a handler/filter

which was registered dynamically. This is necessary within the scheme of

how the new module importer works. Specifically, where a directory isn't

specified when adding a handler or registering a filter, the directory

associated with the parent up the chain has to be used instead. In the old

importer it was relying on fact that directory of parent had already been

added to the Python sys.path, although this didn't actually work reliably.

The new module importer doesn't add directories to sys.path and so the need

to properly work out directory associated with a parent so that it can be

used when required.

  1. … 9 more files in changeset.
Added support such that when using req.register_input_filter(),

req.register_output_filter() and req.add_handler() it is now possible to

supply directly a callable object to be used as well as the existing

string reference identifying the module/function to be called. (MODPYTHON-164)

  1. … 17 more files in changeset.
Old variable definition not removed and was hiding function parameter. If

variable definition attained a non null value, code could also crash. In

worst case, if neither handler or filter specified, result would have been

value of PythonInterpPerDirective setting. The latter shouldn't in practice

occur but cater for it anyway. (MODPYTHON-103)

Eliminated crash when dynamically registered filters used in conjunction with

PythonInterpPerDirective. (MODPYTHON-103)

  1. … 2 more files in changeset.
When in a sub request, when a request is the result of an internal

redirect, or when when returning from such a request, the req.main,

req.prev and req.next members now correctly return a reference to the

original Python request object wrapper first created for the specific

request_rec instance rather than creating a new distinct Python request

object. This means that any data added explicitly to a request object can

be passed between such requests. (MODPYTHON-152)

  1. … 8 more files in changeset.
Dictionary from module is a borrowd reference and thus reference count should

not be decremented. (MODPYTHON-158)

Error path in SSI code when interpreter could not be obtained was trying

to wrongly release the interpreter. (MODPYTHON-104)

PythonHandlerModule was not setting up registration of the

PythonFixupHandler or PythonAuthenHandler. For the latter this meant that

using Require directive with PythonHandlerModule would cause a 500 error

and complaint in error log about "No groups file". (MODPYTHON-166)

  1. … 3 more files in changeset.
Need to canonicalize directory path so as to normalize on POSIX style directory

naming conventions, else backslashes on Win32 propogate through. (MODPYTHON-126)

  1. … 2 more files in changeset.
When Python*Handler or Python*Filter directive is used inside of a Files

directive container, the handler/filter directory value will now correctly

resolve to the directory corresponding to any parent Directory directive or

the location of the .htaccess file the Files directive is contained in.

(MODPYTHON-126])

The patch also lays the ground work for being able to support Directory

directive with glob style wildcards or Directory/DirectoryMatch directive

with a regular expression. (MODPYTHON-63)

  1. … 9 more files in changeset.
Using PythonInterpPerDirective when setting content handler to

run dynamically with req.add_handler() would cause Apache to

crash. (MODPYTHON-160)

  1. … 5 more files in changeset.
Added the value of the "__file__" attribute from "mod_python" module to

the error log output when there are problems executing "apache.init()" to

construct callback object. (MODPYTHON-158)

Added additional debugging and logging output for where mod_python cannot

initialise itself properly due to Python or mod_python version mismatches

or missing Python module code files. (MODPYTHON-158)

  1. … 1 more file in changeset.
Wrong interpreter name used for fixup handler phase and earlier, when

PythonInterpPerDirectory was enabled and request was against a directory

but client didn't provide the trailing slash. (MODPYTHON-157)

  1. … 5 more files in changeset.
Fixed various constness and other pointer typing issues to eliminate warnings

generated by compiler.

  1. … 1 more file in changeset.
Cleanup handler was calling free() on memory which was allocated from Apache

memory pool. The code was on an error handling path which would never normally

be executed and so wasn't causing any problems.

A variable of type hl_entry was being used to copy pointer values of type

py_handler. Because of void* casting the code still worked fine, but the

mixing of pointer types could make someone looking at the code think

input/output filter lists held a data type different to what they actually

are.

The PythonImport directive makes use of the handler list data structure

even though it specifically is for a different purpose. The handler list

data structure needs to be changed a bit in order to support changes

required to address MODPYTHON-63 and MODPYTHON-126. These changes may

make it unusable in the way that the PythonImport directive was using it,

or at least it will not be a good match. The PythonImport directive has

therefore been modified to use a standard Apache table object thereby

allowing arbitrary changes to the handler list data structure to be made as

necessary.

Note that although the current Apache table implementation probably results

in module imports occuring in the order they appear in the Apache

configuration file, if how it is implemented is changed, this may no longer

be the case. This is not seen as an issue as the documentation for the

PythonImport directive does not give any guarantees about ordering of

imports within the context of a specific interpreter and it would be bad

practice for modules to rely on mod_python importing them in a specific

order. If there are ordering requirements, it should be dealt with internal

to the module being imported so that it is self contained.

  1. … 4 more files in changeset.