From: Shuanglei Tao Date: Sun, 23 Jun 2019 10:50:30 +0000 (+0800) Subject: http: fix libwebsockets 1.7 support X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=afadc00f5439ed0d928764fc042571816721c1cd;p=ttyd.git http: fix libwebsockets 1.7 support --- 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;