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

Using AMF3, calling a remote method with a string parameter 64+ characters fails #59

Open
youngsoul opened this issue Feb 25, 2016 · 2 comments

Comments

@youngsoul
Copy link

input is something like:
client.myRemoteService.myRemoteMethod('rrrrrrrrrrrrrrjrrrrrrrrrrrrrrjrrrrrrrrrrrrrrjrrrrrffffffffffffff')
Error message:
UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 48: ordinal not in range(128)

Where it seems to be failing is:
remoting/__init__py
def _write_body(...)
def _encode_body(message)

line 523: encoder.writeElement(x)

After it tries to write the element for that 64+ character string the stream has non-ascii characters in it and I receive the above error message.

@mejmo
Copy link

mejmo commented Nov 4, 2017

Did you solve the problem?:) Getting the similar problem, when re-using the service in the second call. If I re-create the RemotingService it works. Otherwise:

  File "C:\Python27\lib\httplib.py", line 880, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 57: ordinal not in range(128)

Problem is that in some cases the msg is str and in another is unicode in httplib. I do not know why yet, therefore the AMF message cannot be encoded:

        if isinstance(message_body, str):
           msg += message_body  <-----
            message_body = None

Update: Yes its the length of the HTTP request itself. In case of longer URLs, the buffer has this lines (POST /blablabla) in unicode type.

mejmo pushed a commit to mejmo/pyamf that referenced this issue Nov 4, 2017
@youngsoul
Copy link
Author

Thank you very much for sharing your solution. I did not find a work around, but I will pass along your solution to the team that is using this. Thank you again!

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

No branches or pull requests

2 participants