[Libwebsockets] const char pointer to libwebsocket_write

Gabriel Gritsch gabriel at gritsch-soft.com
Sat Feb 15 09:11:49 CET 2014


Hi there,

is it save to pass a „const char *“ instead of „char *“ to libwebsocket_write with LWS_WRITE_HTTP parameter?
I know it is not with LWS_WRITE_TEXT and LWS_WRITE_BINARY because the bugger is modified but is it also modified with LWS_WRITE_HTTP and I need to create a writable buffer of my const char * data?

if it is save, could you add something like this:

LWS_EXTERN int
libwebsocket_write_http(struct libwebsocket *wsi, const unsigned char *buf, size_t len)
{
	libwebsocket_write(wsi, (unsigned char *)buf, len, LWS_WRITE_HTTP);
}

best regards

Gabriel


More information about the Libwebsockets mailing list