Project homepage Mailing List  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"en-US,en;q\u003d0.5", "gen_ut":1635259488, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"", "f":3, "items": [ {"schema":"libjg2-1", "cid":"1e050cab4ce249abb336654e13bf14a9", "oid":{ "oid": "e19b806e13886fae5cfcdef34fd972af6cbf83e4", "alias": [ "refs/heads/v3.0-stable"]},"blobname": "changelog", "blob": "Changelog\n---------\n\nv3.0.0\n\u003d\u003d\u003d\u003d\u003d\u003d\n\n - CHANGE: Clients used to call LWS_CALLBACK_CLOSED same as servers...\n LWS_CALLBACK_CLIENT_CLOSED has been introduced and is called for clients\n now.\n \n - CHANGE: LWS_CALLBACK_CLIENT_CONNECTION_ERROR used to only be directed at\n protocols[0]. However in many cases, the protocol to bind to was provided\n at client connection info time and the wsi bound accordingly. In those\n cases, CONNECTION_ERROR is directed at the bound protocol, not protcols[0]\n any more.\n\n - CHANGE: CMAKE: the following cmake defaults have changed with this version:\n \n - LWS_WITH_ZIP_FOPS: now defaults OFF\n - LWS_WITH_RANGES: now defaults OFF\n - LWS_WITH_ZLIB: now defaults OFF\n - LWS_WITHOUT_EXTENSIONS: now defaults ON\n \n - CHANGE: REMOVED: lws_alloc_vfs_file() (read a file to malloc buffer)\n \n - CHANGE: REMOVED: lws_read() (no longer useful outside of lws internals)\n \n - CHANGE: REMOVED: ESP8266... ESP32 is now within the same price range and much\n more performant\n \n - CHANGE: soname bump... don't forget to `ldconfig`\n \n - NEW: all event libraries support \u0022foreign\u0022 loop integration where lws itself\n if just a temporary user of the loop unrelated to the actual loop lifecycle.\n \n See `minimal-http-server-eventlib-foreign` for example code demonstrating\n this for all the event libraries.\n \n Internal loop in lws is also supported and demonstrated by\n `minimal-http-server-eventlib`.\n \n - NEW: ws-over-h2 support. This is a new RFC-on-the-way supported by Chrome\n and shortly firefox that allows ws connections to be multiplexed back to the\n server on the same tcp + tls wrapper h2 connection that the html and scripts\n came in on. This is hugely faster that discrete connections.\n \n - NEW: UDP socket adoption and related event callbacks\n \n - NEW: Multi-client connection binding, queuing and pipelining support.\n \n Lws detects multiple client connections to the same server and port, and\n optimizes how it handles them according to the server type and provided\n flags. For http/1.0, all occur with individual parallel connections. For\n http/1.1, you can enable keepalive pipelining, so the connections occur\n sequentially on a single network connection. For http/2, they all occur\n as parallel streams within a single h2 network connection.\n \n See minimal-http-client-multi for example code. \n \n - NEW: High resolution timer API for wsi, get a callback on your wsi with\n LWS_CALLBACK_TIMER, set and reset the timer with lws_set_timer_usecs(wsi, us)\n Actual resolution depends on event backend. Works with all backends, poll,\n libuv, libevent, and libev.\n \n - NEW: Protocols can arrange vhost-protocol instance specific callbacks with\n second resolution using `lws_timed_callback_vh_protocol()`\n\n - NEW: ACME client plugin for self-service TLS certificates\n \n - NEW: RFC7517 JSON Web Keys RFC7638 JWK thumbprint, and RFC7515 JSON Web\n signatures support\n \n - NEW: lws_cancel_service() now provides a generic way to synchronize events\n from other threads, which appear as a LWS_CALLBACK_EVENT_WAIT_CANCELLED\n callback on all protocols. This is compatible with all the event libraries.\n\n - NEW: support BSD poll() where changes to the poll wait while waiting are\n undone.\n\n - NEW: Introduce generic hash, hmac and RSA apis that operate the same\n regardless of OpenSSL or mbedTLS tls backend\n \n - NEW: Introduce X509 element query api that works the same regardless of\n OpenSSL or mbedTLS tls backend\n \n - NEW: Introduce over 30 \u0022minimal examples\u0022 in ./minimal-examples... these\n replace most of the old test servers\n \n - test-echo -\u003e minimal-ws-server-echo and minimal-ws-client-echo\n\n - test-server-libuv / -libevent / -libev -\u003e\n minimal-https-server-eventlib / -eventlib-foreign / -eventlib-demos\n\n - test-server-v2.0 -\u003e folded into all the minimal servers\n\n - test-server direct http serving -\u003e minimal-http-server-dynamic\n \n The minimal examples allow individual standalone build using their own\n small CMakeLists.txt.\n \n - NEW: lws now detects any back-to-back writes that did not go through the\n event loop inbetween and reports them. This will flag any possibility of\n failure rather than wait until the problem happens.\n \n - NEW: CMake has LWS_WITH_DISTRO_RECOMMENDED to select features that are\n appropriate for distros\n \n - NEW: Optional vhost URL `error_document_404` if given causes a redirect there\n instead of serve the default 404 page.\n \n - NEW: lws_strncpy() wrapper guarantees NUL in copied string even if it was\n truncated to fit.\n \n - NEW: for client connections, local protocol binding name can be separated\n from the ws subprotocol name if needed, using .local_protocol_name\n\n - NEW: Automatic detection of time discontiguities\n \n - NEW: Applies TCP_USER_TIMEOUT for Linux tcp keepalive where available\n \n - QA: 1600 tests run on each commit in Travis CI, including almost all\n Autobahn in client and server mode, various h2load tests, h2spec,\n the minimal example selftests and others.\n\n - QA: fix small warnings introduced on gcc8.x (eg, Fedora 28)\n \n - QA: Add most of -Wextra on gcc (-Wsign-compare, -Wignored-qualifiers,\n -Wtype-limits, -Wuninitialized)\n \n - QA: clean out warnings on windows\n \n - QA: pass all 146 h2spec tests now on strict\n \n - QA: introduce 35 selftests that operate different minimal examples against\n each other and confirm the results.\n \n - QA: LWS_WITH_MINIMAL_EXAMPLES allows mass build of all relevant minimal-\n examples with the LWS build, for CI and to make all the example binaries\n available from the lws build dir ./bin\n \n - REFACTOR: the lws source directory layout in ./lib has been radically\n improved, and there are now files in selected subdirs with extra\n documentation of interest to people working on lws itself.\n\n - REFACTOR: pipelined transactions return to the event loop before starting the\n next part. \n \n - REFACTOR: TLS: replace all TLS library constants with generic LWS ones and\n adapt all the TLS library code to translate to these common ones.\n \n Isolated all the tls-related private stuff in `./lib/tls/private.h`, and all\n the mbedTLS stuff in `./lib/tls/mbedtls` + openSSL stuff in\n `./lib/tls/openssl`\n \n - REFACTOR: the various kinds of wsi possible with lws have been extracted\n from the main code and isolated into \u0022roles\u0022 in `./lib/roles` which\n communicate with the core code via an ops struct. Everything related to\n ah is migrated to the http role.\n \n wsi modes are eliminated and replaced by the ops pointer for the role the\n wsi is performing. Generic states for wsi are available to control the\n lifecycle using core code.\n \n Adding new \u0022roles\u0022 is now much easier with the changes and ops struct to\n plug into.\n\n - REFACTOR: reduce four different kinds of buffer management in lws into a\n generic scatter-gather struct lws_buflist. \n\n - REFACTOR: close notifications go through event loop\n\n\nv2.4.0\n\u003d\u003d\u003d\u003d\u003d\u003d\n\n - HTTP/2 server support is now mature and usable! LWS_WITH_HTTP2\u003d1 enables it.\n Uses ALPN to serve HTTP/2, HTTP/1 and ws[s] connections all from the same\n listen port seamlessly. (Requires ALPN-capable OpenSSL 1.1 or mbedTLS).\n\n - LWS_WITH_MBEDTLS\u003d1 at CMake now builds and works against mbedTLS instead of\n OpenSSL. Most things work identically, although on common targets where\n OpenSSL has acceleration, mbedTLS is many times slower in operation. However\n it is a lot smaller codewise.\n \n - Generic hash apis introduced that work the same on mbedTLS or OpenSSL backend\n \n - LWS_WITH_PEER_LIMITS tracks IPs across all vhosts and allows restrictions on\n both the number of simultaneous connections and wsi in use for any single IP\n\n - lws_ring apis provide a generic single- or multi-tail ringbuffer... mirror\n protocol now uses this. Features include ring elements may be sized to fit\n structs in the ringbuffer, callback when no tail any longer needs an element\n and it can be deleted, and zerocopy options to write new members directly\n into the ringbuffer, and use the ringbuffer element by address too.\n \n - abstract ssh 2 server plugin included, with both plugin and standalone\n demos provided. You can bind the plugin to a vhost and also serve full-\n strength ssh from the vhost. IO from the ssh server is controlled by an\n \u0022ops\u0022 struct of callbacks for tx, rx, auth etc.\n \n - Many fixes, cleanups, source refactors and other improvements.\n\n\nv2.3.0\n\u003d\u003d\u003d\u003d\u003d\u003d\n\n - ESP32 OpenSSL support for client and server\n\n - ESP32 4 x WLAN credential slots may be configured\n\n - Libevent event loop support\n\n - SOCKS5 proxy support\n\n - lws_meta protocol for websocket connection multiplexing\n\n - lws_vhost_destroy() added... allows dynamic removal of listening\n vhosts. Vhosts with shared listen sockets adopt the listen socket\n automatically if the owner is destroyed.\n\n - IPv6 on Windows\n\n - Improved CGI handling suitable for general CGI scripting, eg, PHP\n\n - Convert even the \u0022old style\u0022 test servers to use statically included\n plugin sources\n\n - LWS_WITH_STATS cmake option dumps resource usage and timing information\n every few seconds to debug log, including latency information about\n delay from asking for writeable callback to getting it\n\n - Large (\u003e 2GB) files may be served\n\n - LWS_WITH_HTTP_PROXY Cmake option adds proxying mounts\n\n - Workaround for libev build by disabling -Werror on the test app\n\n - HTTP2 support disabled since no way to serve websockets on it\n\n\nv2.2.0\n\u003d\u003d\u003d\u003d\u003d\u003d\n\nMajor new features\n\n - A mount can be protected by Basic Auth... in lwsws it looks like this\n\n ```\n{\n \u0022mountpoint\u0022: \u0022/basic-auth\u0022,\n \u0022origin\u0022: \u0022file://_lws_ddir_/libwebsockets-test-server/private\u0022,\n \u0022basic-auth\u0022: \u0022/var/www/balogins-private\u0022\n}\n```\n\nThe text file named in `basic-auth` contains user:password information\none per line.\n\nSee for more information.\n\n - RFC7233 RANGES support in lws server... both single and multipart.\n This allows seeking for multimedia file serving and download resume.\n It's enabled by default but can be disabled by CMake option.\n\n - On Linux, lwsws can reload configuration without dropping ongoing\n connections, when sent a SIGHUP. The old configuration drops its\n listen sockets so the new configuration can listen on them.\n New connections connect to the server instance with the new\n configuration. When all old connections eventually close, the old\n instance automatically exits. This is equivalent to\n `systemctl reload apache`\n\n - New `adopt` api allow adoption including SSL negotiation and\n for raw sockets and file descriptors.\n\n - Chunked transfer encoding supported for client and server\n\n - Adaptations to allow operations inside OPTEE Secure World\n\n - ESP32 initial port - able to do all test server functions. See\n\n\n - Serving gzipped files from inside a ZIP file is supported... this\n includes directly serving the gzipped content if the client\n indicated it could accept it (ie, almost all browsers) saving\n bandwidth and time. For clients that can't accept it, lws\n automatically decompresses and serves the content in memory-\n efficient chunks. Only a few hundred bytes of heap are needed\n to serve any size file from inside the zip. See\n\n - RAW file descriptors may now be adopted into the lws event loop,\n independent of event backend (including poll service).\n See\n\n - RAW server socket descriptors may now be enabled on the vhost if\n the first thing sent on the connection is not a valid http method.\n The user code can associate these with a specific protocol per\n vhost, and RAW-specific callbacks appear there for creation, rx,\n writable and close. See libwebsockets-test-server-v2.0 for an example.\n See\n\n - RAW client connections are now possible using the method \u0022RAW\u0022.\n After connection, the socket is associated to the protocol\n named in the client connection info and RAW-specific callbacks\n appear there for creation, rx, writable and close.\n See libwebsockets-test-client (with raw://) for an example.\n See\n\n\nv2.1.0\n\u003d\u003d\u003d\u003d\u003d\u003d\n\nMajor new features\n\n - Support POST arguments, including multipart and file attachment\n\n - Move most of lwsws into lws, make the stub CC0\n\n - Add loopback test plugin to confirm client ws / http coexistence\n\n - Integrate lwsws testing on Appveyor (ie, windows)\n\n - Introduce helpers for sql, urlencode and urldecode sanitation\n\n - Introduce LWS_CALLBACK_HTTP_BIND_PROTOCOL / DROP_PROTOCOL that\n are compatible with http:/1.1 pipelining and different plugins\n owning different parts of the URL space\n\n - lwsgs - Generic Sessions plugin supports serverside sessions,\n cookies, hashed logins, forgot password etc\n\n - Added APIs for sending email to SMTP servers\n\n - Messageboard example plugin for lwsgs\n\n - Automatic PING sending at fixed intervals and close if no response\n\n - Change default header limit in ah to 4096 (from 1024)\n\n - Add SNI matching for wildcards if no specific wildcard vhost name match\n\n - Convert docs to Doxygen\n\n - ESP8266 support ^^\n\nFixes\n-----\n\nSee git log v2.0.0..\n\n\n\nv2.0.0\n\u003d\u003d\u003d\u003d\u003d\u003d\n\nSummary\n-------\n\n - There are only api additions, the api is compatible with v1.7.x. But\n there is necessarily an soname bump to 8.\n \n - If you are using lws client, you mainly need to be aware the option\n LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT is needed at context-creation time\n if you will use SSL.\n \n - If you are using lws for serving, the above is also true but there are\n many new features to simplify your code (and life). There is a\n summany online here\n \n\n \n but basically the keywords are vhosts, mounts and plugins. You can now\n do the web serving part from lws without any user callback code at all.\n See ./test-server/test-server-v2.0.c for an example, it has no user\n code for ws either since it uses the protocol plugins... that one C file\n is all that is needed to do the whole test server function.\n \n You now have the option to use a small generic ws-capable webserver\n \u0022lwsws\u0022 and write your ws part as a plugin. That eliminates even\n cut-and-pasting the test server code and offers more configurable\n features like control over http cacheability in JSON.\n\n\nFixes\n-----\n\nThese are already in 1.7.x series\n\n1) MAJOR (Windows-only) fix assert firing\n\n2) MAJOR http:/1.1 connections handled by lws_return_http_status() did not\nget sent a content-length resulting in the link hanging until the peer closed\nit. updated to add a test for this.\n\n3) MINOR An error about hdr struct in _lws_ws_related is corrected, it's not\nknown to affect anything until after it was fixed\n\n4) MINOR During the close shutdown wait state introduced at v1.7, if something\nrequests callback on writeable for the socket it will busywait until the\nsocket closes\n\n5) MAJOR Although the test server has done it for a few versions already, it\nis now required for the user code to explicitly call\n\n\tif (lws_http_transaction_completed(wsi))\n\t\treturn -1;\n\nwhen it finishes replying to a transaction in http. Previously the library\ndid it for you, but that disallowed large, long transfers with multiple\ntrips around the event loop (and cgi...).\n\n6) MAJOR connections on ah waiting list that closed did not get removed from\nthe waiting list...\n\n7) MAJOR since we added the ability to hold an ah across http keepalive\ntransactions where more headers had already arrived, we broke the ability\nto tell if more headers had arrived. Result was if the browser didn't\nclose the keepalive, we retained ah for the lifetime of the keepalive,\nusing up the pool.\n\n8) MAJOR windows-only-POLLHUP was not coming\n\n9) Client should not send ext hdr if no exts\n\nChanges\n-------\n\n1) MINOR test-server gained some new switches\n\n -C \u003cfile\u003e use external SSL cert file\n -K \u003cfile\u003e use external SSL key file\n -A \u003cfile\u003e use external SSL CA cert file\n \n -u \u003cuid\u003e set effective uid\n -g \u003cgid\u003e set effective gid\n\ntogether you can use them like this to have the test-server work with the\nusual purchased SSL certs from an official CA.\n\n --ssl -C your.crt -K your.key -A your.cer -u 99 -g 99\n\n2) MINOR the OpenSSL magic to setup ECDH cipher usage is implemented in the\nlibrary, and the ciphers restricted to use ECDH only.\nUsing this, the lws test server can score an A at SSLLABS test\n\n3) MINOR STS (SSL always) header is added to the test server if you use --ssl. With\nthat, we score A+ at SSLLABS test\n\n4) MINOR daemonize function (disabled at cmake by default) is updated to work\nwith systemd\n\n5) MINOR example systemd .service file now provided for test server\n(not installed by default)\n\n6) test server html is updated with tabs and a new live server monitoring\nfeature. Input sanitization added to the js.\n\n7) client connections attempted when no ah is free no longer fail, they are\njust deferred until an ah becomes available.\n\n8) The test client pays attention to if you give it an http:/ or https://\nprotocol string to its argument in URL format. If so, it stays in http[s]\nclient mode and doesn't upgrade to ws[s], allowing you to do generic http client\noperations. Receiving transfer-encoding: chunked is supported.\n\n9) If you enable -DLWS_WITH_HTTP_PROXY\u003d1 at cmake, the test server has a\nnew URI path http://localhost:7681/proxytest If you visit here, a client\nconnection to is spawned, and the results piped on\nto your original connection.\n\n10) Also with LWS_WITH_HTTP_PROXY enabled at cmake, lws wants to link to an\nadditional library, \u0022libhubbub\u0022. This allows lws to do html rewriting on the\nfly, adjusting proxied urls in a lightweight and fast way.\n\n11) There's a new context creation flag LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT,\nthis is included automatically if you give any other SSL-related option flag.\nIf you give no SSL-related option flag, nor this one directly, then even\nthough SSL support may be compiled in, it is never initialized nor used for the\nwhole lifetime of the lws context.\n\nConversely in order to prepare the context to use SSL, even though, eg, you\nare not listening on SSL but will use SSL client connections later, you must\ngive this flag explicitly to make sure SSL is initialized.\n\n\nUser API additions\n------------------\n\n1) MINOR APIBREAK There's a new member in struct lws_context_creation_info, ecdh_curve,\nwhich lets you set the name of the ECDH curve OpenSSL should use. By\ndefault (if you leave ecdh_curve NULL) it will use \u0022prime256v1\u0022\n\n2) MINOR NEWAPI It was already possible to adopt a foreign socket that had not\nbeen read from using lws_adopt_socket() since v1.7. Now you can adopt a\npartially-used socket if you don't need SSL, by passing it what you read\nso it can drain that before reading from the socket.\n\nLWS_VISIBLE LWS_EXTERN struct lws *\nlws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,\n\t\tconst char *readbuf, size_t len);\n\n3) MINOR NEWAPI CGI type \u0022network io\u0022 subprocess execution is now possible from\na simple api.\n\nLWS_VISIBLE LWS_EXTERN int\nlws_cgi(struct lws *wsi, char * const *exec_array, int script_uri_path_len,\n int timeout_secs);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_cgi_kill(struct lws *wsi);\n\nTo use it, you must first set the cmake option\n\n$ cmake .. -DLWS_WITH_CGI\u003d1\n\nSee test-server-http.c and test server path\n\nhttp://localhost:7681/cgitest\n\nstdin gets http body, you can test it with wget\n\n$ echo hello \u003e hello.txt\n$ wget http://localhost:7681/cgitest --post-file\u003dhello.txt -O- --quiet\nlwstest script\nread\u003d\u0022hello\u0022\n\nThe test script returns text/html table showing /proc/meminfo. But the cgi\nsupport is complete enough to run cgit cgi.\n\n4) There is a helper api for forming logging timestamps\n\nLWS_VISIBLE int\nlwsl_timestamp(int level, char *p, int len)\n\nthis generates this kind of timestamp for use as logging preamble\n\nlwsts[13116]: [2016/01/25 14:52:52:8386] NOTICE: Initial logging level 7\n\n5) struct lws_client_connect_info has a new member\n\n const char *method\n \nIf it's NULL, then everything happens as before, lws_client_connect_via_info()\nmakes a ws or wss connection to the address given.\n\nIf you set method to a valid http method like \u0022GET\u0022, though, then this method\nis used and the connection remains in http[s], it's not upgraded to ws[s].\n\nSo with this, you can perform http[s] client operations as well as ws[s] ones.\n\nThere are 4 new related callbacks\n\n\tLWS_CALLBACK_ESTABLISHED_CLIENT_HTTP\t\t\t\u003d 44,\n\tLWS_CALLBACK_CLOSED_CLIENT_HTTP\t\t\t\t\u003d 45,\n\tLWS_CALLBACK_RECEIVE_CLIENT_HTTP\t\t\t\u003d 46,\n\tLWS_CALLBACK_COMPLETED_CLIENT_HTTP\t\t\t\u003d 47,\n\n6) struct lws_client_connect_info has a new member\n\n const char *parent_wsi\n \nif non-NULL, the client wsi is set to be a child of parent_wsi. This ensures\nif parent_wsi closes, then the client child is closed just before.\n\n7) If you're using SSL, there's a new context creation-time option flag\nLWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS. If you give this, non-ssl\nconnections to the server listen port are accepted and receive a 301\nredirect to / on the same host and port using https://\n\n8) User code may set per-connection extension options now, using a new api\n\u0022lws_set_extension_option()\u0022.\n\nThis should be called from the ESTABLISHED callback like this\n\n lws_set_extension_option(wsi, \u0022permessage-deflate\u0022,\n \u0022rx_buf_size\u0022, \u002212\u0022); /* 1 \u003c\u003c 12 */\n\nIf the extension is not active (missing or not negotiated for the\nconnection, or extensions are disabled on the library) the call is\njust returns -1. Otherwise the connection's extension has its\nnamed option changed.\n\nThe extension may decide to alter or disallow the change, in the\nexample above permessage-deflate restricts the size of his rx\noutput buffer also considering the protocol's rx_buf_size member.\n\n\nNew application lwsws\n---------------------\n\nA libwebsockets-based general webserver is built by default now, lwsws.\n\nIt's configured by JSON, by default in\n\n /etc/lwsws/conf\n\nwhich contains global lws context settings like this\n\n{\n \u0022global\u0022: {\n \u0022uid\u0022: \u002299\u0022,\n \u0022gid\u0022: \u002299\u0022,\n \u0022interface\u0022: \u0022eth0\u0022,\n \u0022count-threads\u0022: \u00221\u0022\n }\n}\n\n /etc/lwsws/conf.d/*\n\nwhich contains zero or more files describing vhosts, like this\n\n{\n \u0022vhosts\u0022: [\n { \u0022name\u0022: \\u0022,\n \u0022port\u0022: \u0022443\u0022,\n \u0022host-ssl-key\u0022: \u0022/etc/pki/tls/private/\u0022,\n \u0022host-ssl-cert\u0022: \u0022/etc/pki/tls/certs/\u0022,\n \u0022host-ssl-ca\u0022: \u0022/etc/pki/tls/certs/\u0022,\n \u0022mounts\u0022: [\n { \u0022/\u0022: [\n { \u0022home\u0022: \u0022file:///var/www/\u0022 },\n { \u0022default\u0022: \u0022index.html\u0022 }\n ]\n }\n ]\n }\n ]\n}\n\n\n\nv1.7.0\n\u003d\u003d\u003d\u003d\u003d\u003d\n\nExtension Changes\n-----------------\n\n1) There is now a \u0022permessage-deflate\u0022 / RFC7692 implementation. It's very\nsimilar to \u0022deflate-frame\u0022 we have offered for a long while; deflate-frame is\nnow provided as an alias of permessage-deflate.\n\nThe main differences are that the new permessage-deflate implementation:\n\n - properly performs streaming respecting input and output buffer limits. The\n old deflate-frame implementation could only work on complete deflate input\n and produce complete inflate output for each frame. The new implementation\n only mallocs buffers at initialization.\n\n - goes around the event loop after each input package is processed allowing\n interleaved output processing. The RX flow control api can be used to\n force compressed input processing to match the rate of compressed output\n processing (test--echo shows an example of how to do this).\n\n - when being \u0022deflate-frame\u0022 for compatibility he uses the same default zlib\n settings as the old \u0022deflate-frame\u0022, but instead of exponentially increasing\n malloc allocations until the whole output will fit, he observes the default\n input and output chunking buffer sizes of \u0022permessage-deflate\u0022, that's\n 1024 in and 1024 out at a time.\n\n2) deflate-stream has been disabled for many versions (for over a year) and is\nnow removed. Browsers are now standardizing on \u0022permessage-deflate\u0022 / RFC7692\n\n3) struct lws_extension is simplified, and lws extensions now have a public\napi (their callback) for use in user code to compose extensions and options\nthe user code wants. lws_get_internal_exts() is deprecated but kept around\nas a NOP. The changes allow one extension implementation to go by different\nnames and allows the user client code to control option offers per-ext.\n\nThe test client and server are updated to use the new way. If you use\nthe old way it should still work, but extensions will be disabled until you\nupdate your code.\n\nExtensions are now responsible for allocating and per-instance private struct\nat instance construction time and freeing it when the instance is destroyed.\nNot needing to know the size means the extension's struct can be opaque\nto user code.\n\n\nUser api additions\n------------------\n\n1) The info struct gained three new members\n\n - max_http_header_data: 0 for default (1024) or set the maximum amount of known\n http header payload that lws can deal with. Payload in unknown http\n headers is dropped silently. If for some reason you need to send huge\n cookies or other HTTP-level headers, you can now increase this at context-\n creation time.\n\n - max_http_header_pool: 0 for default (16) or set the maximum amount of http\n headers that can be tracked by lws in this context. For the server, if\n the header pool is completely in use then accepts on the listen socket\n are disabled until one becomes free. For the client, if you simultaneously\n have pending connects for more than this number of client connections,\n additional connects will fail until some of the pending connections timeout\n or complete.\n\n - timeout_secs: 0 for default (currently 20s), or set the library's\n network activity timeout to the given number of seconds\n\nHTTP header processing in lws only exists until just after the first main\ncallback after the HTTP handshake... for ws connections that is ESTABLISHED and\nfor HTTP connections the HTTP callback.\n\nSo these settings are not related to the maximum number of simultaneous\nconnections, but the number of HTTP handshakes that may be expected or ongoing,\nor have just completed, at one time. The reason it's useful is it changes the\nmemory allocation for header processing to be one-time at context creation\ninstead of every time there is a new connection, and gives you control over\nthe peak allocation.\n\nSetting max_http_header_pool to 1 is fine it will just queue incoming\nconnections before the accept as necessary, you can still have as many\nsimultaneous post-header connections as you like. Since the http header\nprocessing is completed and the allocation released after ESTABLISHED or the\nHTTP callback, even with a pool of 1 many connections can be handled rapidly.\n\n2) There is a new callback that allows the user code to get acccess to the\noptional close code + aux data that may have been sent by the peer.\n\nLWS_CALLBACK_WS_PEER_INITIATED_CLOSE:\n The peer has sent an unsolicited Close WS packet. @in and\n @len are the optional close code (first 2 bytes, network\n order) and the optional additional information which is not\n defined in the standard, and may be a string or non-human-\n readble data.\n If you return 0 lws will echo the close and then close the\n connection. If you return nonzero lws will just close the\n connection.\n\nAs usual not handling it does the right thing, if you're not interested in it\njust ignore it.\n\nThe test server has \u0022open and close\u0022 testing buttons at the bottom, if you\nopen and close that connection, on close it will send a close code 3000 decimal\nand the string \u0022Bye!\u0022 as the aux data.\n\nThe test server dumb-increment callback handles this callback reason and prints\n\nlwsts[15714]: LWS_CALLBACK_WS_PEER_INITIATED_CLOSE: len 6\nlwsts[15714]: 0: 0x0B\nlwsts[15714]: 1: 0xB8\nlwsts[15714]: 2: 0x42\nlwsts[15714]: 3: 0x79\nlwsts[15714]: 4: 0x65\nlwsts[15714]: 5: 0x21\n\n3) There is a new API to allow the user code to control the content of the\nclose frame sent when about to return nonzero from the user callback to\nindicate the connection should close.\n\n/**\n * lws_close_reason - Set reason and aux data to send with Close packet\n *\t\tIf you are going to return nonzero from the callback\n *\t\trequesting the connection to close, you can optionally\n *\t\tcall this to set the reason the peer will be told if\n *\t\tpossible.\n *\n * @wsi:\tThe websocket connection to set the close reason on\n * @status:\tA valid close status from websocket standard\n * @buf:\tNULL or buffer containing up to 124 bytes of auxiliary data\n * @len:\tLength of data in @buf to send\n */\nLWS_VISIBLE LWS_EXTERN void\nlws_close_reason(struct lws *wsi, enum lws_close_status status,\n\t\t unsigned char *buf, size_t len);\n\nAn extra button is added to the \u0022open and close\u0022 test server page that requests\nthat the test server close the connection from his end.\n\nThe test server code will do so by\n\n\t\t\tlws_close_reason(wsi, LWS_CLOSE_STATUS_GOINGAWAY,\n\t\t\t\t\t (unsigned char *)\u0022seeya\u0022, 5);\n\t\t\treturn -1;\n\nThe browser shows the close code and reason he received\n\nwebsocket connection CLOSED, code: 1001, reason: seeya\n\n4) There's a new context creation time option flag\n\nLWS_SERVER_OPTION_VALIDATE_UTF8\n\nif you set it in info-\u003eoptions, then TEXT and CLOSE frames will get checked to\nconfirm that they contain valid UTF-8. If they don't, the connection will get\nclosed by lws.\n\n5) ECDH Certs are now supported. Enable the CMake option\n\ncmake .. -DLWS_SSL_SERVER_WITH_ECDH_CERT\u003d1 \n\n**and** the info-\u003eoptions flag\n\nLWS_SERVER_OPTION_SSL_ECDH\n\nto build in support and select it at runtime.\n\n6) There's a new api lws_parse_uri() that simplifies chopping up\nhttps://xxx:yyy/zzz uris into parts nicely. The test client now uses this\nto allow proper uris as well as the old address style.\n\n7) SMP support is integrated into LWS without any internal threading. It's\nvery simple to use, libwebsockets-test-server-pthread shows how to do it,\nuse -j \u003cn\u003e argument there to control the number of service threads up to 32.\n\nTwo new members are added to the info struct\n\n\tunsigned int count_threads;\n\tunsigned int fd_limit_per_thread;\n\t\nleave them at the default 0 to get the normal singlethreaded service loop.\n\nSet count_threads to n to tell lws you will have n simultaneous service threads\noperating on the context.\n\nThere is still a single listen socket on one port, no matter how many\nservice threads.\n\nWhen a connection is made, it is accepted by the service thread with the least\nconnections active to perform load balancing.\n\nThe user code is responsible for spawning n threads running the service loop\nassociated to a specific tsi (Thread Service Index, 0 .. n - 1). See\nthe libwebsockets-test-server-pthread for how to do.\n\nIf you leave fd_limit_per_thread at 0, then the process limit of fds is shared\nbetween the service threads; if you process was allowed 1024 fds overall then\neach thread is limited to 1024 / n.\n\nYou can set fd_limit_per_thread to a nonzero number to control this manually, eg\nthe overall supported fd limit is less than the process allowance.\n\nYou can control the context basic data allocation for multithreading from Cmake\nusing -DLWS_MAX_SMP\u003d, if not given it's set to 32. The serv_buf allocation\nfor the threads (currently 4096) is made at runtime only for active threads.\n\nBecause lws will limit the requested number of actual threads supported\naccording to LWS_MAX_SMP, there is an api lws_get_count_threads(context) to\ndiscover how many threads were actually allowed when the context was created.\n\nIt's required to implement locking in the user code in the same way that\nlibwebsockets-test-server-pthread does it, for the FD locking callbacks.\n\nIf LWS_MAX_SMP\u003d1, then there is no code related to pthreads compiled in the\nlibrary. If more than 1, a small amount of pthread mutex code is built into\nthe library.\n\n8) New API\n\nLWS_VISIBLE struct lws *\nlws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd)\n\nallows foreign sockets accepted by non-lws code to be adopted by lws as if they\nhad just been accepted by lws' own listen socket.\n\n9) X-Real-IP: header has been added as WSI_TOKEN_HTTP_X_REAL_IP\n\n10) Libuv support is added, there are new related user apis\n\ntypedef void (lws_uv_signal_cb_t)(uv_loop_t *l, uv_signal_t *w, int revents);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_uv_sigint_cfg(struct lws_context *context, int use_uv_sigint,\n\t\t lws_uv_signal_cb_t *cb);\n\nLWS_VISIBLE LWS_EXTERN int\nlws_uv_initloop(struct lws_context *context, uv_loop_t *loop, int tsi);\n\nLWS_VISIBLE void\nlws_uv_sigint_cb(uv_loop_t *loop, uv_signal_t *watcher, int revents);\n\nand CMAKE option\n\nLWS_WITH_LIBUV\n\n\nUser api changes\n----------------\n\n1) LWS_SEND_BUFFER_POST_PADDING is now 0 and deprecated. You can remove it; if\nyou still use it, obviously it does nothing. Old binary code with nonzero\nLWS_SEND_BUFFER_POST_PADDING is perfectly compatible, the old code just\nallocated a buffer bigger than the library is going to use.\n\nThe example apps no longer use LWS_SEND_BUFFER_POST_PADDING.\n\nThe only path who made use of it was sending with LWS_WRITE_CLOSE ---\u003e\n\n2) Because of lws_close_reason() formalizing handling close frames,\nLWS_WRITE_CLOSE is removed from libwebsockets.h. It was only of use to send\nclose frames...close frame content should be managed using lws_close_reason()\nnow.\n\n3) We check for invalid CLOSE codes and complain about protocol violation in\nour close code. But it changes little since we were in the middle of closing\nanyway.\n\n4) zero-length RX frames and zero length TX frames are now allowed.\n\n5) Pings and close used to be limited to 124 bytes, the correct limit is 125\nso that is now also allowed.\n\n6) LWS_PRE is provided as a synonym for LWS_SEND_BUFFER_PRE_PADDING, either is\nvalid to use now.\n\n7) There's generic support for RFC7462 style extension options built into the\nlibrary now. As a consequence, a field \u0022options\u0022 is added to lws_extension.\nIt can be NULL if there are no options on the extension. Extension internal\ninfo is part of the public abi because extensions may be implemented outside\nthe library.\n\n8) WSI_TOKEN_PROXY enum was accidentally defined to collide with another token\nof value 73. That's now corrected and WSI_TOKEN_PROXY moved to his own place at\n77.\n\n9) With the addition of libuv support, libev is not the only event loop\nlibrary in town and his api names must be elaborated with _ev_\n\n Callback typedef: lws_signal_cb ---\u003e lws_ev_signal_cb_t\n lws_sigint_cfg --\u003e lws_ev_sigint_cfg\n lws_initloop --\u003e lws_ev_initloop\n lws_sigint_cb --\u003e lws_ev_sigint_cb\n\n10) Libev support is made compatible with multithreaded service,\nlws_ev_initloop (was lws_initloop) gets an extra argument for the\nthread service index (use 0 if you will just have 1 service thread).\n\nLWS_VISIBLE LWS_EXTERN int\nlws_ev_initloop(struct lws_context *context, ev_loop_t *loop, int tsi);\n\n\n(for earlier changelogs, see the tagged releases)\n","s":{"c":1635259488,"u": 1780}} ],"g": 11766,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 1, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}