Skip to content

Conversation

@mstojcevich
Copy link

When chunked transfer encoding is used (the default behavior for responses to HTTP 1.1 requests) an exception gets raised because transform_chunk returns an str, which then gets appended to headers in flush, which is a bytestring, so you get a traceback like this:

  File "/home/marcus/......../twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/home/marcus/src/cyclone/cyclone/web.py", line 1159, in _execute_failure
    return self._handle_request_exception(err)
  File "/home/marcus/src/cyclone/cyclone/web.py", line 1211, in _handle_request_exception
    self.send_error(500, exception=e)
  File "/home/marcus/src/cyclone/cyclone/web.py", line 766, in send_error
    self.finish()
  File "/home/marcus/src/cyclone/cyclone/web.py", line 746, in finish
    self.flush(include_footers=True)
  File "/home/marcus/src/cyclone/cyclone/web.py", line 708, in flush
    self.request.write(headers + chunk)
builtins.TypeError: can't concat str to bytes

There was also another bug where ChunkedTransferEncoding.transform_chunk would include b' prefixes on the chunk size and chunk contents.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling 3132b59 on mstojcevich:cte-fix into fefdc51 on fiorix:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants