| Issue 100: | Result truncated when using wsgi.file_wrapper. | |
| 2 people starred this issue and may be notified of changes. | Back to list |
When using mod_wsgi 2.0/2.1 and an actual file object is supplied to wsgi.file_wrapper on
Windows or if using Apache 1.3 on UNIX, if the first character of a subsequent block in the file is
a NULL character, result would be truncated at that point. The default block size is 8192, but can
be overridden as extra argument to wsgi.file_wrapper.
For example, following code would trigger problem:
path = os.path.join('/tmp/null.txt')
fd = open(path, 'w')
fd.write(8192*'\0')
fd.close()
return environ['wsgi.file_wrapper'](open('/tmp/null.txt', 'rb'), 1024)
Only first 1024 characters would be returned in response.
Problem could also arise for a non file object on any platform or version of Apache. For example:
import StringIO
data = StringIO.StringIO(8192*'\0')
return environ['wsgi.file_wrapper'](data, 1024)
Problem raise in thread:
http://groups.google.com/group/modwsgi/browse_frm/thread/90d169459a651120?hl=en
Initial reporter didn't follow through with enough information to track it done, but subsequent
person worked out trigger scenario.
As Trac is one of the few applications making use of wsgi.file_wrapper, only reports were
affecting that application.
Aug 23, 2008
Project Member
#1
Graham.Dumpleton@gmail.com
Status:
Fixed
|
|
| ► Sign in to add a comment |