Hi,
I’m having trouble with passing the Autobahn wstests 12.4.* I can see why I’m failing, but I’m not sure what I should actually be doing.
The 12.4.* tests involve sending a large HTML file (which includes UTF-8 characters) in slices that are sent with per-message compress.
I’m failing the tests where the slices breakup a mutli-byte UTF-8 character.
For example, in test 12.4.5, all is good until frame 869, which arrives and I receive parse it as follows:
2018-01-04 15:22:47.016:DBUG:oejwcP.SERVER:qtp1304836502-17: Parsing DirectByteBuffer@171a7a53[p=0,l=1019,c=4096,r=1019]={<<<\xC1\xFe\x03\xF3\xC0p\x87Q\x1c’J?\x1b6\x97\xEf7…\xC0\x90a\xB2$\xAdj\xA4\x1dd;\xEb\xD6\x8e\x86>>>\x84$Kr\ \xC6\x87v\xDbzE\xEe\xF1\x98\x0cF…\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2018-01-04 15:22:47.016:DBUG:oejwcP.SERVER:qtp1304836502-17: OpCode TEXT, fin=true rsv=1…
2018-01-04 15:22:47.016:DBUG:oejwcP.SERVER:qtp1304836502-17: Raw Payload: DirectByteBuffer@9d6b2e3[p=0,l=1011,c=1011,r=1011]={<<<\x1c’J?\x1b6\x97\xEf7Y\xA1\xBb\x01y\xA7\x1a\xE2…\xC0\x90a\xB2$\xAdj\xA4\x1dd;\xEb\xD6\x8e\x86>>>}
2018-01-04 15:22:47.016:DBUG:oejwcP.SERVER:qtp1304836502-17: Parsed Frame: TEXT@726feedd[len=1011,fin=true,rsv=100,masked=true] : DirectByteBuffer@171a7a53[p=1019,l=1019,c=4096,r=0]={\xC1\xFe\x03\xF3\xC0p\x87Q\xDcW\xCdn\xDbF\x10\xBe\xF7…\x00\xE0\xE6\xE3\xE4\xDd\xEd\xF5\xDd\x14\xBc\xBa\x16\xFe\x01<<<>>>\x84$Kr\ \xC6\x87v\xDbzE\xEe\xF1\x98\x0cF…\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2018-01-04 15:22:47.016:DBUG:oejwci.WebSocketConnection:qtp1304836502-17: onFrame(TEXT@726feedd[len=1011,fin=true,rsv=100,masked=true])
So it is a masked TEXT frame, fin==true with rsv bit 1 set indicating it is compressed. I unmask and uncompress:
2018-01-04 15:22:47.016:DBUG:oejwcec.CompressExtension:qtp1304836502-17: Decompressed 4096 bytes: Inflater[finished=false,read=401627,written=3563520,remaining=0,in=401627,out=3563520]
2018-01-04 15:22:47.016:DBUG:oejwcec.CompressExtension:qtp1304836502-17: Supplied 4 input bytes: Inflater[finished=false,read=401627,written=3563520,remaining=4,in=401627,out=3563520]
2018-01-04 15:22:47.016:DBUG:oejwcec.CompressExtension:qtp1304836502-17: Decompress: read 0 Inflater[finished=false,read=401631,written=3563520,remaining=0,in=401631,out=3563520]
2018-01-04 15:22:47.016:DBUG:oejwcec.CompressExtension:qtp1304836502-17: Decompress: exiting Inflater[finished=false,read=401631,written=3563520,remaining=0,in=401631,out=3563520]
2018-01-04 15:22:47.016:DBUG:oejwcec.PerMessageDeflateExtension:qtp1304836502-17: nextIncomingFrame(TEXT@7d2e365f[len=4096,fin=true,rsv=000,masked=true])
2018-01-04 15:22:47.016:DBUG:oejwc.WebSocketChannel:qtp1304836502-17: incomingFrame(TEXT@7d2e365f[len=4096,fin=true,rsv=000,masked=true], org.eclipse.jetty.websocket.core.io.WebSocketConnection$1@513e8f4e) - connectionState=WebSocketChannelState[OPEN{i=true o=true c=-1}], handler=org.eclipse.jetty.websocket.core.autobahn.AutobahnFrameHandler@7315adaa
2018-01-04 15:22:47.016:DBUG:oejwc.AbstractFrameHandler:qtp1304836502-17: TEXT: HeapByteBuffer@336dd9f1[p=0,l=4096,c=4096,r=4096]={<<<Case Descripti…T 1:
Hello-\xC2>>>}
The frame expands to 4096 bytes as expected, It contains the expected HTML, but ends with 0xC2, which is the first byte of a two byte UTF-8 character. Looking at the source file, this is a valid slice of that file in bytes.
But this is a fin==true text frame, so I have to convert the payload to a string to pass to my echo handler. Thus I’m detecting that the UTF-8 is incomplete and throw an exception, which makes me fail the test?!?!?
I can’t see how I’m meant to handle that incomplete UTF-8? If the frame was fin==false, then we correctly handle such partial characters, but the fin=true tells me that there is no more parts of this message and it looks to me to really be a bad TEXT message?!?!?
I’m using this is using Autobahn 0.10.9 AutobahnTestSuite 0.7.6 and we are passomg all the other tests
What am I missing?
cheers