quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terrel Shumway <tshum...@jdiworks.net>
Subject non-200 returns, sendfile, Auth Only
Date Wed, 11 Aug 2004 03:28:10 GMT

non-200 returns
---------------
Here is my handler

def handler(req):
    
    location = look_this_up_in_the_database_based_on(req.path)
    log_the_hit(req)

    req.status = req.proto_num>=1001 and 303 or 302
    req.headers_out["location"]=location
    req.content_type="text/html"
    req.write(MY_COOL_TEMPLATE % locals())

    return req.status

The problem is that something -- I don't know if it's apache
or mod_python -- is adding the standard ErrorDocument after
my cool template.  How do I stop that?


sendfile
---------------
simliarly 

def handler(req):
    
    log_the_hit(req)

    req.status = 200
    req.content_type="image/gif"
    req.sendfile("/path/to/my/single/pixel/dot.gif")

    return req.status

Apache sends the gif fine, but adds an ErrorDocument 
(with a 200 code) after the image.



Auth Only
---------------

I want mod_python to handle ONLY authen/authz, so I said

<Location />
  PythonAuthenHandler authd
  AuthType Basic
  AuthName "members only"
  require valid-user
</Location>

It almost works. I can get my module to do the auth, but the
regular handlers don't work: 
  GET / HTTP/1.1

just complains that it can't serve a directory

  GET /index.html HTTP/1.1

returns the html file, but with content-type: text/plain


How do I get mod_python to do just the auth, and let Apache's
normal handlers take care of the rest?

(BTW: I really want to do a form/cookie auth eventually, but
Basic will do for now.)


Mime
View raw message