From afadc00f5439ed0d928764fc042571816721c1cd Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sun, 23 Jun 2019 18:50:30 +0800 Subject: [PATCH] http: fix libwebsockets 1.7 support --- src/http.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/http.c b/src/http.c index 2a5d092..6dfd8bf 100644 --- a/src/http.c +++ b/src/http.c @@ -138,9 +138,15 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, voi return 1; if (lws_write(wsi, buffer + LWS_PRE, p - (buffer + LWS_PRE), LWS_WRITE_HTTP_HEADERS) < 0) return 1; +#if LWS_LIBRARY_VERSION_MAJOR < 2 + if (lws_write_http(wsi, index_html, index_html_len) < 0) + return 1; + goto try_to_reuse; +#else pss->buffer = pss->ptr = (char *) index_html; pss->len = index_html_len; lws_callback_on_writable(wsi); +#endif } break; -- 2.43.4