[Libwebsockets] const char pointer to libwebsocket_write

"Andy Green (林安廸)" andy at warmcat.com
Sat Feb 15 09:23:41 CET 2014


On 15/02/14 16:11, the mail apparently from Gabriel Gritsch included:
> 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);
> }

Yes it's OK for HTTP protocol.

Thanks for the idea.

http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/commit/?id=890f8e992bf0afeb51c4df8d8503c7d06fa1b6d5

-Andy

> best regards
>
> Gabriel
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>




More information about the Libwebsockets mailing list