diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-30 20:53:32 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-03 15:29:05 -0500 |
commit | c2b0c801400fcb59be8687f9faf061aa85bcffd2 (patch) | |
tree | 434634987f8888ad5b0b66db78627f9e37206c84 /ipaserver/__init__.py | |
parent | 91ca06f079f4de1ca5e6c60cfdf7aae75f60821b (diff) | |
download | freeipa-c2b0c801400fcb59be8687f9faf061aa85bcffd2.tar.gz freeipa-c2b0c801400fcb59be8687f9faf061aa85bcffd2.tar.xz freeipa-c2b0c801400fcb59be8687f9faf061aa85bcffd2.zip |
Started work on a much simplified mod_python server
Diffstat (limited to 'ipaserver/__init__.py')
-rw-r--r-- | ipaserver/__init__.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ipaserver/__init__.py b/ipaserver/__init__.py index b0be96bd2..35f96c7f6 100644 --- a/ipaserver/__init__.py +++ b/ipaserver/__init__.py @@ -20,3 +20,31 @@ """ Package containing server backend. """ + +from xmlrpclib import dumps, Fault +from ipalib import api + +try: + from mod_python import apache + api.bootstrap(context='server', log=None, debug=True) + api.finalize() +except ImportError: + pass + + +def xmlrpc(req): + if req.method != 'POST': + req.allow_methods(['POST'], 1) + return apache.HTTP_METHOD_NOT_ALLOWED + + if apache.mpm_query(apache.AP_MPMQ_IS_THREADED): + response = dumps( + Fault(3, 'Apache must use the forked model'), methodresponse=True + ) + else: + response = api.Backend.xmlserver.marshaled_dispatch(req.read(), None) + + req.content_type = 'text/xml' + req.set_content_length(len(response)) + req.write(response) + return apache.OK |