Open ca7ace24-b88c-4714-94ae-52605b2ac070 opened 8 years ago
While developing, I am using wsgiref.simple_server. Using to serve static content isn't working. The attached program demonstrates the issue. Run it and connect to http://127.0.0.1:8000/. You will see three buttons. Clicking on 'wsgi.filewrapper' causes the FileWrapper class found in wsgiref.util to be used, while clicking on 'PEP-0333' uses code suggested in PEP-0333 (https://www.python.org/dev/peps/pep-0333/#id36). Both of these fail. Clicking on 'slurp' causes the entire file to loaded and returned in a list. This works.
When an application returns an instance of environ['wsgi.file_wrapper'], or creates it's own iterator, an error is raised during the initial read of the file. Reading the entire file and returning a single-element list (the 'slurp' technique) works, but is impractical for larger files.
I've tested this with both Python 2.7.9 and 3.4.3 under Windows 7 (my laptop) and 3.4.3 under Alpine Linux (a Docker instance).
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['library']
title = 'wsgiref.util FileWrapper raises ValueError: I/O operation on closed file.'
updated_at =
user = 'https://bugs.python.org/samwyse'
```
bugs.python.org fields:
```python
activity =
actor = 'SilentGhost'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation =
creator = 'samwyse'
dependencies = []
files = ['41828']
hgrepos = []
issue_num = 26299
keywords = []
message_count = 1.0
messages = ['259685']
nosy_count = 2.0
nosy_names = ['pje', 'samwyse']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue26299'
versions = ['Python 2.7', 'Python 3.6']
```