summaryrefslogtreecommitdiff
path: root/wsgitools/scgi
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2012-06-28 22:38:28 +0200
committerHelmut Grohne <helmut@subdivi.de>2012-06-28 22:38:28 +0200
commit7e2e9173b2afcc2a8dca9e6047d0b82ad70c9dff (patch)
treea44f625d4621348ae14a63f72aad1594cd794ed8 /wsgitools/scgi
parentb83f5682c9d81cd53b8b45a6baedc844a68b85d2 (diff)
downloadwsgitools-7e2e9173b2afcc2a8dca9e6047d0b82ad70c9dff.tar.gz
first part of bytes conversion
Convert the request body data from str to bytes. This replaces all StringIOs with BytesIOs (removing backwards one more backwards compatibility). Also all character sequences involved in request bodies get a b"" prefix. The StaticContent application takes bytes instead of str (no difference for py2x). The GzipWSGIFilter needs a fixed as a truncate of a BytesIO does not rewind the stream position.
Diffstat (limited to 'wsgitools/scgi')
-rw-r--r--wsgitools/scgi/asynchronous.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/wsgitools/scgi/asynchronous.py b/wsgitools/scgi/asynchronous.py
index 1dee283..7eb1a30 100644
--- a/wsgitools/scgi/asynchronous.py
+++ b/wsgitools/scgi/asynchronous.py
@@ -1,14 +1,9 @@
__all__ = []
import asyncore
+import io
import socket
import sys
-# Cannot use io module as it is broken in 2.6.
-# Writing a str to a io.StringIO results in an exception.
-try:
- import cStringIO as io
-except ImportError:
- import StringIO as io
import errno
from wsgitools.scgi import _convert_environ, FileWrapper
@@ -48,7 +43,7 @@ class SCGIConnection(asyncore.dispatcher):
self.wsgiiterator = None # wsgi application iterator
self.outheaders = () # headers to be sent
# () -> unset, (..,..) -> set, True -> sent
- self.body = io.StringIO() # request body
+ self.body = io.BytesIO() # request body
def _try_send_headers(self):
if self.outheaders != True: