Commit 109bb2f6 authored by Committed by Carlos Garcia Campos
WebSockets: allow null characters in text messages data
RFC 6455 says that text messages should contains valid UTF-8, and null characters valid according to RFC 3629. However, we are using g_utf8_validate(), which considers null characters as errors, to validate WebSockets text messages. This patch adds an internal utf8_validate() function based on g_utf8_validate() but allowing null characters and just returning a gboolean since we are always ignoring the end parameter in case of errors. soup_websocket_connection_send_text() assumes the given text is null terminated, so we need a new public function to allow sending text messages containing null characters. This patch adds soup_websocket_connection_send_message() that receives a SoupWebsocketDataType and GBytes, which is consistent with SoupWebsocketConnection::message signal.
Showing with 141 additions and 8 deletions