Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1752654641, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"61e7363d332d976301636b7cd5fa74c8", "commit": {"type":"commit", "time": 1548853196, "time_ofs": 480, "oid_tree": { "oid": "5c4bd83f115fb7f95c17516883bfe1688732588e", "alias": []}, "oid":{ "oid": "1d466f332edc0827cc3366285d9caf1d21d152f9", "alias": []}, "msg": "lws_http_mark_sse", "sig_commit": { "git_time": { "time": 1548853196, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1548853196, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "lws_http_mark_sse\n\nhttps://github.com/warmcat/libwebsockets/issues/1486" , "diff": "diff --git a/include/libwebsockets/lws-http.h b/include/libwebsockets/lws-http.h\nindex 77fa49c..22b195b 100644\n--- a/include/libwebsockets/lws-http.h\n+++ b/include/libwebsockets/lws-http.h\n@@ -658,14 +658,23 @@ lws_http_transaction_completed(struct lws *wsi);\n *\t\t\t\tit to be reused by another connection\n * \u005cparam wsi:\thttp connection\n *\n- *\tReturns 1 if the HTTP connection must close now\n- *\tReturns 0 and resets connection to wait for new HTTP header /\n- *\t transaction if possible\n+ * If the wsi has an ah headers struct attached, detach it.\n */\n LWS_VISIBLE LWS_EXTERN int\n lws_http_headers_detach(struct lws *wsi);\n \n /**\n+ * lws_http_mark_sse() - called to indicate this http stream is now doing SSE\n+ *\n+ * \u005cparam wsi:\thttp connection\n+ *\n+ * Cancel any timeout on the wsi, and for h2, mark the network connection as\n+ * containing an immortal stream for the duration the SSE stream is open.\n+ */\n+LWS_VISIBLE LWS_EXTERN int\n+lws_http_mark_sse(struct lws *wsi);\n+\n+/**\n * lws_http_compression_apply() - apply an http compression transform\n *\n * \u005cparam wsi: the wsi to apply the compression transform to\ndiff --git a/lib/core-net/private.h b/lib/core-net/private.h\nindex 3688e06..3d4b4c4 100644\n--- a/lib/core-net/private.h\n+++ b/lib/core-net/private.h\n@@ -539,6 +539,7 @@ struct lws {\n \tunsigned int http2_substream:1;\n \tunsigned int upgraded_to_http2:1;\n \tunsigned int h2_stream_carries_ws:1;\n+\tunsigned int h2_stream_carries_sse:1;\n \tunsigned int seen_nonpseudoheader:1;\n \tunsigned int listener:1;\n \tunsigned int user_space_externally_allocated:1;\n@@ -618,7 +619,7 @@ struct lws {\n #if defined(LWS_WITH_STATS) \u0026\u0026 defined(LWS_WITH_TLS)\n \tchar seen_rx;\n #endif\n-\tuint8_t ws_over_h2_count;\n+\tuint8_t immortal_substream_count;\n \t/* volatile to make sure code is aware other thread can change */\n \tvolatile char handling_pollout;\n \tvolatile char leave_pollout_active;\ndiff --git a/lib/core-net/wsi-timeout.c b/lib/core-net/wsi-timeout.c\nindex bf41047..a3dd4e4 100644\n--- a/lib/core-net/wsi-timeout.c\n+++ b/lib/core-net/wsi-timeout.c\n@@ -184,6 +184,8 @@ lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs)\n {\n \tstruct lws_context_per_thread *pt \u003d \u0026wsi-\u003econtext-\u003ept[(int)wsi-\u003etsi];\n \n+\t// lwsl_info(\u0022%s: %p: %d %d\u005cn\u0022, __func__, wsi, reason, secs);\n+\n \tif (secs \u003d\u003d LWS_TO_KILL_SYNC) {\n \t\tlws_remove_from_timeout_list(wsi);\n \t\tlwsl_debug(\u0022synchronously killing %p\u005cn\u0022, wsi);\ndiff --git a/lib/core-net/wsi.c b/lib/core-net/wsi.c\nindex 2b93331..75eb8d9 100644\n--- a/lib/core-net/wsi.c\n+++ b/lib/core-net/wsi.c\n@@ -881,3 +881,21 @@ lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p,\n \n \treturn 0;\n }\n+\n+int\n+lws_http_mark_sse(struct lws *wsi)\n+{\n+\tlws_http_headers_detach(wsi);\n+\tlws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);\n+\n+\tif (wsi-\u003ehttp2_substream) {\n+\t\tstruct lws *nwsi \u003d lws_get_network_wsi(wsi);\n+\n+\t\twsi-\u003eh2_stream_carries_sse \u003d 1;\n+\t\tnwsi-\u003eimmortal_substream_count++;\n+\t\tif (nwsi-\u003eimmortal_substream_count \u003d\u003d 1)\n+\t\t\tlws_set_timeout(nwsi, NO_PENDING_TIMEOUT, 0);\n+\t}\n+\n+\treturn 0;\n+}\ndiff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c\nindex 7650e8f..39fe8a3 100644\n--- a/lib/roles/h2/http2.c\n+++ b/lib/roles/h2/http2.c\n@@ -822,7 +822,7 @@ lws_h2_parse_frame_header(struct lws *wsi)\n \t}\n \n \t/* let the network wsi live a bit longer if subs are active */\n-\tif (!wsi-\u003ews_over_h2_count)\n+\tif (!wsi-\u003eimmortal_substream_count)\n \t\tlws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE, 31);\n \n \tif (h2n-\u003esid)\n@@ -1806,7 +1806,7 @@ lws_h2_parser(struct lws *wsi, unsigned char *in, lws_filepos_t inlen,\n \t\t\t\t * subs are active... our frame may take a long\n \t\t\t\t * time to chew through\n \t\t\t\t */\n-\t\t\t\tif (!wsi-\u003ews_over_h2_count)\n+\t\t\t\tif (!wsi-\u003eimmortal_substream_count)\n \t\t\t\t\tlws_set_timeout(wsi,\n \t\t\t\t\t PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE,\n \t\t\t\t\t 31);\ndiff --git a/lib/roles/h2/ops-h2.c b/lib/roles/h2/ops-h2.c\nindex 573eb83..1c0b32e 100644\n--- a/lib/roles/h2/ops-h2.c\n+++ b/lib/roles/h2/ops-h2.c\n@@ -491,11 +491,11 @@ rops_check_upgrades_h2(struct lws *wsi)\n \twsi-\u003evhost-\u003econn_stats.ws_upg++;\n \tlwsl_info(\u0022Upgrade h2 to ws\u005cn\u0022);\n \twsi-\u003eh2_stream_carries_ws \u003d 1;\n-\tnwsi-\u003ews_over_h2_count++;\n+\tnwsi-\u003eimmortal_substream_count++;\n \tif (lws_process_ws_upgrade(wsi))\n \t\treturn LWS_UPG_RET_BAIL;\n \n-\tif (nwsi-\u003ews_over_h2_count \u003d\u003d 1)\n+\tif (nwsi-\u003eimmortal_substream_count \u003d\u003d 1)\n \t\tlws_set_timeout(nwsi, NO_PENDING_TIMEOUT, 0);\n \n \tlws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);\n@@ -675,12 +675,12 @@ rops_close_kill_connection_h2(struct lws *wsi, enum lws_close_status reason)\n \t\t\tlws_free_set_NULL(wsi-\u003eh2.pending_status_body);\n \t}\n \n-\tif (wsi-\u003eh2_stream_carries_ws) {\n+\tif (wsi-\u003eh2_stream_carries_ws || wsi-\u003eh2_stream_carries_sse) {\n \t\tstruct lws *nwsi \u003d lws_get_network_wsi(wsi);\n \n-\t\tnwsi-\u003ews_over_h2_count++;\n+\t\tnwsi-\u003eimmortal_substream_count--;\n \t\t/* if no ws, then put a timeout on the parent wsi */\n-\t\tif (!nwsi-\u003ews_over_h2_count)\n+\t\tif (!nwsi-\u003eimmortal_substream_count)\n \t\t\t__lws_set_timeout(nwsi,\n \t\t\t\tPENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE, 31);\n \t}\ndiff --git a/minimal-examples/http-server/minimal-http-server-sse-ring/minimal-http-server-sse-ring.c b/minimal-examples/http-server/minimal-http-server-sse-ring/minimal-http-server-sse-ring.c\nindex 3176cd7..ac9d34f 100644\n--- a/minimal-examples/http-server/minimal-http-server-sse-ring/minimal-http-server-sse-ring.c\n+++ b/minimal-examples/http-server/minimal-http-server-sse-ring/minimal-http-server-sse-ring.c\n@@ -216,21 +216,13 @@ callback_sse(struct lws *wsi, enum lws_callback_reasons reason, void *user,\n \t\tpss-\u003ewsi \u003d wsi;\n \n \t\t/*\n-\t\t * Drop the ah that contains the headers associated with\n-\t\t * this connection... ah are a scarce resource, if we don't\n-\t\t * drop it lws will forcibly drop the whole connection to free\n-\t\t * the ah after 5 minutes or so.\n-\t\t *\n-\t\t * If the content of any http headers are important to you for\n-\t\t * deciding what to send, copy them out to the pss before\n-\t\t * doing the below to drop the ah.\n+\t\t * This tells lws we are no longer a normal http stream,\n+\t\t * but are an \u0022immortal\u0022 (plus or minus whatever timeout you\n+\t\t * set on it afterwards) SSE stream. In http/2 case that also\n+\t\t * stops idle timeouts being applied to the network connection\n+\t\t * while this wsi is still open.\n \t\t */\n-\t\tlws_http_headers_detach(wsi);\n-\n-\t\t/* Unlike a normal http connection, we don't want any specific\n-\t\t * timeout. We want to stay up until the client drops us */\n-\n-\t\tlws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);\n+\t\tlws_http_mark_sse(wsi);\n \n \t\t/* write the body separately */\n \ndiff --git a/minimal-examples/http-server/minimal-http-server-sse/README.md b/minimal-examples/http-server/minimal-http-server-sse/README.md\nindex 7a423f4..cc8f478 100644\n--- a/minimal-examples/http-server/minimal-http-server-sse/README.md\n+++ b/minimal-examples/http-server/minimal-http-server-sse/README.md\n@@ -11,6 +11,8 @@ content over Server Side Events.\n \n ## usage\n \n+You can give -s to listen using https on port :443\n+\n ```\n $ ./lws-minimal-http-server-sse\n [2018/04/20 06:09:56:9974] USER: LWS minimal http Server-Side Events | visit http://localhost:7681\ndiff --git a/minimal-examples/http-server/minimal-http-server-sse/localhost-100y.cert b/minimal-examples/http-server/minimal-http-server-sse/localhost-100y.cert\nnew file mode 100644\nindex 0000000..6f372db\n--- /dev/null\n+++ b/minimal-examples/http-server/minimal-http-server-sse/localhost-100y.cert\n@@ -0,0 +1,34 @@\n+-----BEGIN CERTIFICATE-----\n+MIIF5jCCA86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server/minimal-http-server-sse/localhost-100y.key b/minimal-examples/http-server/minimal-http-server-sse/localhost-100y.key\nnew file mode 100644\nindex 0000000..148f859\n--- /dev/null\n+++ b/minimal-examples/http-server/minimal-http-server-sse/localhost-100y.key\n@@ -0,0 +1,52 @@\n+-----BEGIN PRIVATE KEY-----\n+MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCjYtuWaICCY0tJ\n+PubxpIgIL+WWmz/fmK8IQr11Wtee6/IUyUlo5I602mq1qcLhT/kmpoR8Di3DAmHK\n+nSWdPWtn1BtXLErLlUiHgZDrZWInmEBjKM1DZf+CvNGZ+EzPgBv5nTekLWcfI5ZZ\n+toGuIP1Dl/IkNDw8zFz4cpiMe/BFGemyxdHhLrKHSm8Eo+nT734tItnHKT/m6DSU\n+0xlZ13d6ehLRm7/+Nx47M3XMTRH5qKP/7TTE2s0U6+M0tsGI2zpRi+m6jzhNyMBT\n+J1u58qAe3ZW5/+YAiuZYAB6n5bhUp4oFuB5wYbcBywVR8ujInpF8buWQUjy5N8pS\n+Np7szdYsnLJpvAd0sibrNPjC0FQCNrpNjgJmIK3+mKk4kXX7ZTwefoAzTK4l2pHN\n+uC53QVc/EF++GBLAxmvCDq9ZpMIYi7OmzkkAKKC9Ue6Ef217LFQCFIBKIzv9cgi9\n+fwPMLhrKleoVRNsecBsCP569WgJXhUnwf2lon4fEZr3+vRuc9shfqnV0nPN1IMSn\n+zXCast7I2fiuRXdIz96KjlGQpP4XfNVA+RGL7aMnWOFIaVrKWLzAtgzoGMTvP/Au\n+ehKXncBJhYtW0ltTioVx+5yTYSAZWl+IssmXjefxJqYi2/7QWmv1QC9psNcjTMaB\n+QLN03T1Qelbs7Y27sxdEnNUth4kI+wIDAQABAoICAFWe8MQZb37k2gdAV3Y6aq8f\n+qokKQqbCNLd3giGFwYkezHXoJfg6Di7oZxNcKyw35LFEghkgtQqErQqo35VPIoH+\n+vXUpWOjnCmM4muFA9/cX6mYMc8TmJsg0ewL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MoHAUzhzY3brdgtSIxa2\n+gGveGAezZ38qKIU26dkz7deECY4vrsRkwhpTW0LGVCpjcQoaKvymAoCmAs8V2oMr\n+Ziw1YQ9uOUoWwOqm1wZqmVcOXvPIS2gWAs3fQlWjH9hkcQTMsUaXQDOD0aqkSY3E\n+NqOvbCV1/oUpRi3076khCoAXI1bKSn/AvR3KDP14B5toHI/F5OTSEiGhhHesgRrs\n+fBrpEY1IATtPq1taBZZogRqI3rOkkPk\u003d\n+-----END PRIVATE KEY-----\ndiff --git a/minimal-examples/http-server/minimal-http-server-sse/minimal-http-server-sse.c b/minimal-examples/http-server/minimal-http-server-sse/minimal-http-server-sse.c\nindex 74414df..4a16a2a 100644\n--- a/minimal-examples/http-server/minimal-http-server-sse/minimal-http-server-sse.c\n+++ b/minimal-examples/http-server/minimal-http-server-sse/minimal-http-server-sse.c\n@@ -65,22 +65,14 @@ callback_sse(struct lws *wsi, enum lws_callback_reasons reason, void *user,\n \t\tif (lws_finalize_write_http_header(wsi, start, \u0026p, end))\n \t\t\treturn 1;\n \n-\t\t/* Unlike a normal http connection, we don't want any specific\n-\t\t * timeout. We want to stay up until the client drops us */\n-\n-\t\tlws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);\n-\n \t\t/*\n-\t\t * Drop the ah that contains the headers associated with\n-\t\t * this connection... ah are a scarce resource, if we don't\n-\t\t * drop it lws will forcibly drop the whole connection to free\n-\t\t * the ah after 5 minutes or so.\n-\t\t *\n-\t\t * If the content of any http headers are important to you for\n-\t\t * deciding what to send, copy them out to the pss before\n-\t\t * doing the below to drop the ah.\n+\t\t * This tells lws we are no longer a normal http stream,\n+\t\t * but are an \u0022immortal\u0022 (plus or minus whatever timeout you\n+\t\t * set on it afterwards) SSE stream. In http/2 case that also\n+\t\t * stops idle timeouts being applied to the network connection\n+\t\t * while this wsi is still open.\n \t\t */\n-\t\tlws_http_headers_detach(wsi);\n+\t\tlws_http_mark_sse(wsi);\n \n \t\t/* write the body separately */\n \n@@ -204,11 +196,18 @@ int main(int argc, const char **argv)\n \tlwsl_user(\u0022LWS minimal http Server-Side Events | visit http://localhost:7681\u005cn\u0022);\n \n \tmemset(\u0026info, 0, sizeof info); /* otherwise uninitialized garbage */\n-\tinfo.port \u003d 7681;\n+\n \tinfo.protocols \u003d protocols;\n \tinfo.mounts \u003d \u0026mount;\n \tinfo.options \u003d\n \t\tLWS_SERVER_OPTION_HTTP_HEADERS_SECURITY_BEST_PRACTICES_ENFORCE;\n+\tinfo.port \u003d 7681;\n+\tif (lws_cmdline_option(argc, argv, \u0022-s\u0022)) {\n+\t\tinfo.port \u003d 443;\n+\t\tinfo.options |\u003d LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;\n+\t\tinfo.ssl_cert_filepath \u003d \u0022localhost-100y.cert\u0022;\n+\t\tinfo.ssl_private_key_filepath \u003d \u0022localhost-100y.key\u0022;\n+\t}\n \n \tcontext \u003d lws_create_context(\u0026info);\n \tif (!context) {\n","s":{"c":1752654641,"u": 8009}} ],"g": 10052,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}