summaryrefslogtreecommitdiff
path: root/modules/websocket/lws_client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/websocket/lws_client.cpp')
-rw-r--r--modules/websocket/lws_client.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/modules/websocket/lws_client.cpp b/modules/websocket/lws_client.cpp
index cd814760e6..d71d091720 100644
--- a/modules/websocket/lws_client.cpp
+++ b/modules/websocket/lws_client.cpp
@@ -76,23 +76,11 @@ Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
ERR_FAIL_V(FAILED);
}
- char abuf[1024];
- char hbuf[1024];
- char pbuf[2048];
- String addr_str = (String)addr;
- strncpy(abuf, addr_str.ascii().get_data(), 1024);
- strncpy(hbuf, p_host.utf8().get_data(), 1024);
- strncpy(pbuf, p_path.utf8().get_data(), 2048);
-
i.context = context;
if (p_protocols.size() > 0)
i.protocol = _lws_ref->lws_names;
else
i.protocol = NULL;
- i.address = abuf;
- i.host = hbuf;
- i.path = pbuf;
- i.port = p_port;
if (p_ssl) {
i.ssl_connection = LCCSCF_USE_SSL;
@@ -102,7 +90,16 @@ Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
i.ssl_connection = 0;
}
+ // This String needs to survive till we call lws_client_connect_via_info
+ String addr_str = (String)addr;
+
+ i.address = addr_str.ascii().get_data();
+ i.host = p_host.utf8().get_data();
+ i.path = p_path.utf8().get_data();
+ i.port = p_port;
+
lws_client_connect_via_info(&i);
+
return OK;
};