[mod_python] Mod-Python Help

David Beal david at neuraliq.com
Wed Sep 6 20:39:38 EDT 2006


Ethan,

> Thanks for your help.  It turns out the problem was the "return
> apache.OK".  I was getting that extra 0 at the end and could not
> figure
> out why.  Thanks for the prompt replies.  I appreciate all the help.
> 

The problem is probably not with return apache.OK, but maybe with the
client's XmlHttpRequest handler not understanding chunked encoding
markers.  The 0 is for HTTP chunked encoding.  Look for the header:

Transfer-Encoding: chunked

and the first line of the content will be a hexadecimal number of the
content-length for the first chunk.  Each subsequent chunk comes with a
chunk length marker.  The 0 at the end of the file indicates that there
are no more chunks.  Chunk length markers will also appear whenever an
output flush occurs.

To disable chunked encoding, you should specify a content length:

req.headers_out['Content-Length']=str(len(code))

Best Regards,
David



More information about the Mod_python mailing list