- if "CONTENT_LENGTH" in env:
- clen = self.ihead["Content-Length"] = env["CONTENT_LENGTH"]
- if clen.isdigit():
- self.input = limitreader(env["wsgi.input"], int(clen))
- if self.input is None:
- self.input = io.BytesIO("")
+ if "CONTENT_LENGTH" in env:
+ clen = self.ihead["Content-Length"] = env["CONTENT_LENGTH"]
+ if clen.isdigit():
+ self.input = limitreader(env["wsgi.input"], int(clen))
+ else:
+ # XXX: What to do?
+ self.input = io.BytesIO("")
+ else:
+ # Assume input is chunked and read until ordinary EOF.
+ self.input = env["wsgi.input"]
+ else:
+ self.input = None