[mod_python] [help]please give an input filter example ?

camge is83070 at cis.nctu.edu.tw
Thu Sep 25 16:21:25 EST 2003


Hi Grisha,

    I have compiled the latest CVS version, and it works.
But I found another problem here.

>  postData = filter.read()
>  modify(postData)
>  filter.write(postData)

If postData's length is not changed, everything is fine. 
Otherwise IE will hand there.
I guess this is caused by HTTP header "Content-Length" .
Because we changed the request body, but didn't update the header.

regards,
camge

----- Original Message ----- 
From: "Gregory (Grisha) Trubetskoy" <grisha at modpython.org>
To: "camge" <is83070 at cis.nctu.edu.tw>
Cc: "David Fraser" <davidf at sjsoft.com>; <mod_python at modpython.org>
Sent: Tuesday, September 23, 2003 10:35 PM
Subject: Re: [mod_python] [help]please give an input filter example ?


> 
> I've looked at the input filter code, and I think that what's in 3.0.3 is
> broken. If you get the latest CVS version, your input filter code would
> look somethng like:
> 
> def inputfilter(filter):
> 
> s = filter.read()
> 
> if s:
> ## do something with s here
> 
> filter.write(s)
> else:
> filter.close()
> 
> return apache.OK
> 
> Note that the filter will only see the body of the POST request, it will
> not see the headers, in fact it won't even be called for GET requests.
> 
> Grisha
> 



More information about the Mod_python mailing list