﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15762	WSGIRequest should wrap the test client wsgi.input in LimitedStream	Tom Christie	nobody	"The following piece of code...

{{{
BUFFER_SIZE = 16000

def example_view(request):
    ret = 'started read\n'
    buffer = request.read(BUFFER_SIZE)
    while buffer:
        ret += 'read %d bytes\n' % len(buffer)
        buffer = request.read(BUFFER_SIZE)
	ret += 'finished read\n'
    return HttpResponse(ret)
}}}

works fine under each of these cases...

* django trunk (1.3.0) / apache + mod_wsgi 3.2
* django trunk (1.3.0) / apache + mod_python 3.3.1
* django trunk (1.3.0) / development server

(Eg responds correctly both to GET requests and to PUT requests with content)

but fails when run with the test client, with:

{{{
AssertionError: Cannot read more than the available bytes from the HTTP incoming data.
}}}

It looks to me like WSGIRequest ought to wrap the test client wsgi.input stream in a !LimitedStream wrapped in that same way that it would do for the development server.

Patch and test are attached."	Bug	closed	Testing framework	1.3	Normal	duplicate			Unreviewed	1	0	0	0	0	0
