diff --git a/README.md b/README.md index b1b5f7cd6..b39af8b00 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Travis Build Status](https://travis-ci.org/warmcat/libwebsockets.svg)](https://travis-ci.org/warmcat/libwebsockets) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/qfasji8mnfnd2r8t?svg=true)](https://ci.appveyor.com/project/lws-team/libwebsockets) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3576/badge.svg)](https://scan.coverity.com/projects/3576) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2266/badge)](https://bestpractices.coreinfrastructure.org/projects/2266) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/144fb195a83046e484a75c8b4c6cfc99)](https://www.codacy.com/app/lws-team/libwebsockets?utm_source=github.com&utm_medium=referral&utm_content=warmcat/libwebsockets&utm_campaign=Badge_Grade) +[![Travis Build Status](https://travis-ci.org/warmcat/libwebsockets.svg)](https://travis-ci.org/warmcat/libwebsockets) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/qfasji8mnfnd2r8t?svg=true)](https://ci.appveyor.com/project/lws-team/libwebsockets) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3576/badge.svg)](https://scan.coverity.com/projects/3576) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2266/badge)](https://bestpractices.coreinfrastructure.org/projects/2266) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/144fb195a83046e484a75c8b4c6cfc99)](https://www.codacy.com/app/lws-team/libwebsockets?utm_source=github.com&utm_medium=referral&utm_content=warmcat/libwebsockets&utm_campaign=Badge_Grade) [![Total alerts](https://img.shields.io/lgtm/alerts/g/warmcat/libwebsockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/warmcat/libwebsockets/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/warmcat/libwebsockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/warmcat/libwebsockets/context:cpp) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/warmcat/libwebsockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/warmcat/libwebsockets/context:javascript) # Libwebsockets diff --git a/lib/core/private-lib-core.h b/lib/core/private-lib-core.h index d65e2dcca..af88bbffe 100644 --- a/lib/core/private-lib-core.h +++ b/lib/core/private-lib-core.h @@ -22,6 +22,9 @@ * IN THE SOFTWARE. */ +#if !defined(__LWS_PRIVATE_LIB_CORE_H__) +#define __LWS_PRIVATE_LIB_CORE_H__ + #include "lws_config.h" #include "lws_config_private.h" @@ -633,3 +636,5 @@ lws_context_destroy2(struct lws_context *context); #ifdef __cplusplus }; #endif + +#endif diff --git a/lib/misc/lwsac/private-lib-misc-lwsac.h b/lib/misc/lwsac/private-lib-misc-lwsac.h index 6ace62cee..d65f9d1b6 100644 --- a/lib/misc/lwsac/private-lib-misc-lwsac.h +++ b/lib/misc/lwsac/private-lib-misc-lwsac.h @@ -22,6 +22,9 @@ * IN THE SOFTWARE. */ +#if !defined(__LWS_PRIVATE_LIB_MISC_LWSAC_H__) +#define __LWS_PRIVATE_LIB_MISC_LWSAC_H__ + #if !defined(LWS_PLAT_OPTEE) #include #endif @@ -53,3 +56,4 @@ struct cached_file_info { time_t last_confirm; }; #endif +#endif diff --git a/lib/roles/h2/hpack.c b/lib/roles/h2/hpack.c index 66021791d..199818776 100644 --- a/lib/roles/h2/hpack.c +++ b/lib/roles/h2/hpack.c @@ -394,8 +394,7 @@ lws_token_from_index(struct lws *wsi, int index, const char **arg, int *len, return -1; } - if (index < (int)LWS_ARRAY_SIZE(static_token) || - index >= (int)LWS_ARRAY_SIZE(static_token) + dyn->used_entries) { + if (index >= (int)LWS_ARRAY_SIZE(static_token) + dyn->used_entries) { lwsl_info(" %s: adjusted index %d >= %d\n", __func__, index, dyn->used_entries); lws_h2_goaway(wsi, H2_ERR_COMPRESSION_ERROR, diff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c index 71bd09804..39dd4fe06 100644 --- a/lib/roles/h2/http2.c +++ b/lib/roles/h2/http2.c @@ -457,13 +457,11 @@ lws_h2_settings(struct lws *wsi, struct http2_settings *settings, } #if defined(LWS_AMAZON_RTOS) || defined(LWS_AMAZON_LINUX) - //FIXME: Workaround for FIRMWARE-4632 until cloud-side issue is fixed. if (b == 0x7fffffff) { b = 65535; lwsl_info("init window size 0x7fffffff\n"); break; } - //FIXME: end of FIRMWARE-4632 workaround #endif /* diff --git a/lib/tls/openssl/private-lib-tls-openssl.h b/lib/tls/openssl/private-lib-tls-openssl.h index e53d85561..004d596ae 100644 --- a/lib/tls/openssl/private-lib-tls-openssl.h +++ b/lib/tls/openssl/private-lib-tls-openssl.h @@ -24,6 +24,9 @@ * gencrypto openssl-specific helper declarations */ +#if !defined(__LWS_PRIVATE_LIB_TLS_OPENSSL_H__) +#define __LWS_PRIVATE_LIB_TLS_OPENSSL_H__ + /* * one of these per different client context * cc_owner is in lws_context.lws_context_tls @@ -54,3 +57,6 @@ lws_gencrypto_openssl_hash_to_EVP_MD(enum lws_genhash_types hash_type); #if !defined(LWS_HAVE_BN_bn2binpad) int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); #endif + +#endif + diff --git a/minimal-examples/client-server/minimal-ws-proxy/mount-origin/example.js b/minimal-examples/client-server/minimal-ws-proxy/mount-origin/example.js index a25a3cd44..cfe67a72e 100644 --- a/minimal-examples/client-server/minimal-ws-proxy/mount-origin/example.js +++ b/minimal-examples/client-server/minimal-ws-proxy/mount-origin/example.js @@ -36,7 +36,7 @@ function new_ws(urlpath, protocol) document.addEventListener("DOMContentLoaded", function() { - ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-proxy"); + var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-proxy"); try { ws.onopen = function() { document.getElementById("r").disabled = 0; diff --git a/minimal-examples/http-server/minimal-http-server-deaddrop/mount-origin/deaddrop.js b/minimal-examples/http-server/minimal-http-server-deaddrop/mount-origin/deaddrop.js index ebb6e12fa..df87787c0 100644 --- a/minimal-examples/http-server/minimal-http-server-deaddrop/mount-origin/deaddrop.js +++ b/minimal-examples/http-server/minimal-http-server-deaddrop/mount-origin/deaddrop.js @@ -74,7 +74,7 @@ } function clear_errors() { - var t = document.getElementById("ongoing"); + var n, t = document.getElementById("ongoing"); for (n = 0; n < t.rows.length; n++) if (t.rows[n].cells[0].classList.contains("err")) @@ -154,8 +154,7 @@ } function upl_button(e) { - var fi = document.getElementById("file"), - da = document.getElementById("da"); + var fi = document.getElementById("file"); clear_errors(); e.preventDefault(); diff --git a/minimal-examples/http-server/minimal-http-server-fulltext-search/mount-origin/lws-fts.js b/minimal-examples/http-server/minimal-http-server-fulltext-search/mount-origin/lws-fts.js index 027bccbe6..af4731aeb 100644 --- a/minimal-examples/http-server/minimal-http-server-fulltext-search/mount-origin/lws-fts.js +++ b/minimal-examples/http-server/minimal-http-server-fulltext-search/mount-origin/lws-fts.js @@ -28,8 +28,8 @@ function san(s) { - s.replace("<", "!"); - s.replace("%", "!"); + s.replace(/"; @@ -129,7 +124,7 @@ xhr.setRequestHeader("cache-control", "max-age=0"); }; xhr.onload = function(e) { - var jj, n, s = "", x, lic = 0; + var jj, n, s = "", lic = 0; var inp = document.getElementById("lws_fts"); var ac = document.getElementById("acomplete"); diff --git a/minimal-examples/http-server/minimal-http-server-generic-sessions/mount-origin/example.js b/minimal-examples/http-server/minimal-http-server-generic-sessions/mount-origin/example.js index 1606ea03a..d58154535 100644 --- a/minimal-examples/http-server/minimal-http-server-generic-sessions/mount-origin/example.js +++ b/minimal-examples/http-server/minimal-http-server-generic-sessions/mount-origin/example.js @@ -18,5 +18,4 @@ document.addEventListener("DOMContentLoaded", function() { if (transport_protocol == "h2") document.getElementById("transport").innerHTML = ""; - } }, false); \ No newline at end of file diff --git a/minimal-examples/http-server/minimal-http-server-generic-sessions/mount-origin/lwsgs.js b/minimal-examples/http-server/minimal-http-server-generic-sessions/mount-origin/lwsgs.js index 059ad118c..5fe956232 100644 --- a/minimal-examples/http-server/minimal-http-server-generic-sessions/mount-origin/lwsgs.js +++ b/minimal-examples/http-server/minimal-http-server-generic-sessions/mount-origin/lwsgs.js @@ -244,7 +244,7 @@ var lwsgs_email_check = '0'; function lwsgs_rupdate() { - var en_register = 1, en_forgot = 0; + var en_register = 1, en_forgot = 0, op; if (document.getElementById('rpassword').value == document.getElementById('password2').value) { @@ -335,7 +335,7 @@ function lwsgs_rupdate() function lwsgs_cupdate() { - var en_change = 1, en_forgot = 1, pwok = 1; + var en_change = 1, en_forgot = 1, pwok = 1, op; if (lwsgs_auth & 8) { document.getElementById('ccurpw').style.display = "none"; diff --git a/minimal-examples/http-server/minimal-http-server-sse-ring/mount-origin/example.js b/minimal-examples/http-server/minimal-http-server-sse-ring/mount-origin/example.js index b32bf0bfb..ed9bba14b 100644 --- a/minimal-examples/http-server/minimal-http-server-sse-ring/mount-origin/example.js +++ b/minimal-examples/http-server/minimal-http-server-sse-ring/mount-origin/example.js @@ -1,6 +1,6 @@ document.addEventListener("DOMContentLoaded", function() { - var head = 0, tail = 0, ring = new Array(); + var head = 0, tail = 0, ring = new Array(), es; es = new EventSource("/sse/sourcename"); try { diff --git a/minimal-examples/http-server/minimal-http-server-sse/mount-origin/example.js b/minimal-examples/http-server/minimal-http-server-sse/mount-origin/example.js index af73512ec..cfb89ea69 100644 --- a/minimal-examples/http-server/minimal-http-server-sse/mount-origin/example.js +++ b/minimal-examples/http-server/minimal-http-server-sse/mount-origin/example.js @@ -1,6 +1,6 @@ document.addEventListener("DOMContentLoaded", function() { -var head = 0, tail = 0, ring = new Array(); +var head = 0, tail = 0, ring = new Array(), es; es = new EventSource("/sse/sourcename"); try { diff --git a/minimal-examples/http-server/minimal-http-server-tls-mem/mount-origin/example.js b/minimal-examples/http-server/minimal-http-server-tls-mem/mount-origin/example.js index 1606ea03a..d797d3795 100644 --- a/minimal-examples/http-server/minimal-http-server-tls-mem/mount-origin/example.js +++ b/minimal-examples/http-server/minimal-http-server-tls-mem/mount-origin/example.js @@ -18,5 +18,5 @@ document.addEventListener("DOMContentLoaded", function() { if (transport_protocol == "h2") document.getElementById("transport").innerHTML = ""; - } + }, false); \ No newline at end of file diff --git a/minimal-examples/http-server/minimal-http-server-tls/mount-origin/example.js b/minimal-examples/http-server/minimal-http-server-tls/mount-origin/example.js index 1606ea03a..574ee9760 100644 --- a/minimal-examples/http-server/minimal-http-server-tls/mount-origin/example.js +++ b/minimal-examples/http-server/minimal-http-server-tls/mount-origin/example.js @@ -18,5 +18,4 @@ document.addEventListener("DOMContentLoaded", function() { if (transport_protocol == "h2") document.getElementById("transport").innerHTML = ""; - } -}, false); \ No newline at end of file +}, false); diff --git a/minimal-examples/ws-server/minimal-ws-broker/mount-origin/example.js b/minimal-examples/ws-server/minimal-ws-broker/mount-origin/example.js index 61c76171e..e9ddedb94 100644 --- a/minimal-examples/ws-server/minimal-ws-broker/mount-origin/example.js +++ b/minimal-examples/ws-server/minimal-ws-broker/mount-origin/example.js @@ -35,7 +35,7 @@ function new_ws(urlpath, protocol) document.addEventListener("DOMContentLoaded", function() { - subscriber_ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-broker"); + var subscriber_ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-broker"); try { subscriber_ws.onopen = function() { document.getElementById("b").disabled = 0; @@ -55,7 +55,7 @@ document.addEventListener("DOMContentLoaded", function() { alert("

Error " + exception); } - publisher_ws = new_ws(get_appropriate_ws_url("/publisher"), "lws-minimal-broker"); + var publisher_ws = new_ws(get_appropriate_ws_url("/publisher"), "lws-minimal-broker"); try { publisher_ws.onopen = function() { document.getElementById("m").disabled = 0; diff --git a/minimal-examples/ws-server/minimal-ws-server-pmd-bulk/mount-origin/example.js b/minimal-examples/ws-server/minimal-ws-server-pmd-bulk/mount-origin/example.js index d1c49a77f..dc4c4a941 100644 --- a/minimal-examples/ws-server/minimal-ws-server-pmd-bulk/mount-origin/example.js +++ b/minimal-examples/ws-server/minimal-ws-server-pmd-bulk/mount-origin/example.js @@ -35,7 +35,7 @@ function new_ws(urlpath, protocol) document.addEventListener("DOMContentLoaded", function() { - ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-pmd-bulk"); + var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-pmd-bulk"); try { ws.onopen = function() { document.getElementById("r").disabled = 0; diff --git a/minimal-examples/ws-server/minimal-ws-server-pmd/mount-origin/example.js b/minimal-examples/ws-server/minimal-ws-server-pmd/mount-origin/example.js index 4760a20f8..0aac55e53 100644 --- a/minimal-examples/ws-server/minimal-ws-server-pmd/mount-origin/example.js +++ b/minimal-examples/ws-server/minimal-ws-server-pmd/mount-origin/example.js @@ -35,7 +35,7 @@ function new_ws(urlpath, protocol) document.addEventListener("DOMContentLoaded", function() { - ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); + var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); try { ws.onopen = function() { document.getElementById("m").disabled = 0; diff --git a/minimal-examples/ws-server/minimal-ws-server-ring/mount-origin/example.js b/minimal-examples/ws-server/minimal-ws-server-ring/mount-origin/example.js index be1037fd9..72007c8d7 100644 --- a/minimal-examples/ws-server/minimal-ws-server-ring/mount-origin/example.js +++ b/minimal-examples/ws-server/minimal-ws-server-ring/mount-origin/example.js @@ -34,7 +34,7 @@ function new_ws(urlpath, protocol) document.addEventListener("DOMContentLoaded", function() { - ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); + var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); try { ws.onopen = function() { document.getElementById("m").disabled = 0; diff --git a/minimal-examples/ws-server/minimal-ws-server-threadpool/mount-origin/example.js b/minimal-examples/ws-server/minimal-ws-server-threadpool/mount-origin/example.js index 783ae136b..031eebf0f 100644 --- a/minimal-examples/ws-server/minimal-ws-server-threadpool/mount-origin/example.js +++ b/minimal-examples/ws-server/minimal-ws-server-threadpool/mount-origin/example.js @@ -40,7 +40,7 @@ document.addEventListener("DOMContentLoaded", function() { for (n = 0; n < 8; n++) { - ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); + var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); wsa.push(ws); try { ws.onopen = function() { diff --git a/minimal-examples/ws-server/minimal-ws-server-threads-smp/mount-origin/example.js b/minimal-examples/ws-server/minimal-ws-server-threads-smp/mount-origin/example.js index a6ff6630f..60975fbdd 100644 --- a/minimal-examples/ws-server/minimal-ws-server-threads-smp/mount-origin/example.js +++ b/minimal-examples/ws-server/minimal-ws-server-threads-smp/mount-origin/example.js @@ -36,7 +36,7 @@ function new_ws(urlpath, protocol) document.addEventListener("DOMContentLoaded", function() { - ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); + var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); try { ws.onopen = function() { document.getElementById("r").disabled = 0; diff --git a/minimal-examples/ws-server/minimal-ws-server-threads/mount-origin/example.js b/minimal-examples/ws-server/minimal-ws-server-threads/mount-origin/example.js index a6ff6630f..60975fbdd 100644 --- a/minimal-examples/ws-server/minimal-ws-server-threads/mount-origin/example.js +++ b/minimal-examples/ws-server/minimal-ws-server-threads/mount-origin/example.js @@ -36,7 +36,7 @@ function new_ws(urlpath, protocol) document.addEventListener("DOMContentLoaded", function() { - ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); + var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); try { ws.onopen = function() { document.getElementById("r").disabled = 0; diff --git a/minimal-examples/ws-server/minimal-ws-server/mount-origin/example.js b/minimal-examples/ws-server/minimal-ws-server/mount-origin/example.js index 189f4640b..8056d3dfa 100644 --- a/minimal-examples/ws-server/minimal-ws-server/mount-origin/example.js +++ b/minimal-examples/ws-server/minimal-ws-server/mount-origin/example.js @@ -35,7 +35,7 @@ function new_ws(urlpath, protocol) document.addEventListener("DOMContentLoaded", function() { - ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); + var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal"); try { ws.onopen = function() { document.getElementById("m").disabled = 0; diff --git a/plugins/deaddrop/assets/deaddrop.js b/plugins/deaddrop/assets/deaddrop.js index ebb6e12fa..df87787c0 100644 --- a/plugins/deaddrop/assets/deaddrop.js +++ b/plugins/deaddrop/assets/deaddrop.js @@ -74,7 +74,7 @@ } function clear_errors() { - var t = document.getElementById("ongoing"); + var n, t = document.getElementById("ongoing"); for (n = 0; n < t.rows.length; n++) if (t.rows[n].cells[0].classList.contains("err")) @@ -154,8 +154,7 @@ } function upl_button(e) { - var fi = document.getElementById("file"), - da = document.getElementById("da"); + var fi = document.getElementById("file"); clear_errors(); e.preventDefault(); diff --git a/plugins/generic-sessions/assets/lwsgs.js b/plugins/generic-sessions/assets/lwsgs.js index b9bfe16f6..38dc5b107 100644 --- a/plugins/generic-sessions/assets/lwsgs.js +++ b/plugins/generic-sessions/assets/lwsgs.js @@ -244,7 +244,7 @@ var lwsgs_email_check = '0'; function lwsgs_rupdate() { - var en_register = 1, en_forgot = 0; + var en_register = 1, en_forgot = 0, op; if (document.getElementById('rpassword').value == document.getElementById('password2').value) { @@ -335,7 +335,7 @@ function lwsgs_rupdate() function lwsgs_cupdate() { - var en_change = 1, en_forgot = 1, pwok = 1; + var en_change = 1, en_forgot = 1, pwok = 1, op; if (lwsgs_auth & 8) { document.getElementById('ccurpw').style.display = "none"; diff --git a/plugins/server-status.js b/plugins/server-status.js index eafbc3be2..c8034c9a9 100644 --- a/plugins/server-status.js +++ b/plugins/server-status.js @@ -29,8 +29,6 @@ function humanize(s) return s; } - var pos = 0; - function get_appropriate_ws_url() { var pcol;