mod_python and chunked transfer encoding problem

Roman Suzi rnd at onego.ru
Wed May 29 03:40:13 EDT 2002


Hello,

I have the following problem with mod_python.

This is how it is written in httpd.conf of Apache:

<Directory /home/httpd/html/test>
  AddHandler python-program .py
  PythonHandler mptest
  PythonDebug On
</Directory>

This is a handler code (example of it):

----------------------------------------------------

from mod_python import apache
import os
data="""some data...."""

def handler(req):
    f = open("/tmp/log-it", "a")
    f.write(str(dir(req)))
    f.write("\n")
    f.write(str(req.read()))    # !problem!
    f.write("\n")
    f.close()
    req.send_http_header()
    req.write(data)
    return apache.OK

-----------------------------------------------

When I am doing usual GET request to the URL:

http://localhost/test/mptest.py

it works fine.

However, when I am trying to POST using transfer-encoding: chunked
I am getting 411 error:

chunked Transfer-Encoding forbidden: /test/mptest.py

(When I do not try to req.read(), all is fine)

I have no control on the client using "chunked", so I
need a way to mod_python to read chunked body somehow...

mod_php and usual CGI have the same problem (forbidden).
My hope is that mod_python is more flexible.
Maybe I am missing some obvious thing.

Versions:

Name        : mod_python 
Version     : 2.7.6
Vendor: Red Hat 7.2

Name        : apache
Version     : 1.3.20
Vendor: Red Hat, Inc.



Sincerely yours, Roman A.Suzi
-- 
 - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
 






More information about the Python-list mailing list