davidmoreno / onion

C library to create simple HTTP servers and Web Applications.
http://www.coralbits.com/libonion/
Other
2.01k stars 250 forks source link

Wrong return value of 'onion_websocket_write' #275

Open YggdrasiI opened 3 years ago

YggdrasiI commented 3 years ago

Hello Mr Moreno,

the function 'onion_websocket_write' does not return the correct length information in all cases. If the internal writing is split in multiple parts, only the length of the last token is propagated.

https://github.com/davidmoreno/onion/blob/2b3b230b79ecae119b7eb847f2f9545a46bef13c/src/onion/websocket.c#L238

Fix:

return (ret + (*lpwriter) (ws->req, tout, len & 1023));

Regards Olaf Schulz