[
https://issues.apache.org/jira/browse/MODPYTHON-255?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Graham Dumpleton updated MODPYTHON-255:
---------------------------------------
Description:
If PythonInputFilter is used to create an input filter, but content handler
isn't actually mod_python but another module which can handle chunked request
content, and a request is sent with chunked request content, then things just
don't seem to work as one would expect.
For example, if use:
$ curl -d "abcdefghijklmnopqrstuvwxyz"
http://home.dscpl.com.au/~grahamd/echo.wsgi --header "Transfer-Encoding:
chunked"
Where the .wsgi script is for mod_wsgi and is:
import StringIO
def application(environ, start_response):
headers = []
headers.append(('Content-type', 'text/plain'))
start_response('200 OK', headers)
input = environ['wsgi.input']
output = StringIO.StringIO()
keys = environ.keys()
keys.sort()
for key in keys:
print >> output, '%s: %s' % (key, repr(environ[key]))
print >> output
length = int(environ.get('CONTENT_LENGTH', '0'))
#output.write(input.read(length))
output.write(input.read())
return [output.getvalue()]
and the input filter itself is:
from mod_python import apache
def inputfilter(filter):
filter.req.log_error("inputfilter")
filter.req.log_error("inputfilter read()")
s = filter.read()
filter.req.log_error("inputfilter : %s" % repr(s))
while s:
filter.req.log_error("inputfilter write()")
filter.write(s)
filter.req.log_error("inputfilter read()")
s = filter.read()
filter.req.log_error("inputfilter : %s" % repr(s))
if s is None:
filter.req.log_error("inputfilter close()")
filter.close()
filter.req.log_error("inputfilter exit()")
The curl just hangs and logged output is:
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter :
'abcdefghijklmnopqrstuvwxyz'
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter write()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter : '\\r\\n'
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter write()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
First off, a '\r\n' is coming from somewhere when it shouldn't and then it just
blocks on read().
Whatever sentinel is used in input stream to indicate end of chunked request
content, it isn't being recognised by mod_python.
was:
If PythonInputFilter is used to create an input filter, but content handler
isn't actually mod_python but another module which can handle chunked request
content, and a request is sent with chunked request content, then things just
don't seem to work as one would expect.
For example, if use:
$ curl -d "abcdefghijklmnopqrstuvwxyz"
http://home.dscpl.com.au/~grahamd/echo.wsgi --header "Transfer-Encoding:
chunked"
Where the .wsgi script is for mod_wsgi and is:
import StringIO
def application(environ, start_response):
headers = []
headers.append(('Content-type', 'text/plain'))
start_response('200 OK', headers)
input = environ['wsgi.input']
output = StringIO.StringIO()
keys = environ.keys()
keys.sort()
for key in keys:
print >> output, '%s: %s' % (key, repr(environ[key]))
print >> output
length = int(environ.get('CONTENT_LENGTH', '0'))
#output.write(input.read(length))
output.write(input.read())
return [output.getvalue()]
and the input filter itself is:
from mod_python import apache
def inputfilter(filter):
filter.req.log_error("inputfilter")
filter.req.log_error("inputfilter read()")
s = filter.read()
filter.req.log_error("inputfilter : %s" % repr(s))
while s:
filter.req.log_error("inputfilter write()")
filter.write(s)
filter.req.log_error("inputfilter read()")
s = filter.read()
filter.req.log_error("inputfilter : %s" % repr(s))
if s is None:
filter.req.log_error("inputfilter close()")
filter.close()
filter.req.log_error("inputfilter exit()")
The curl just hangs and logged output is:
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter :
'abcdefghijklmnopqrstuvwxyz'
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter write()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter : '\\r\\n'
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter write()
[Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
First off, a '\r\n' is coming from somewhere when it should and then it just
blocks on read().
Whatever sentinel is used in input stream to indicate end of chunked request
content, it isn't being recognised by mod_python.
> PythonInputFilter doesn't appear to work for chunked request content.
> ---------------------------------------------------------------------
>
> Key: MODPYTHON-255
> URL: https://issues.apache.org/jira/browse/MODPYTHON-255
> Project: mod_python
> Issue Type: Bug
> Components: core
> Affects Versions: 3.3.1
> Reporter: Graham Dumpleton
>
> If PythonInputFilter is used to create an input filter, but content handler
> isn't actually mod_python but another module which can handle chunked request
> content, and a request is sent with chunked request content, then things just
> don't seem to work as one would expect.
> For example, if use:
> $ curl -d "abcdefghijklmnopqrstuvwxyz"
> http://home.dscpl.com.au/~grahamd/echo.wsgi --header "Transfer-Encoding:
> chunked"
> Where the .wsgi script is for mod_wsgi and is:
> import StringIO
> def application(environ, start_response):
> headers = []
> headers.append(('Content-type', 'text/plain'))
> start_response('200 OK', headers)
> input = environ['wsgi.input']
> output = StringIO.StringIO()
> keys = environ.keys()
> keys.sort()
> for key in keys:
> print >> output, '%s: %s' % (key, repr(environ[key]))
> print >> output
> length = int(environ.get('CONTENT_LENGTH', '0'))
> #output.write(input.read(length))
> output.write(input.read())
> return [output.getvalue()]
> and the input filter itself is:
> from mod_python import apache
> def inputfilter(filter):
> filter.req.log_error("inputfilter")
> filter.req.log_error("inputfilter read()")
> s = filter.read()
> filter.req.log_error("inputfilter : %s" % repr(s))
> while s:
> filter.req.log_error("inputfilter write()")
> filter.write(s)
> filter.req.log_error("inputfilter read()")
> s = filter.read()
> filter.req.log_error("inputfilter : %s" % repr(s))
> if s is None:
> filter.req.log_error("inputfilter close()")
> filter.close()
> filter.req.log_error("inputfilter exit()")
> The curl just hangs and logged output is:
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter :
> 'abcdefghijklmnopqrstuvwxyz'
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter write()
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter : '\\r\\n'
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter write()
> [Mon Jun 08 14:10:37 2009] [error] [client 192.168.1.5] inputfilter read()
> First off, a '\r\n' is coming from somewhere when it shouldn't and then it
> just blocks on read().
> Whatever sentinel is used in input stream to indicate end of chunked request
> content, it isn't being recognised by mod_python.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.