We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hex dump of TCP stream send by AutobahnAndroid: 00000000 47 45 54 20 2f 77 73 2f 65 63 68 6f 2f 20 48 54 GET /ws/ echo/ HT 00000010 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 31 39 TP/1.1.. Host: 19 00000020 32 2e 31 36 38 2e 30 2e 37 3a 39 38 38 34 0d 0a 2.168.0. 7:9884.. 00000030 55 70 67 72 61 64 65 3a 20 57 65 62 53 6f 63 6b Upgrade: WebSock 00000040 65 74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 et..Conn ection: 00000050 55 70 67 72 61 64 65 0d 0a 53 65 63 2d 57 65 62 Upgrade. .Sec-Web 00000060 53 6f 63 6b 65 74 2d 4b 65 79 3a 20 33 6a 4b 4d Socket-K ey: 3jKM 00000070 4d 56 32 66 47 31 57 78 57 54 65 45 73 53 6f 54 MV2fG1Wx WTeEsSoT 00000080 57 67 3d 3d 0a 0d 0a 53 65 63 2d 57 65 62 53 6f Wg==...S ec-WebSo 00000090 63 6b 65 74 2d 56 65 72 73 69 6f 6e 3a 20 31 33 cket-Ver sion: 13 000000A0 0d 0a 0d 0a ....
As you see, at 00000085 we have a superflorous newline (0x0a).
The code that writes this stuff is in AutobahnWriter.java.
mBuffer.write("GET " + path + " HTTP/1.1"); mBuffer.crlf(); mBuffer.write("Host: " + message.mHost); mBuffer.crlf(); mBuffer.write("Upgrade: WebSocket"); mBuffer.crlf(); mBuffer.write("Connection: Upgrade"); mBuffer.crlf(); mBuffer.write("Sec-WebSocket-Key: " + newHandshakeKey()); mBuffer.crlf(); if (message.mOrigin != null && !message.mOrigin.equals("")) { mBuffer.write("Origin: " + message.mOrigin); mBuffer.crlf(); } mBuffer.write("Sec-WebSocket-Version: 13"); mBuffer.crlf(); mBuffer.crlf();
Apparently message.mOrigin has a extra newline at the end.
Suggested fix: Do not append the newline in the first place, or trim the origin.
The text was updated successfully, but these errors were encountered:
Of course it is the handshake key, not the origin, that has the superfluous newline.
Sorry, something went wrong.
Suggested fix:
Change newHandshakeKey to use NO_WRAP instead of DEFAULT as the flag:
private String newHandshakeKey() { final byte[] ba = new byte[16]; mRng.nextBytes(ba); return Base64.encodeToString(ba, Base64.NO_WRAP); }
Superflorous newline in handshake key - issue #1
83182d2
thanks!
Merge pull request #1 from tavendo/master
4c75aa7
Updated repo from master
No branches or pull requests
Hex dump of TCP stream send by AutobahnAndroid:
00000000 47 45 54 20 2f 77 73 2f 65 63 68 6f 2f 20 48 54 GET /ws/ echo/ HT
00000010 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 31 39 TP/1.1.. Host: 19
00000020 32 2e 31 36 38 2e 30 2e 37 3a 39 38 38 34 0d 0a 2.168.0. 7:9884..
00000030 55 70 67 72 61 64 65 3a 20 57 65 62 53 6f 63 6b Upgrade: WebSock
00000040 65 74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 et..Conn ection:
00000050 55 70 67 72 61 64 65 0d 0a 53 65 63 2d 57 65 62 Upgrade. .Sec-Web
00000060 53 6f 63 6b 65 74 2d 4b 65 79 3a 20 33 6a 4b 4d Socket-K ey: 3jKM
00000070 4d 56 32 66 47 31 57 78 57 54 65 45 73 53 6f 54 MV2fG1Wx WTeEsSoT
00000080 57 67 3d 3d 0a 0d 0a 53 65 63 2d 57 65 62 53 6f Wg==...S ec-WebSo
00000090 63 6b 65 74 2d 56 65 72 73 69 6f 6e 3a 20 31 33 cket-Ver sion: 13
000000A0 0d 0a 0d 0a ....
As you see, at 00000085 we have a superflorous newline (0x0a).
The code that writes this stuff is in AutobahnWriter.java.
Apparently message.mOrigin has a extra newline at the end.
Suggested fix: Do not append the newline in the first place, or trim the origin.
The text was updated successfully, but these errors were encountered: