Yaribz / SPADS

SpringRTS Perl Autohost for Dedicated Server
GNU General Public License v3.0
15 stars 13 forks source link

spads sends binary/non-utf8 data it seems #4

Closed abma closed 9 years ago

abma commented 10 years ago

this is not supported by lobbyserver/lobbyprotocol, this is what it sends for example:

user EvoRTSDedicated3 in this case.

SAYPRIVATE SpringLobbyMonitor  ��� SZ€³���startTs SZ†›���endTsTeam���type undecided���result�������bots96���engine����������allyTeam����loseTime90.209.151.42���ip254340��� accountId€���winDemoner450���name����team���3���teamgreenys6���name908068��� accountId‚���win1���allyTeam����loseTime105.236.96.55���ip���€���win260762��� accountId_Fire���name����team����ip����loseTime����allyTeam���907154��� accountId‚���win2���team yellowguy���name����loseTime41.135.106.12���ip1���allyTeam�������loseTime 2.234.141.78���ip0���allyTeamTheCazziator33���name0���team261133��� accountId‚���win���players �����duration 18815a53534ebbc90ddf560d1cdf4421���gameId1v2��� structure

abma commented 10 years ago

other example: SAYBATTLE someuser pelasinkoha eilenkä yhtään

not sure how it is/was encoded, thats hex: 2014-04-25T18:01:35 Handler 0 : Invalid utf-8 received, skipped message 53:41:59:42:41:54:54:4c:45:20:3c:5b:50:69:52:4f:5d:6b:65:69:6a:6a:6a:30:3e:20:70:65:6c:61:73:69:6e:6b:6f:68:61:20:65:69:6c:65:6e:6b:e4:20:79:68:74:e4:e4:6e

Yaribz commented 10 years ago

For the first example, it's the binary GDR (Game Data Report) messages sent in private by SPADS to SLDB for history and TrueSkill computing. For the second example, it's not a message generated by SPADS itself, it's just a message forwarded "as this" by SPADS because it received it from Spring dedicated server.

abma commented 10 years ago

not sure how to fix the priv msgs, spring should sent them utf-8 encoded i guess...

dansan commented 10 years ago

abma: could you revert the live uberserver to a state in which the msg from spads for sldb still work, until bibim had time to migrate the msg to something ascii encoded? All balancing is currently dependent on those msg. Not having a working balancing system is a big problem for all spring games that use spads! It is esp. problematic for new players.

abma commented 10 years ago

revert: no, to many stuff would break again

add a workaround: yes, but please fix this soon. invalid utf8 caused problems on client and server side, this is why this code was added.

workarround commit: https://github.com/spring/uberserver/commit/5de8aec8c427804631ef666a3cd6052f82e60b01

(i hope it works...)

abma commented 10 years ago

workarrounds applied, do the changes work?

when has bibim time to fix the encoding for GDR?

fix should be trivial, at sending side it just needs to encode base64, at receiving site, decode it...

dansan commented 10 years ago

btw: is binary data allowed in SAYDATAPRIVATE? The html documenation of the protocol doesn't state the encoding of messages anywhere (or I didn't see it).

abma commented 10 years ago

this wasn't discussed, specified, whatever... also * DATA * commands are not implemented.

i would say no, as this is a text-only protocol. what if \n occours in the data?

abma commented 10 years ago

https://github.com/Yaribz/SPADS/blob/master/src/spads.pl#L5524 $sGdr=encode_base64($sGdr);

and

https://github.com/Yaribz/SLDB/blob/master/slMonitor.pl#L1222 $GDRs{$user}->{data} = decode_base64($GDRs{$user}->{data}); (didn't test, but this is how it could work)

abma commented 10 years ago

ok, fixed the workarround, should work now, tested it with bytes 0-255 (excluding \n)

Yaribz commented 9 years ago

Commit 4f375ee makes SPADS >= 0.11.22 use base64 encoding for GDRs (as side effect GDR data transmitted through lobby server will be about 30% bigger).

I will close this issue unless there is still a problem with the messages forwarded "as this" by SPADS from Spring dedicated server to Spring lobby server?