Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect implicit unicode conversion. #11

Merged
merged 1 commit into from Jul 19, 2017

Conversation

ftobia
Copy link

@ftobia ftobia commented Jul 19, 2017

When "headers" is a unicode string and "content" is bytes, the implicit conversion would cause the below stack trace.

Also line 123 was superfluous so I removed it.

Jul 19 19:02:39 ip-172-30-3-23 UPLOAD: [ERROR] __main__:175> exception encountered
Traceback (most recent call last):
  File "/home/ubuntu/release-upload/lib/rhc/micro.py", line 169, in run
    SERVER.service(delay=sleep/1000.0, max_iterations=max_iterations)
  File "/home/ubuntu/release-upload/lib/rhc/tcpsocket.py", line 152, in service
    while (self._service(delay)):
  File "/home/ubuntu/release-upload/lib/rhc/tcpsocket.py", line 191, in _service
    self._poll_map[sock][0]()
  File "/home/ubuntu/release-upload/lib/rhc/tcpsocket.py", line 482, in _do_handshake
    self._on_ready()
  File "/home/ubuntu/release-upload/lib/rhc/tcpsocket.py", line 487, in _on_ready
    self.on_ready()
  File "/home/ubuntu/release-upload/lib/rhc/async.py", line 671, in on_ready
    self.send(method=ctx.method, host=ctx.host, resource=ctx.resource, headers=ctx.headers, content=ctx.content, close=ctx.close, compress=ctx.compress)
  File "/home/ubuntu/release-upload/lib/rhc/httphandler.py", line 155, in send
    self.__send(headers, content)
  File "/home/ubuntu/release-upload/lib/rhc/httphandler.py", line 124, in __send
    data = headers + content
UnicodeDecodeError: 'ascii' codec can't decode byte 0x89 in position 0: ordinal not in range(128)

@robertchase robertchase merged commit ab8c9e2 into robertchase:master Jul 19, 2017
@robertchase
Copy link
Owner

nice catch.

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.

None yet

2 participants