Johannes Erdfelt
johannes at erdfelt.com
Fri Aug 16 16:09:07 EST 2002
On Fri, Aug 16, 2002, Hunter Matthews <thm at duke.edu> wrote: > > I've got a configuration requirement for mod_python that I'm not sure > how to fill. I think I'm about 90% of the way there, but... > > Basically I'm writing a server for a client I don't control. The client > can put out 2 kinds of requests. > > POST requests that are simple XMLRPC calls. > One of the idiosyncrases of the client is that the URL that is requested > is ALWAYS just /XMLRPC - there is no script name or whatever. > I can handler these fine with the following config snippet: > > <Location /XMLRPC> > SetHandler python-program > PythonHandler current_apache > </Location> > > The GET requests have me stymied - to transfer big files, the client > uses GET requests. I'd like to have apache itself do the actual shifting > of bits, and just let my server application handle the authentication > that is required. > > What I had as a first attempt was: > <Location /XMLRPC/$RHN> > SetHandler python-program > PythonAuthzHandler current_apache > </Location> > > But this is clearly wrong (and it doesn't work, either :) > Because I have the SetHandler, mod_python tries to handle ALL the > different parts of the request, when I only want it to handle the Authz > stage: if that PythonAuthzHandler returns apache.OK, then I would like > apache to pick up the URL and just fling it back at the client - the > python part is done. > > If any other information is needed, please let me know. Drop the SetHandler then. All you need is the PythonAuthzHandler portion and it'll do the right thing. I do something like this: <FilesMatch "\.(m3u|mp3)$"> PythonPath "sys.path+['/web/americandnb.com/python']" PythonAccessHandler m3u </FilesMatch> And the m3u module does referer checking so people don't link directly to the mp3's. If the Referer fails, we redirect to the main HTML for that file (specific to our setup). JE
|