Thread: mod_python

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    71
    Rep Power
    11

    mod_python


    Hello.
    Your help is very appreciated
    I am building a web app that works as follows:
    1.It will get requests from client(mod-python)
    2.Generates a request to another web server
    ( by re-writing the url and attaching the client's headers)
    3. Send the response to the client(mod-python)

    My problem is with headers:
    a. Trying to read the headers from the client generates error,
    I'm using :
    def handler(req):
    x= req.headers_in()
    The error:
    TypeError: 'mp_table' object is not callable
    I didn't find any other way to do it in mod_python
    b. I there a way to internally redirect the request from the client,
    so that automatically the headers will be included in the new request?
    (so that all that is needed to be changed is just the url)
    [ I tried using req.internal_redirect("www.google.com"), but
    it throws an error:
    File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 85, in __getattr__
    raise AttributeError, attr

    AttributeError: internal_redirect

    c. Because internal_redirect failes, I am trying to use alternatives such
    as as using the urllib.

    Thanks
    Roy
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    71
    Rep Power
    11
    1. req.headers_in is a field not method, so:
    req.write(str(req.headers_in))
    2. An internal redirect can only be to a path on your server, not an outside
    one


IMN logo majestic logo threadwatch logo seochat tools logo