summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/websockets/server.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/surfaces/websockets/server.cc b/libs/surfaces/websockets/server.cc
index 7455770a7d..79f0c89b85 100644
--- a/libs/surfaces/websockets/server.cc
+++ b/libs/surfaces/websockets/server.cc
@@ -389,9 +389,12 @@ WebsocketsServer::send_index_body (Client wsi)
std::string index = _resources.scan ();
char body[MAX_INDEX_SIZE];
- //lws_strncpy (body, index.c_str (), sizeof(body));
+#if LWS_LIBRARY_VERSION_MAJOR >= 3
+ lws_strncpy (body, index.c_str (), sizeof(body));
+#else
memset (body, 0, sizeof (body));
strncpy (body, index.c_str (), sizeof(body) - 1);
+#endif
int len = strlen (body);
if (lws_write (wsi, reinterpret_cast<unsigned char*> (body), len, LWS_WRITE_HTTP) != len) {