graham.dumpleton at gmail.com
Mon Aug 20 20:25:56 EDT 2007
On 21/08/07, Ken Manheimer <ken.manheimer at gmail.com> wrote: > hmm! > > the lack of any input handling in my routine was really dumb. but in > any case, this may point to something that gets tramline working. > > the tramline input filter is intended to only intervene for main POST > requests that consist of multipart/form-data. for other requests it > would do a filter.pass_on() and return: > > def inputfilter(filter): > # we're done if we're in a subrequest > if filter.req.main is not None: > filter.pass_on() > return I'd be worried about the check of: filter.req.main >From memory this is going to always pass on doing the request if it is a sub request. A sub request might occur if using mod_rewrite or Action directives, plus possibly other things. Put some debug in which dumps out whether req.main is set and then dump out what main request is, ie., req.main.uri etc. This may give clues as to what is going on. Graham > # we only handle POST requests > if filter.req.method != 'POST': > filter.pass_on() > return > > # we only handle multipart/form-data > enctype = filter.req.headers_in.get('Content-Type') > if enctype[:19] != 'multipart/form-data': > filter.pass_on() > return > > [do some real stuff, otherwise] > > i the assume that the filter.pass_on() was supposed to do the right > thing, but i tried that in my stub filters (after confirming that your > filter.read()/filter.write() handling did in fact work, graham), and > it didn't. so i replaced the above with: > > def inputfilter(filter): > > enctype = filter.req.headers_in.get('Content-Type') > if ((filter.req.main is not None) # we are in a subrequest > or (filter.req.method != 'POST')# this is not a POST > request > or (enctype[:19] != 'multipart/form-data')): # not > multipart/form-data: > s = filter.read() > while s: > filter.write(s) > s = filter.read() > if s is None: > filter.close() > return > > [do some real stuff, otherwise] > > and i don't get the hang. i have to test the intended tramline > operation, and don't understand enough yet about it or mod_python > filters to be confident that i have something right, but at least i > have something to work with now! > > can you say why the filter.pass_on() is not sufficient, by the way? > even with and added filter.flush() the infinite repeat still happens.