GangXu / as3-stomp

Automatically exported from code.google.com/p/as3-stomp
0 stars 0 forks source link

Mis-calculate content-length when sending unicode messages #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

Thanks for the great stomp client. :)

We have found a little problem when sending UTF-8 messages to server.

Digging into code, We found a small bug at line:231 of Stomp.as, the
content-length of a unicode string should be the length in bytes.
It should be:

var bodyBytes:ByteArray = new ByteArray();
bodyBytes.writeUTFBytes(body);
transmission += "content-length:" + bodyBytes.length + NEWLINE;            

Or maybe there is a better way to calculate the length in bytes.

BR,
Yenwen Feng

Original issue reported on code.google.com by tempof...@gmail.com on 7 Jan 2008 at 9:35

GoogleCodeExporter commented 9 years ago
Thanks Yenwen. I'll look into this.

Original comment by dwischu...@gmail.com on 14 Jan 2008 at 3:06

GoogleCodeExporter commented 9 years ago

Original comment by dwischu...@gmail.com on 14 Jan 2008 at 3:08

GoogleCodeExporter commented 9 years ago
Yenwen - I've updated the code to fix this issue, and I've run it through some 
tests,
but I'd like to test it against the code the produced the error to make sure
everything is working properly.  Could you send me this code, or attach the 
file to
this issue?

Original comment by dwischu...@gmail.com on 16 Jan 2008 at 4:37

GoogleCodeExporter commented 9 years ago

Original comment by dwischu...@gmail.com on 25 Jan 2008 at 3:23

GoogleCodeExporter commented 9 years ago
body length is now the length of the message in bytes

Original comment by dwischu...@gmail.com on 26 Jan 2008 at 8:03