SSL-data access from verious handlers. was: Re:[mod_python] problem w/ authen handler

Graham Dumpleton grahamd at dscpl.com.au
Mon May 23 20:08:13 EDT 2005


Graham Dumpleton wrote ..
> The macros supposedly try and make it type safe, so haven't quite worked
> out how you are meant to use them yet. In part it looks like compile time
> binding is required, which would be an issue with Python. What you might
> be able to do though is write a little C based Python module which did
> the lookup and calling of "ssl_var_lookup()" for you by going direct to
> the Apache runtime library calls. May work. :-)

See if you can get the attached code (2 files) to work for you. You will need to
modify the setup.py to point to appropriate include and library directories and
correct name for APR libraries on your platform.

The code all compiles, but since I don't have mod_ssl setup I get back nothing.
The first argument to each method must be the request object. It will crash if
it isn't as haven't been able to have check in code that it is in fact a request
object because undefined as am not linking against mod_python .so.

The handler I was using was as follows, but you should be able to adapt it.

import _mp_mod_ssl
import vampire

class _Object:

  def is_https(self,req):
    return _mp_mod_ssl.is_https(req)

  def var_lookup(self,req,name):
    return _mp_mod_ssl.var_lookup(req,name)

handler = vampire.Publisher(_Object())

Let me know how you go. Is an interesting problem which is why I decided
to play with it when I should have been doing real work. :-)

Graham
-------------- next part --------------
A non-text attachment was scrubbed...
Name: _mp_mod_ssl.c
Type: application/octet-stream
Size: 2075 bytes
Desc: not available
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050523/9fa0275b/_mp_mod_ssl.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup.py
Type: application/octet-stream
Size: 606 bytes
Desc: not available
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050523/9fa0275b/setup.obj


More information about the Mod_python mailing list