Closed treeform closed 6 years ago
The problem is on https://github.com/niv/websocket.nim/blob/master/websocket/shared.nim#L57 ret.write(int64 f.data.len.int32.htonl) and 0x7fff
ret.write(int64 f.data.len.int32.htonl)
0x7fff
Is not correct way to do, it should be some thing like:
if f.data.len > 125 and f.data.len <= 0xffff: ret.write(uint16 f.data.len.uint16.htons) elif f.data.len > 0xffff: var len = f.data.len ret.write char((len shr 56) and 255) ret.write char((len shr 48) and 255) ret.write char((len shr 40) and 255) ret.write char((len shr 32) and 255) ret.write char((len shr 24) and 255) ret.write char((len shr 16) and 255) ret.write char((len shr 8) and 255) ret.write char(len and 255)
Perhaps you could submit a pull request?
The problem is on https://github.com/niv/websocket.nim/blob/master/websocket/shared.nim#L57
ret.write(int64 f.data.len.int32.htonl)
and0x7fff
Is not correct way to do, it should be some thing like: