Andy Green | a35c86f | 2013-01-31 10:16:44 +0800 | [diff] [blame] | 1 | Changelog |
| 2 | --------- |
| 3 | |
Andy Green | eda102e | 2018-12-13 20:05:12 +0800 | [diff] [blame^] | 4 | - CHANGE: REMOVED: LWS_WITH_GENRSA, LWS_WITH_GENHASH, LWS_WITH_GENEC, |
| 5 | LWS_WITH_GENAES have all been removed and combined into LWS_WITH_GENCRYPTO |
| 6 | |
| 7 | - CHANGE: REMOVED: LWS_WITH_JWS, LWS_WITH_JWE have been removed and combined |
| 8 | into LWS_WITH_JOSE |
| 9 | |
Andy Green | ac03254 | 2018-11-16 09:10:41 +0800 | [diff] [blame] | 10 | v3.1.0 |
| 11 | ====== |
| 12 | |
Andy Green | 502130d | 2018-05-10 16:13:26 +0800 | [diff] [blame] | 13 | - CHANGE: REMOVED: lws_client_connect() and lws_client_connect_extended() |
| 14 | compatibility apis for lws_client_connect_via_info() have been marked as |
| 15 | deprecated for several versions and are now removed. Use |
Andy Green | ac03254 | 2018-11-16 09:10:41 +0800 | [diff] [blame] | 16 | lws_client_connect_via_info() directly instead. |
Andy Green | 502130d | 2018-05-10 16:13:26 +0800 | [diff] [blame] | 17 | |
Andy Green | ac03254 | 2018-11-16 09:10:41 +0800 | [diff] [blame] | 18 | - CHANGE: CMAKE: |
| 19 | - LWS_WITH_HTTP2: now defaults ON |
| 20 | |
Andy Green | d9f982a | 2018-11-19 07:40:47 +0800 | [diff] [blame] | 21 | - CHANGE: Minimal examples updated to use Content Security Policy best |
| 22 | practices, using |
| 23 | `LWS_SERVER_OPTION_HTTP_HEADERS_SECURITY_BEST_PRACTICES_ENFORCE` vhost |
Andy Green | 9bed6d6 | 2018-11-23 08:47:56 +0800 | [diff] [blame] | 24 | option flag and disabling of inline style and scripts. A side-effect of |
| 25 | this is that buffers used to marshal headers have to be prepared to take |
| 26 | more content than previously... LWS_RECOMMENDED_MIN_HEADER_SPACE (2048 |
| 27 | currently) is available for user (and internal) use to logically tie the |
| 28 | buffer size to this usecase (and follow future increases). |
Andy Green | d9f982a | 2018-11-19 07:40:47 +0800 | [diff] [blame] | 29 | |
Andy Green | ac03254 | 2018-11-16 09:10:41 +0800 | [diff] [blame] | 30 | - NEW: CMAKE |
| 31 | - LWS_FOR_GITOHASHI: sets various cmake options suitable for gitohashi |
| 32 | - LWS_WITH_ASAN: for Linux, enable build with ASAN |
| 33 | |
| 34 | Don't forget LWS_WITH_DISTRO_RECOMMENDED, which enables a wide range of lws |
| 35 | options suitable for a distro build of the library. |
| 36 | |
| 37 | - NEW: lws threadpool - lightweight pool of pthreads integrated to lws wsi, with |
| 38 | all synchronization to event loop handled internally, queue for excess tasks |
| 39 | [threadpool docs](https://libwebsockets.org/git/libwebsockets/tree/lib/misc/threadpool) |
| 40 | [threadpool minimal example](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/ws-server/minimal-ws-server-threadpool) |
| 41 | Cmake config: `-DLWS_WITH_THREADPOOL=1` |
| 42 | |
| 43 | - NEW: libdbus support integrated on lws event loop |
| 44 | [lws dbus docs](https://libwebsockets.org/git/libwebsockets/tree/lib/roles/dbus) |
| 45 | [lws dbus client minimal examples](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/dbus-client) |
| 46 | [lws dbus server minimal examples](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/dbus-server) |
| 47 | Cmake config: `-DLWS_ROLE_DBUS=1` |
| 48 | |
| 49 | - NEW: lws allocated chunks (lwsac) - helpers for optimized mass allocation of small |
| 50 | objects inside a few larger malloc chunks... if you need to allocate a lot of |
| 51 | inter-related structs for a limited time, this removes per-struct allocation |
| 52 | library overhead completely and removes the need for any destruction handling |
| 53 | [lwsac docs](https://libwebsockets.org/git/libwebsockets/tree/lib/misc/lwsac) |
| 54 | [lwsac minimal example](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/api-tests/api-test-lwsac) |
| 55 | Cmake Config: `-DLWS_WITH_LWSAC=1` |
| 56 | |
| 57 | - NEW: lws tokenizer - helper api for robustly tokenizing your own strings without |
| 58 | allocating or adding complexity. Configurable by flags for common delimiter |
| 59 | sets and comma-separated-lists in the tokenizer. Detects and reports syntax |
| 60 | errors. |
| 61 | [lws_tokenize docs](https://libwebsockets.org/git/libwebsockets/tree/include/libwebsockets/lws-tokenize.h) |
| 62 | [lws_tokenize minimal example / api test](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/api-tests/api-test-lws_tokenize) |
| 63 | |
| 64 | - NEW: lws full-text search - optimized trie generation, serialization, |
| 65 | autocomplete suggestion generation and instant global search support extensible |
| 66 | to huge corpuses of UTF-8 text while remaining super lightweight on resources. |
| 67 | [full-text search docs](https://libwebsockets.org/git/libwebsockets/tree/lib/misc/fts) |
| 68 | [full-text search minimal example / api test](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/api-tests/api-test-fts) |
| 69 | [demo](https://libwebsockets.org/ftsdemo/) |
| 70 | [demo sources](https://libwebsockets.org/git/libwebsockets/tree/plugins/protocol_fulltext_demo.c) |
| 71 | Cmake config: `-DLWS_WITH_FTS=1 -DLWS_WITH_LWSAC=1` |
| 72 | |
| 73 | - NEW: gzip + brotli http server-side compression - h1 and h2 automatic advertising |
| 74 | of server compression and application to files with mimetypes "text/*", |
| 75 | "application/javascript" and "image/svg.xml". |
| 76 | Cmake config: `-DLWS_WITH_HTTP_STREAM_COMPRESSION=1`, `-DLWS_WITH_HTTP_BROTLI=1` |
| 77 | |
| 78 | - NEW: managed disk cache - API for managing a directory containing cached files |
| 79 | with hashed names, and automatic deletion of LRU files once the cache is |
| 80 | above a given limit. |
| 81 | [lws diskcache docs](https://libwebsockets.org/git/libwebsockets/tree/include/libwebsockets/lws-diskcache.h) |
| 82 | Cmake config: `-DLWS_WITH_DISKCACHE=1` |
| 83 | |
| 84 | - NEW: http reverse proxy - lws mounts support proxying h1 or h2 requests to |
| 85 | a local or remote IP, or unix domain socket over h1. This allows microservice |
| 86 | type architectures where parts of the common URL space are actually handled |
| 87 | by external processes which may be remote or on the same machine. |
| 88 | [lws gitohashi serving](https://libwebsockets.org/git/) is handled this way. |
| 89 | CMake config: `-DLWS_WITH_HTTP_PROXY=1` |
| 90 | |
| 91 | - NEW: lws_buflist - internally several types of ad-hoc malloc'd buffer have |
| 92 | been replaced by a new, exported api `struct lws_buflist`. This allows |
| 93 | multiple buffers to be chained and drawn down in strict FIFO order. |
| 94 | |
| 95 | - NEW: In the case of h1 upgrade, the connection header is checked to contain |
| 96 | "upgrade". The vhost flag LWS_SERVER_OPTION_VHOST_UPG_STRICT_HOST_CHECK |
| 97 | also causes the Host: header to be confirmed to match the vhost name and |
| 98 | listen port. |
Andy Green | c027c3d | 2018-11-21 06:46:23 +0800 | [diff] [blame] | 99 | |
| 100 | - NEW: If no 404 redirect for `lws_return_http_status()` is specified for the vhost, |
| 101 | the status page produced will try to bring in a stylesheet `/error.css`. This allows |
| 102 | you to produce styled 404 or other error pages with logos, graphics etc. See |
| 103 | https://libwebsockets.org/git/badrepo for an example of what you can do with it. |
Andy Green | 502130d | 2018-05-10 16:13:26 +0800 | [diff] [blame] | 104 | |
Andy Green | 1c08a96 | 2018-05-04 13:27:12 +0800 | [diff] [blame] | 105 | v3.0.0 |
| 106 | ====== |
| 107 | |
| 108 | - CHANGE: Clients used to call LWS_CALLBACK_CLOSED same as servers... |
| 109 | LWS_CALLBACK_CLIENT_CLOSED has been introduced and is called for clients |
| 110 | now. |
| 111 | |
| 112 | - CHANGE: LWS_CALLBACK_CLIENT_CONNECTION_ERROR used to only be directed at |
| 113 | protocols[0]. However in many cases, the protocol to bind to was provided |
| 114 | at client connection info time and the wsi bound accordingly. In those |
| 115 | cases, CONNECTION_ERROR is directed at the bound protocol, not protcols[0] |
| 116 | any more. |
| 117 | |
| 118 | - CHANGE: CMAKE: the following cmake defaults have changed with this version: |
| 119 | |
| 120 | - LWS_WITH_ZIP_FOPS: now defaults OFF |
| 121 | - LWS_WITH_RANGES: now defaults OFF |
| 122 | - LWS_WITH_ZLIB: now defaults OFF |
| 123 | - LWS_WITHOUT_EXTENSIONS: now defaults ON |
| 124 | |
| 125 | - CHANGE: REMOVED: lws_alloc_vfs_file() (read a file to malloc buffer) |
| 126 | |
| 127 | - CHANGE: REMOVED: lws_read() (no longer useful outside of lws internals) |
| 128 | |
| 129 | - CHANGE: REMOVED: ESP8266... ESP32 is now within the same price range and much |
| 130 | more performant |
| 131 | |
| 132 | - CHANGE: soname bump... don't forget to `ldconfig` |
| 133 | |
| 134 | - NEW: all event libraries support "foreign" loop integration where lws itself |
| 135 | if just a temporary user of the loop unrelated to the actual loop lifecycle. |
| 136 | |
| 137 | See `minimal-http-server-eventlib-foreign` for example code demonstrating |
| 138 | this for all the event libraries. |
| 139 | |
| 140 | Internal loop in lws is also supported and demonstrated by |
| 141 | `minimal-http-server-eventlib`. |
| 142 | |
| 143 | - NEW: ws-over-h2 support. This is a new RFC-on-the-way supported by Chrome |
| 144 | and shortly firefox that allows ws connections to be multiplexed back to the |
| 145 | server on the same tcp + tls wrapper h2 connection that the html and scripts |
| 146 | came in on. This is hugely faster that discrete connections. |
| 147 | |
| 148 | - NEW: UDP socket adoption and related event callbacks |
| 149 | |
| 150 | - NEW: Multi-client connection binding, queuing and pipelining support. |
| 151 | |
| 152 | Lws detects multiple client connections to the same server and port, and |
| 153 | optimizes how it handles them according to the server type and provided |
| 154 | flags. For http/1.0, all occur with individual parallel connections. For |
| 155 | http/1.1, you can enable keepalive pipelining, so the connections occur |
| 156 | sequentially on a single network connection. For http/2, they all occur |
| 157 | as parallel streams within a single h2 network connection. |
| 158 | |
| 159 | See minimal-http-client-multi for example code. |
| 160 | |
| 161 | - NEW: High resolution timer API for wsi, get a callback on your wsi with |
| 162 | LWS_CALLBACK_TIMER, set and reset the timer with lws_set_timer_usecs(wsi, us) |
| 163 | Actual resolution depends on event backend. Works with all backends, poll, |
| 164 | libuv, libevent, and libev. |
| 165 | |
| 166 | - NEW: Protocols can arrange vhost-protocol instance specific callbacks with |
| 167 | second resolution using `lws_timed_callback_vh_protocol()` |
| 168 | |
| 169 | - NEW: ACME client plugin for self-service TLS certificates |
| 170 | |
| 171 | - NEW: RFC7517 JSON Web Keys RFC7638 JWK thumbprint, and RFC7515 JSON Web |
| 172 | signatures support |
| 173 | |
| 174 | - NEW: lws_cancel_service() now provides a generic way to synchronize events |
| 175 | from other threads, which appear as a LWS_CALLBACK_EVENT_WAIT_CANCELLED |
| 176 | callback on all protocols. This is compatible with all the event libraries. |
| 177 | |
| 178 | - NEW: support BSD poll() where changes to the poll wait while waiting are |
| 179 | undone. |
| 180 | |
| 181 | - NEW: Introduce generic hash, hmac and RSA apis that operate the same |
| 182 | regardless of OpenSSL or mbedTLS tls backend |
| 183 | |
| 184 | - NEW: Introduce X509 element query api that works the same regardless of |
| 185 | OpenSSL or mbedTLS tls backend |
| 186 | |
| 187 | - NEW: Introduce over 30 "minimal examples" in ./minimal-examples... these |
| 188 | replace most of the old test servers |
| 189 | |
| 190 | - test-echo -> minimal-ws-server-echo and minimal-ws-client-echo |
| 191 | |
| 192 | - test-server-libuv / -libevent / -libev -> |
| 193 | minimal-https-server-eventlib / -eventlib-foreign / -eventlib-demos |
| 194 | |
| 195 | - test-server-v2.0 -> folded into all the minimal servers |
| 196 | |
| 197 | - test-server direct http serving -> minimal-http-server-dynamic |
| 198 | |
| 199 | The minimal examples allow individual standalone build using their own |
| 200 | small CMakeLists.txt. |
| 201 | |
| 202 | - NEW: lws now detects any back-to-back writes that did not go through the |
| 203 | event loop inbetween and reports them. This will flag any possibility of |
| 204 | failure rather than wait until the problem happens. |
| 205 | |
| 206 | - NEW: CMake has LWS_WITH_DISTRO_RECOMMENDED to select features that are |
| 207 | appropriate for distros |
| 208 | |
| 209 | - NEW: Optional vhost URL `error_document_404` if given causes a redirect there |
| 210 | instead of serve the default 404 page. |
| 211 | |
| 212 | - NEW: lws_strncpy() wrapper guarantees NUL in copied string even if it was |
| 213 | truncated to fit. |
| 214 | |
| 215 | - NEW: for client connections, local protocol binding name can be separated |
| 216 | from the ws subprotocol name if needed, using .local_protocol_name |
| 217 | |
| 218 | - NEW: Automatic detection of time discontiguities |
| 219 | |
| 220 | - NEW: Applies TCP_USER_TIMEOUT for Linux tcp keepalive where available |
| 221 | |
| 222 | - QA: 1600 tests run on each commit in Travis CI, including almost all |
| 223 | Autobahn in client and server mode, various h2load tests, h2spec, attack.sh |
| 224 | the minimal example selftests and others. |
| 225 | |
| 226 | - QA: fix small warnings introduced on gcc8.x (eg, Fedora 28) |
| 227 | |
| 228 | - QA: Add most of -Wextra on gcc (-Wsign-compare, -Wignored-qualifiers, |
| 229 | -Wtype-limits, -Wuninitialized) |
| 230 | |
| 231 | - QA: clean out warnings on windows |
| 232 | |
| 233 | - QA: pass all 146 h2spec tests now on strict |
| 234 | |
| 235 | - QA: introduce 35 selftests that operate different minimal examples against |
| 236 | each other and confirm the results. |
| 237 | |
| 238 | - QA: LWS_WITH_MINIMAL_EXAMPLES allows mass build of all relevant minimal- |
| 239 | examples with the LWS build, for CI and to make all the example binaries |
| 240 | available from the lws build dir ./bin |
| 241 | |
| 242 | - REFACTOR: the lws source directory layout in ./lib has been radically |
| 243 | improved, and there are now README.md files in selected subdirs with extra |
| 244 | documentation of interest to people working on lws itself. |
| 245 | |
| 246 | - REFACTOR: pipelined transactions return to the event loop before starting the |
| 247 | next part. |
| 248 | |
| 249 | - REFACTOR: TLS: replace all TLS library constants with generic LWS ones and |
| 250 | adapt all the TLS library code to translate to these common ones. |
| 251 | |
| 252 | Isolated all the tls-related private stuff in `./lib/tls/private.h`, and all |
| 253 | the mbedTLS stuff in `./lib/tls/mbedtls` + openSSL stuff in |
| 254 | `./lib/tls/openssl` |
| 255 | |
| 256 | - REFACTOR: the various kinds of wsi possible with lws have been extracted |
| 257 | from the main code and isolated into "roles" in `./lib/roles` which |
| 258 | communicate with the core code via an ops struct. Everything related to |
| 259 | ah is migrated to the http role. |
| 260 | |
| 261 | wsi modes are eliminated and replaced by the ops pointer for the role the |
| 262 | wsi is performing. Generic states for wsi are available to control the |
| 263 | lifecycle using core code. |
| 264 | |
| 265 | Adding new "roles" is now much easier with the changes and ops struct to |
| 266 | plug into. |
| 267 | |
| 268 | - REFACTOR: reduce four different kinds of buffer management in lws into a |
| 269 | generic scatter-gather struct lws_buflist. |
| 270 | |
| 271 | - REFACTOR: close notifications go through event loop |
| 272 | |
| 273 | |
Andy Green | fcf5b2c | 2017-10-16 20:09:58 +0800 | [diff] [blame] | 274 | v2.4.0 |
| 275 | ====== |
| 276 | |
| 277 | - HTTP/2 server support is now mature and usable! LWS_WITH_HTTP2=1 enables it. |
| 278 | Uses ALPN to serve HTTP/2, HTTP/1 and ws[s] connections all from the same |
| 279 | listen port seamlessly. (Requires ALPN-capable OpenSSL 1.1 or mbedTLS). |
| 280 | |
| 281 | - LWS_WITH_MBEDTLS=1 at CMake now builds and works against mbedTLS instead of |
| 282 | OpenSSL. Most things work identically, although on common targets where |
| 283 | OpenSSL has acceleration, mbedTLS is many times slower in operation. However |
| 284 | it is a lot smaller codewise. |
| 285 | |
| 286 | - Generic hash apis introduced that work the same on mbedTLS or OpenSSL backend |
| 287 | |
| 288 | - LWS_WITH_PEER_LIMITS tracks IPs across all vhosts and allows restrictions on |
| 289 | both the number of simultaneous connections and wsi in use for any single IP |
| 290 | |
| 291 | - lws_ring apis provide a generic single- or multi-tail ringbuffer... mirror |
| 292 | protocol now uses this. Features include ring elements may be sized to fit |
| 293 | structs in the ringbuffer, callback when no tail any longer needs an element |
| 294 | and it can be deleted, and zerocopy options to write new members directly |
| 295 | into the ringbuffer, and use the ringbuffer element by address too. |
| 296 | |
| 297 | - abstract ssh 2 server plugin included, with both plugin and standalone |
| 298 | demos provided. You can bind the plugin to a vhost and also serve full- |
| 299 | strength ssh from the vhost. IO from the ssh server is controlled by an |
| 300 | "ops" struct of callbacks for tx, rx, auth etc. |
| 301 | |
| 302 | - Many fixes, cleanups, source refactors and other improvements. |
| 303 | |
| 304 | |
Andy Green | e6bd629 | 2017-07-28 14:13:42 +0800 | [diff] [blame] | 305 | v2.3.0 |
| 306 | ====== |
| 307 | |
| 308 | - ESP32 OpenSSL support for client and server |
| 309 | |
| 310 | - ESP32 4 x WLAN credential slots may be configured |
| 311 | |
| 312 | - Libevent event loop support |
| 313 | |
| 314 | - SOCKS5 proxy support |
| 315 | |
| 316 | - lws_meta protocol for websocket connection multiplexing |
| 317 | |
| 318 | - lws_vhost_destroy() added... allows dynamic removal of listening |
| 319 | vhosts. Vhosts with shared listen sockets adopt the listen socket |
| 320 | automatically if the owner is destroyed. |
| 321 | |
| 322 | - IPv6 on Windows |
| 323 | |
| 324 | - Improved CGI handling suitable for general CGI scripting, eg, PHP |
| 325 | |
| 326 | - Convert even the "old style" test servers to use statically included |
| 327 | plugin sources |
| 328 | |
| 329 | - LWS_WITH_STATS cmake option dumps resource usage and timing information |
| 330 | every few seconds to debug log, including latency information about |
| 331 | delay from asking for writeable callback to getting it |
| 332 | |
| 333 | - Large (> 2GB) files may be served |
| 334 | |
| 335 | - LWS_WITH_HTTP_PROXY Cmake option adds proxying mounts |
| 336 | |
| 337 | - Workaround for libev build by disabling -Werror on the test app |
| 338 | |
| 339 | - HTTP2 support disabled since no way to serve websockets on it |
| 340 | |
| 341 | |
Andy Green | 6be573f | 2017-03-06 15:35:45 +0800 | [diff] [blame] | 342 | v2.2.0 |
| 343 | ====== |
| 344 | |
| 345 | Major new features |
| 346 | |
| 347 | - A mount can be protected by Basic Auth... in lwsws it looks like this |
| 348 | |
| 349 | ``` |
| 350 | { |
| 351 | "mountpoint": "/basic-auth", |
| 352 | "origin": "file://_lws_ddir_/libwebsockets-test-server/private", |
| 353 | "basic-auth": "/var/www/balogins-private" |
| 354 | } |
| 355 | ``` |
| 356 | |
| 357 | The text file named in `basic-auth` contains user:password information |
| 358 | one per line. |
| 359 | |
| 360 | See README.lwsws.md for more information. |
| 361 | |
| 362 | - RFC7233 RANGES support in lws server... both single and multipart. |
| 363 | This allows seeking for multimedia file serving and download resume. |
| 364 | It's enabled by default but can be disabled by CMake option. |
| 365 | |
| 366 | - On Linux, lwsws can reload configuration without dropping ongoing |
| 367 | connections, when sent a SIGHUP. The old configuration drops its |
| 368 | listen sockets so the new configuration can listen on them. |
| 369 | New connections connect to the server instance with the new |
| 370 | configuration. When all old connections eventually close, the old |
| 371 | instance automatically exits. This is equivalent to |
| 372 | `systemctl reload apache` |
| 373 | |
| 374 | - New `adopt` api allow adoption including SSL negotiation and |
| 375 | for raw sockets and file descriptors. |
| 376 | |
| 377 | - Chunked transfer encoding supported for client and server |
| 378 | |
| 379 | - Adaptations to allow operations inside OPTEE Secure World |
| 380 | |
| 381 | - ESP32 initial port - able to do all test server functions. See |
| 382 | README.build.md |
| 383 | |
| 384 | - Serving gzipped files from inside a ZIP file is supported... this |
| 385 | includes directly serving the gzipped content if the client |
| 386 | indicated it could accept it (ie, almost all browsers) saving |
| 387 | bandwidth and time. For clients that can't accept it, lws |
| 388 | automatically decompresses and serves the content in memory- |
| 389 | efficient chunks. Only a few hundred bytes of heap are needed |
| 390 | to serve any size file from inside the zip. See README.coding.md |
| 391 | |
| 392 | - RAW file descriptors may now be adopted into the lws event loop, |
| 393 | independent of event backend (including poll service). |
| 394 | See README.coding.md |
| 395 | |
| 396 | - RAW server socket descriptors may now be enabled on the vhost if |
| 397 | the first thing sent on the connection is not a valid http method. |
| 398 | The user code can associate these with a specific protocol per |
| 399 | vhost, and RAW-specific callbacks appear there for creation, rx, |
| 400 | writable and close. See libwebsockets-test-server-v2.0 for an example. |
| 401 | See README.coding.md |
| 402 | |
| 403 | - RAW client connections are now possible using the method "RAW". |
| 404 | After connection, the socket is associated to the protocol |
| 405 | named in the client connection info and RAW-specific callbacks |
| 406 | appear there for creation, rx, writable and close. |
| 407 | See libwebsockets-test-client (with raw://) for an example. |
| 408 | See README.coding.md |
| 409 | |
| 410 | |
Andy Green | 7355750 | 2016-10-06 21:48:20 +0800 | [diff] [blame] | 411 | v2.1.0 |
| 412 | ====== |
| 413 | |
| 414 | Major new features |
| 415 | |
| 416 | - Support POST arguments, including multipart and file attachment |
| 417 | |
| 418 | - Move most of lwsws into lws, make the stub CC0 |
| 419 | |
| 420 | - Add loopback test plugin to confirm client ws / http coexistence |
| 421 | |
| 422 | - Integrate lwsws testing on Appveyor (ie, windows) |
| 423 | |
| 424 | - Introduce helpers for sql, urlencode and urldecode sanitation |
| 425 | |
| 426 | - Introduce LWS_CALLBACK_HTTP_BIND_PROTOCOL / DROP_PROTOCOL that |
| 427 | are compatible with http:/1.1 pipelining and different plugins |
| 428 | owning different parts of the URL space |
| 429 | |
| 430 | - lwsgs - Generic Sessions plugin supports serverside sessions, |
| 431 | cookies, hashed logins, forgot password etc |
| 432 | |
| 433 | - Added APIs for sending email to SMTP servers |
| 434 | |
| 435 | - Messageboard example plugin for lwsgs |
| 436 | |
| 437 | - Automatic PING sending at fixed intervals and close if no response |
| 438 | |
| 439 | - Change default header limit in ah to 4096 (from 1024) |
| 440 | |
| 441 | - Add SNI matching for wildcards if no specific wildcard vhost name match |
| 442 | |
| 443 | - Convert docs to Doxygen |
| 444 | |
| 445 | - ESP8266 support ^^ |
| 446 | |
Enno Boland | 7731a3e | 2016-05-05 22:08:41 +0200 | [diff] [blame] | 447 | Fixes |
| 448 | ----- |
| 449 | |
Andy Green | 7355750 | 2016-10-06 21:48:20 +0800 | [diff] [blame] | 450 | See git log v2.0.0.. |
Enno Boland | 7731a3e | 2016-05-05 22:08:41 +0200 | [diff] [blame] | 451 | |
Andy Green | fb8be05 | 2016-05-12 19:39:29 +0800 | [diff] [blame] | 452 | |
Enno Boland | 7731a3e | 2016-05-05 22:08:41 +0200 | [diff] [blame] | 453 | |
Andy Green | 5500643 | 2016-05-05 09:40:18 +0800 | [diff] [blame] | 454 | v2.0.0 |
| 455 | ====== |
| 456 | |
| 457 | Summary |
| 458 | ------- |
| 459 | |
| 460 | - There are only api additions, the api is compatible with v1.7.x. But |
| 461 | there is necessarily an soname bump to 8. |
| 462 | |
| 463 | - If you are using lws client, you mainly need to be aware the option |
| 464 | LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT is needed at context-creation time |
| 465 | if you will use SSL. |
| 466 | |
| 467 | - If you are using lws for serving, the above is also true but there are |
| 468 | many new features to simplify your code (and life). There is a |
| 469 | summany online here |
| 470 | |
| 471 | https://libwebsockets.org/lws-2.0-new-features.html |
| 472 | |
| 473 | but basically the keywords are vhosts, mounts and plugins. You can now |
| 474 | do the web serving part from lws without any user callback code at all. |
| 475 | See ./test-server/test-server-v2.0.c for an example, it has no user |
| 476 | code for ws either since it uses the protocol plugins... that one C file |
| 477 | is all that is needed to do the whole test server function. |
| 478 | |
| 479 | You now have the option to use a small generic ws-capable webserver |
| 480 | "lwsws" and write your ws part as a plugin. That eliminates even |
| 481 | cut-and-pasting the test server code and offers more configurable |
| 482 | features like control over http cacheability in JSON. |
| 483 | |
| 484 | |
Andy Green | 0c3cc2e | 2016-02-20 09:12:52 +0800 | [diff] [blame] | 485 | Fixes |
| 486 | ----- |
| 487 | |
Andy Green | 5500643 | 2016-05-05 09:40:18 +0800 | [diff] [blame] | 488 | These are already in 1.7.x series |
| 489 | |
Andy Green | 0c3cc2e | 2016-02-20 09:12:52 +0800 | [diff] [blame] | 490 | 1) MAJOR (Windows-only) fix assert firing |
| 491 | |
| 492 | 2) MAJOR http:/1.1 connections handled by lws_return_http_status() did not |
| 493 | get sent a content-length resulting in the link hanging until the peer closed |
| 494 | it. attack.sh updated to add a test for this. |
| 495 | |
Andy Green | 26d4249 | 2016-02-24 12:40:21 +0800 | [diff] [blame] | 496 | 3) MINOR An error about hdr struct in _lws_ws_related is corrected, it's not |
| 497 | known to affect anything until after it was fixed |
| 498 | |
Andy Green | 5c0bcf4 | 2016-02-24 21:27:46 +0800 | [diff] [blame] | 499 | 4) MINOR During the close shutdown wait state introduced at v1.7, if something |
| 500 | requests callback on writeable for the socket it will busywait until the |
| 501 | socket closes |
| 502 | |
Andy Green | dbfbbb4 | 2016-02-24 20:58:19 +0800 | [diff] [blame] | 503 | 5) MAJOR Although the test server has done it for a few versions already, it |
| 504 | is now required for the user code to explicitly call |
| 505 | |
| 506 | if (lws_http_transaction_completed(wsi)) |
| 507 | return -1; |
| 508 | |
| 509 | when it finishes replying to a transaction in http. Previously the library |
| 510 | did it for you, but that disallowed large, long transfers with multiple |
| 511 | trips around the event loop (and cgi...). |
| 512 | |
Andy Green | 4ba798d | 2016-02-25 21:50:49 +0800 | [diff] [blame] | 513 | 6) MAJOR connections on ah waiting list that closed did not get removed from |
| 514 | the waiting list... |
| 515 | |
Andy Green | 83af28a | 2016-02-28 10:55:31 +0800 | [diff] [blame] | 516 | 7) MAJOR since we added the ability to hold an ah across http keepalive |
| 517 | transactions where more headers had already arrived, we broke the ability |
| 518 | to tell if more headers had arrived. Result was if the browser didn't |
| 519 | close the keepalive, we retained ah for the lifetime of the keepalive, |
| 520 | using up the pool. |
| 521 | |
Andy Green | 442e1c8 | 2016-02-29 10:10:42 +0800 | [diff] [blame] | 522 | 8) MAJOR windows-only-POLLHUP was not coming |
| 523 | |
Andy Green | 4f5ebec | 2016-03-09 23:13:31 +0800 | [diff] [blame] | 524 | 9) Client should not send ext hdr if no exts |
Andy Green | dbfbbb4 | 2016-02-24 20:58:19 +0800 | [diff] [blame] | 525 | |
Andy Green | 0c3cc2e | 2016-02-20 09:12:52 +0800 | [diff] [blame] | 526 | Changes |
| 527 | ------- |
| 528 | |
| 529 | 1) MINOR test-server gained some new switches |
| 530 | |
| 531 | -C <file> use external SSL cert file |
| 532 | -K <file> use external SSL key file |
| 533 | -A <file> use external SSL CA cert file |
| 534 | |
| 535 | -u <uid> set effective uid |
| 536 | -g <gid> set effective gid |
| 537 | |
| 538 | together you can use them like this to have the test-server work with the |
| 539 | usual purchased SSL certs from an official CA. |
| 540 | |
| 541 | --ssl -C your.crt -K your.key -A your.cer -u 99 -g 99 |
| 542 | |
| 543 | 2) MINOR the OpenSSL magic to setup ECDH cipher usage is implemented in the |
| 544 | library, and the ciphers restricted to use ECDH only. |
| 545 | Using this, the lws test server can score an A at SSLLABS test |
| 546 | |
| 547 | 3) MINOR STS (SSL always) header is added to the test server if you use --ssl. With |
| 548 | that, we score A+ at SSLLABS test |
| 549 | |
| 550 | 4) MINOR daemonize function (disabled at cmake by default) is updated to work |
| 551 | with systemd |
| 552 | |
| 553 | 5) MINOR example systemd .service file now provided for test server |
| 554 | (not installed by default) |
| 555 | |
Andy Green | 0ad1a6e | 2016-02-20 14:05:55 +0800 | [diff] [blame] | 556 | 6) test server html is updated with tabs and a new live server monitoring |
| 557 | feature. Input sanitization added to the js. |
| 558 | |
Andy Green | 2d8d35a | 2016-02-29 14:19:16 +0800 | [diff] [blame] | 559 | 7) client connections attempted when no ah is free no longer fail, they are |
| 560 | just deferred until an ah becomes available. |
| 561 | |
Andy Green | a661ee5 | 2016-02-29 13:18:30 +0800 | [diff] [blame] | 562 | 8) The test client pays attention to if you give it an http:/ or https:// |
| 563 | protocol string to its argument in URL format. If so, it stays in http[s] |
| 564 | client mode and doesn't upgrade to ws[s], allowing you to do generic http client |
Andy Green | 5c8906e | 2016-03-13 16:44:19 +0800 | [diff] [blame] | 565 | operations. Receiving transfer-encoding: chunked is supported. |
Andy Green | a661ee5 | 2016-02-29 13:18:30 +0800 | [diff] [blame] | 566 | |
Andy Green | 1e5a9ad | 2016-03-20 11:59:53 +0800 | [diff] [blame] | 567 | 9) If you enable -DLWS_WITH_HTTP_PROXY=1 at cmake, the test server has a |
| 568 | new URI path http://localhost:7681/proxytest If you visit here, a client |
| 569 | connection to http://example.com:80 is spawned, and the results piped on |
| 570 | to your original connection. |
| 571 | |
| 572 | 10) Also with LWS_WITH_HTTP_PROXY enabled at cmake, lws wants to link to an |
| 573 | additional library, "libhubbub". This allows lws to do html rewriting on the |
| 574 | fly, adjusting proxied urls in a lightweight and fast way. |
Andy Green | fb5f33b | 2016-03-01 07:19:01 +0800 | [diff] [blame] | 575 | |
Andy Green | c6fd360 | 2016-03-23 09:22:11 +0800 | [diff] [blame] | 576 | 11) There's a new context creation flag LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT, |
| 577 | this is included automatically if you give any other SSL-related option flag. |
| 578 | If you give no SSL-related option flag, nor this one directly, then even |
| 579 | though SSL support may be compiled in, it is never initialized nor used for the |
| 580 | whole lifetime of the lws context. |
| 581 | |
| 582 | Conversely in order to prepare the context to use SSL, even though, eg, you |
| 583 | are not listening on SSL but will use SSL client connections later, you must |
| 584 | give this flag explicitly to make sure SSL is initialized. |
| 585 | |
Andy Green | 2d8d35a | 2016-02-29 14:19:16 +0800 | [diff] [blame] | 586 | |
Andy Green | d7fddad | 2016-02-18 20:36:55 +0800 | [diff] [blame] | 587 | User API additions |
| 588 | ------------------ |
| 589 | |
Andy Green | 0c3cc2e | 2016-02-20 09:12:52 +0800 | [diff] [blame] | 590 | 1) MINOR APIBREAK There's a new member in struct lws_context_creation_info, ecdh_curve, |
Andy Green | d7fddad | 2016-02-18 20:36:55 +0800 | [diff] [blame] | 591 | which lets you set the name of the ECDH curve OpenSSL should use. By |
| 592 | default (if you leave ecdh_curve NULL) it will use "prime256v1" |
| 593 | |
Andy Green | 51d9afa | 2016-02-24 11:05:56 +0800 | [diff] [blame] | 594 | 2) MINOR NEWAPI It was already possible to adopt a foreign socket that had not |
| 595 | been read from using lws_adopt_socket() since v1.7. Now you can adopt a |
| 596 | partially-used socket if you don't need SSL, by passing it what you read |
| 597 | so it can drain that before reading from the socket. |
| 598 | |
| 599 | LWS_VISIBLE LWS_EXTERN struct lws * |
| 600 | lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd, |
| 601 | const char *readbuf, size_t len); |
Andy Green | d7fddad | 2016-02-18 20:36:55 +0800 | [diff] [blame] | 602 | |
Andy Green | 6a8099b | 2016-02-21 21:25:48 +0800 | [diff] [blame] | 603 | 3) MINOR NEWAPI CGI type "network io" subprocess execution is now possible from |
| 604 | a simple api. |
| 605 | |
| 606 | LWS_VISIBLE LWS_EXTERN int |
Andy Green | 1a13885 | 2016-03-20 11:55:25 +0800 | [diff] [blame] | 607 | lws_cgi(struct lws *wsi, char * const *exec_array, int script_uri_path_len, |
| 608 | int timeout_secs); |
Andy Green | 6a8099b | 2016-02-21 21:25:48 +0800 | [diff] [blame] | 609 | |
| 610 | LWS_VISIBLE LWS_EXTERN int |
| 611 | lws_cgi_kill(struct lws *wsi); |
| 612 | |
| 613 | To use it, you must first set the cmake option |
| 614 | |
| 615 | $ cmake .. -DLWS_WITH_CGI=1 |
| 616 | |
| 617 | See test-server-http.c and test server path |
| 618 | |
| 619 | http://localhost:7681/cgitest |
| 620 | |
| 621 | stdin gets http body, you can test it with wget |
| 622 | |
| 623 | $ echo hello > hello.txt |
| 624 | $ wget http://localhost:7681/cgitest --post-file=hello.txt -O- --quiet |
| 625 | lwstest script |
| 626 | read="hello" |
| 627 | |
Andy Green | 1a13885 | 2016-03-20 11:55:25 +0800 | [diff] [blame] | 628 | The test script returns text/html table showing /proc/meminfo. But the cgi |
| 629 | support is complete enough to run cgit cgi. |
| 630 | |
Andy Green | d61bed3 | 2016-02-25 15:01:55 +0800 | [diff] [blame] | 631 | 4) There is a helper api for forming logging timestamps |
| 632 | |
| 633 | LWS_VISIBLE int |
| 634 | lwsl_timestamp(int level, char *p, int len) |
| 635 | |
| 636 | this generates this kind of timestamp for use as logging preamble |
| 637 | |
| 638 | lwsts[13116]: [2016/01/25 14:52:52:8386] NOTICE: Initial logging level 7 |
| 639 | |
Andy Green | a661ee5 | 2016-02-29 13:18:30 +0800 | [diff] [blame] | 640 | 5) struct lws_client_connect_info has a new member |
| 641 | |
| 642 | const char *method |
| 643 | |
| 644 | If it's NULL, then everything happens as before, lws_client_connect_via_info() |
| 645 | makes a ws or wss connection to the address given. |
| 646 | |
| 647 | If you set method to a valid http method like "GET", though, then this method |
| 648 | is used and the connection remains in http[s], it's not upgraded to ws[s]. |
| 649 | |
| 650 | So with this, you can perform http[s] client operations as well as ws[s] ones. |
| 651 | |
| 652 | There are 4 new related callbacks |
| 653 | |
| 654 | LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44, |
| 655 | LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45, |
| 656 | LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46, |
| 657 | LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47, |
Andy Green | 6a8099b | 2016-02-21 21:25:48 +0800 | [diff] [blame] | 658 | |
Andy Green | 494418a | 2016-03-02 09:17:22 +0800 | [diff] [blame] | 659 | 6) struct lws_client_connect_info has a new member |
| 660 | |
| 661 | const char *parent_wsi |
| 662 | |
| 663 | if non-NULL, the client wsi is set to be a child of parent_wsi. This ensures |
| 664 | if parent_wsi closes, then the client child is closed just before. |
| 665 | |
Andy Green | 0f9904f | 2016-03-17 15:26:49 +0800 | [diff] [blame] | 666 | 7) If you're using SSL, there's a new context creation-time option flag |
| 667 | LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS. If you give this, non-ssl |
| 668 | connections to the server listen port are accepted and receive a 301 |
| 669 | redirect to / on the same host and port using https:// |
| 670 | |
Andy Green | c5376b1 | 2016-04-08 09:45:49 +0800 | [diff] [blame] | 671 | 8) User code may set per-connection extension options now, using a new api |
| 672 | "lws_set_extension_option()". |
| 673 | |
| 674 | This should be called from the ESTABLISHED callback like this |
| 675 | |
| 676 | lws_set_extension_option(wsi, "permessage-deflate", |
| 677 | "rx_buf_size", "12"); /* 1 << 12 */ |
| 678 | |
| 679 | If the extension is not active (missing or not negotiated for the |
| 680 | connection, or extensions are disabled on the library) the call is |
| 681 | just returns -1. Otherwise the connection's extension has its |
| 682 | named option changed. |
| 683 | |
| 684 | The extension may decide to alter or disallow the change, in the |
| 685 | example above permessage-deflate restricts the size of his rx |
| 686 | output buffer also considering the protocol's rx_buf_size member. |
| 687 | |
| 688 | |
Andy Green | cd0c696 | 2016-03-28 10:12:37 +0800 | [diff] [blame] | 689 | New application lwsws |
| 690 | --------------------- |
| 691 | |
| 692 | A libwebsockets-based general webserver is built by default now, lwsws. |
| 693 | |
| 694 | It's configured by JSON, by default in |
| 695 | |
| 696 | /etc/lwsws/conf |
| 697 | |
| 698 | which contains global lws context settings like this |
| 699 | |
| 700 | { |
| 701 | "global": { |
| 702 | "uid": "99", |
| 703 | "gid": "99", |
| 704 | "interface": "eth0", |
| 705 | "count-threads": "1" |
| 706 | } |
| 707 | } |
| 708 | |
| 709 | /etc/lwsws/conf.d/* |
| 710 | |
| 711 | which contains zero or more files describing vhosts, like this |
| 712 | |
| 713 | { |
| 714 | "vhosts": [ |
| 715 | { "name": "warmcat.com", |
| 716 | "port": "443", |
| 717 | "host-ssl-key": "/etc/pki/tls/private/warmcat.com.key", |
| 718 | "host-ssl-cert": "/etc/pki/tls/certs/warmcat.com.crt", |
| 719 | "host-ssl-ca": "/etc/pki/tls/certs/warmcat.com.cer", |
| 720 | "mounts": [ |
| 721 | { "/": [ |
| 722 | { "home": "file:///var/www/warmcat.com" }, |
| 723 | { "default": "index.html" } |
| 724 | ] |
| 725 | } |
| 726 | ] |
| 727 | } |
| 728 | ] |
| 729 | } |
| 730 | |
| 731 | |
Andy Green | 0c3cc2e | 2016-02-20 09:12:52 +0800 | [diff] [blame] | 732 | |
Andy Green | 9c60ed9 | 2016-02-16 12:32:18 +0800 | [diff] [blame] | 733 | v1.7.0 |
| 734 | ====== |
| 735 | |
Andy Green | 6711266 | 2016-01-11 11:34:01 +0800 | [diff] [blame] | 736 | Extension Changes |
| 737 | ----------------- |
| 738 | |
| 739 | 1) There is now a "permessage-deflate" / RFC7692 implementation. It's very |
| 740 | similar to "deflate-frame" we have offered for a long while; deflate-frame is |
| 741 | now provided as an alias of permessage-deflate. |
| 742 | |
| 743 | The main differences are that the new permessage-deflate implementation: |
| 744 | |
| 745 | - properly performs streaming respecting input and output buffer limits. The |
| 746 | old deflate-frame implementation could only work on complete deflate input |
| 747 | and produce complete inflate output for each frame. The new implementation |
| 748 | only mallocs buffers at initialization. |
| 749 | |
| 750 | - goes around the event loop after each input package is processed allowing |
| 751 | interleaved output processing. The RX flow control api can be used to |
| 752 | force compressed input processing to match the rate of compressed output |
| 753 | processing (test--echo shows an example of how to do this). |
| 754 | |
| 755 | - when being "deflate-frame" for compatibility he uses the same default zlib |
| 756 | settings as the old "deflate-frame", but instead of exponentially increasing |
| 757 | malloc allocations until the whole output will fit, he observes the default |
| 758 | input and output chunking buffer sizes of "permessage-deflate", that's |
| 759 | 1024 in and 1024 out at a time. |
| 760 | |
| 761 | 2) deflate-stream has been disabled for many versions (for over a year) and is |
| 762 | now removed. Browsers are now standardizing on "permessage-deflate" / RFC7692 |
| 763 | |
| 764 | 3) struct lws_extension is simplified, and lws extensions now have a public |
| 765 | api (their callback) for use in user code to compose extensions and options |
| 766 | the user code wants. lws_get_internal_exts() is deprecated but kept around |
| 767 | as a NOP. The changes allow one extension implementation to go by different |
| 768 | names and allows the user client code to control option offers per-ext. |
| 769 | |
| 770 | The test client and server are updated to use the new way. If you use |
| 771 | the old way it should still work, but extensions will be disabled until you |
| 772 | update your code. |
| 773 | |
| 774 | Extensions are now responsible for allocating and per-instance private struct |
| 775 | at instance construction time and freeing it when the instance is destroyed. |
| 776 | Not needing to know the size means the extension's struct can be opaque |
| 777 | to user code. |
| 778 | |
| 779 | |
Andy Green | 3df5800 | 2015-12-25 12:44:12 +0800 | [diff] [blame] | 780 | User api additions |
| 781 | ------------------ |
| 782 | |
Andy Green | 200a6a2 | 2016-02-15 20:36:02 +0800 | [diff] [blame] | 783 | 1) The info struct gained three new members |
Andy Green | 3df5800 | 2015-12-25 12:44:12 +0800 | [diff] [blame] | 784 | |
| 785 | - max_http_header_data: 0 for default (1024) or set the maximum amount of known |
| 786 | http header payload that lws can deal with. Payload in unknown http |
| 787 | headers is dropped silently. If for some reason you need to send huge |
| 788 | cookies or other HTTP-level headers, you can now increase this at context- |
| 789 | creation time. |
| 790 | |
| 791 | - max_http_header_pool: 0 for default (16) or set the maximum amount of http |
| 792 | headers that can be tracked by lws in this context. For the server, if |
| 793 | the header pool is completely in use then accepts on the listen socket |
| 794 | are disabled until one becomes free. For the client, if you simultaneously |
| 795 | have pending connects for more than this number of client connections, |
| 796 | additional connects will fail until some of the pending connections timeout |
| 797 | or complete. |
| 798 | |
Andy Green | 200a6a2 | 2016-02-15 20:36:02 +0800 | [diff] [blame] | 799 | - timeout_secs: 0 for default (currently 20s), or set the library's |
| 800 | network activity timeout to the given number of seconds |
| 801 | |
Andy Green | 3df5800 | 2015-12-25 12:44:12 +0800 | [diff] [blame] | 802 | HTTP header processing in lws only exists until just after the first main |
| 803 | callback after the HTTP handshake... for ws connections that is ESTABLISHED and |
| 804 | for HTTP connections the HTTP callback. |
| 805 | |
| 806 | So these settings are not related to the maximum number of simultaneous |
Andy Green | 3246ebb | 2015-12-26 12:03:06 +0800 | [diff] [blame] | 807 | connections, but the number of HTTP handshakes that may be expected or ongoing, |
Andy Green | 3df5800 | 2015-12-25 12:44:12 +0800 | [diff] [blame] | 808 | or have just completed, at one time. The reason it's useful is it changes the |
| 809 | memory allocation for header processing to be one-time at context creation |
| 810 | instead of every time there is a new connection, and gives you control over |
| 811 | the peak allocation. |
| 812 | |
| 813 | Setting max_http_header_pool to 1 is fine it will just queue incoming |
| 814 | connections before the accept as necessary, you can still have as many |
Andy Green | 5b85e39 | 2015-12-26 13:23:11 +0800 | [diff] [blame] | 815 | simultaneous post-header connections as you like. Since the http header |
| 816 | processing is completed and the allocation released after ESTABLISHED or the |
| 817 | HTTP callback, even with a pool of 1 many connections can be handled rapidly. |
| 818 | |
Andy Green | 066a7a1 | 2015-12-26 15:47:06 +0800 | [diff] [blame] | 819 | 2) There is a new callback that allows the user code to get acccess to the |
| 820 | optional close code + aux data that may have been sent by the peer. |
| 821 | |
| 822 | LWS_CALLBACK_WS_PEER_INITIATED_CLOSE: |
| 823 | The peer has sent an unsolicited Close WS packet. @in and |
| 824 | @len are the optional close code (first 2 bytes, network |
| 825 | order) and the optional additional information which is not |
| 826 | defined in the standard, and may be a string or non-human- |
| 827 | readble data. |
| 828 | If you return 0 lws will echo the close and then close the |
Andy Green | 6711266 | 2016-01-11 11:34:01 +0800 | [diff] [blame] | 829 | connection. If you return nonzero lws will just close the |
| 830 | connection. |
Andy Green | 066a7a1 | 2015-12-26 15:47:06 +0800 | [diff] [blame] | 831 | |
| 832 | As usual not handling it does the right thing, if you're not interested in it |
| 833 | just ignore it. |
| 834 | |
| 835 | The test server has "open and close" testing buttons at the bottom, if you |
| 836 | open and close that connection, on close it will send a close code 3000 decimal |
| 837 | and the string "Bye!" as the aux data. |
| 838 | |
| 839 | The test server dumb-increment callback handles this callback reason and prints |
| 840 | |
| 841 | lwsts[15714]: LWS_CALLBACK_WS_PEER_INITIATED_CLOSE: len 6 |
| 842 | lwsts[15714]: 0: 0x0B |
| 843 | lwsts[15714]: 1: 0xB8 |
| 844 | lwsts[15714]: 2: 0x42 |
| 845 | lwsts[15714]: 3: 0x79 |
| 846 | lwsts[15714]: 4: 0x65 |
| 847 | lwsts[15714]: 5: 0x21 |
| 848 | |
Andy Green | 1fb95e8 | 2015-12-26 17:20:34 +0800 | [diff] [blame] | 849 | 3) There is a new API to allow the user code to control the content of the |
| 850 | close frame sent when about to return nonzero from the user callback to |
| 851 | indicate the connection should close. |
| 852 | |
| 853 | /** |
| 854 | * lws_close_reason - Set reason and aux data to send with Close packet |
| 855 | * If you are going to return nonzero from the callback |
| 856 | * requesting the connection to close, you can optionally |
| 857 | * call this to set the reason the peer will be told if |
| 858 | * possible. |
| 859 | * |
| 860 | * @wsi: The websocket connection to set the close reason on |
| 861 | * @status: A valid close status from websocket standard |
| 862 | * @buf: NULL or buffer containing up to 124 bytes of auxiliary data |
| 863 | * @len: Length of data in @buf to send |
| 864 | */ |
| 865 | LWS_VISIBLE LWS_EXTERN void |
| 866 | lws_close_reason(struct lws *wsi, enum lws_close_status status, |
| 867 | unsigned char *buf, size_t len); |
| 868 | |
| 869 | An extra button is added to the "open and close" test server page that requests |
| 870 | that the test server close the connection from his end. |
| 871 | |
| 872 | The test server code will do so by |
| 873 | |
| 874 | lws_close_reason(wsi, LWS_CLOSE_STATUS_GOINGAWAY, |
| 875 | (unsigned char *)"seeya", 5); |
| 876 | return -1; |
| 877 | |
| 878 | The browser shows the close code and reason he received |
| 879 | |
| 880 | websocket connection CLOSED, code: 1001, reason: seeya |
| 881 | |
Vijay Khurdiya | e73d446 | 2016-01-15 16:21:51 +0800 | [diff] [blame] | 882 | 4) There's a new context creation time option flag |
Andy Green | 44a7f65 | 2015-12-29 11:20:09 +0800 | [diff] [blame] | 883 | |
| 884 | LWS_SERVER_OPTION_VALIDATE_UTF8 |
| 885 | |
| 886 | if you set it in info->options, then TEXT and CLOSE frames will get checked to |
| 887 | confirm that they contain valid UTF-8. If they don't, the connection will get |
| 888 | closed by lws. |
| 889 | |
Vijay Khurdiya | e73d446 | 2016-01-15 16:21:51 +0800 | [diff] [blame] | 890 | 5) ECDH Certs are now supported. Enable the CMake option |
| 891 | |
| 892 | cmake .. -DLWS_SSL_SERVER_WITH_ECDH_CERT=1 |
| 893 | |
| 894 | **and** the info->options flag |
| 895 | |
Andy Green | ff69648 | 2016-02-17 07:46:27 +0800 | [diff] [blame] | 896 | LWS_SERVER_OPTION_SSL_ECDH |
Vijay Khurdiya | e73d446 | 2016-01-15 16:21:51 +0800 | [diff] [blame] | 897 | |
| 898 | to build in support and select it at runtime. |
| 899 | |
Andy Green | ff69648 | 2016-02-17 07:46:27 +0800 | [diff] [blame] | 900 | 6) There's a new api lws_parse_uri() that simplifies chopping up |
Andy Green | 809d69a | 2016-01-14 11:37:56 +0800 | [diff] [blame] | 901 | https://xxx:yyy/zzz uris into parts nicely. The test client now uses this |
Andy Green | d3a5505 | 2016-01-19 03:34:24 +0800 | [diff] [blame] | 902 | to allow proper uris as well as the old address style. |
| 903 | |
| 904 | 7) SMP support is integrated into LWS without any internal threading. It's |
| 905 | very simple to use, libwebsockets-test-server-pthread shows how to do it, |
| 906 | use -j <n> argument there to control the number of service threads up to 32. |
| 907 | |
| 908 | Two new members are added to the info struct |
| 909 | |
| 910 | unsigned int count_threads; |
| 911 | unsigned int fd_limit_per_thread; |
| 912 | |
| 913 | leave them at the default 0 to get the normal singlethreaded service loop. |
| 914 | |
| 915 | Set count_threads to n to tell lws you will have n simultaneous service threads |
| 916 | operating on the context. |
| 917 | |
| 918 | There is still a single listen socket on one port, no matter how many |
| 919 | service threads. |
| 920 | |
| 921 | When a connection is made, it is accepted by the service thread with the least |
| 922 | connections active to perform load balancing. |
| 923 | |
| 924 | The user code is responsible for spawning n threads running the service loop |
| 925 | associated to a specific tsi (Thread Service Index, 0 .. n - 1). See |
| 926 | the libwebsockets-test-server-pthread for how to do. |
| 927 | |
| 928 | If you leave fd_limit_per_thread at 0, then the process limit of fds is shared |
| 929 | between the service threads; if you process was allowed 1024 fds overall then |
| 930 | each thread is limited to 1024 / n. |
| 931 | |
| 932 | You can set fd_limit_per_thread to a nonzero number to control this manually, eg |
| 933 | the overall supported fd limit is less than the process allowance. |
| 934 | |
| 935 | You can control the context basic data allocation for multithreading from Cmake |
| 936 | using -DLWS_MAX_SMP=, if not given it's set to 32. The serv_buf allocation |
| 937 | for the threads (currently 4096) is made at runtime only for active threads. |
| 938 | |
| 939 | Because lws will limit the requested number of actual threads supported |
| 940 | according to LWS_MAX_SMP, there is an api lws_get_count_threads(context) to |
| 941 | discover how many threads were actually allowed when the context was created. |
| 942 | |
| 943 | It's required to implement locking in the user code in the same way that |
| 944 | libwebsockets-test-server-pthread does it, for the FD locking callbacks. |
| 945 | |
Andy Green | ba119e9 | 2016-01-26 21:40:32 +0800 | [diff] [blame] | 946 | If LWS_MAX_SMP=1, then there is no code related to pthreads compiled in the |
| 947 | library. If more than 1, a small amount of pthread mutex code is built into |
| 948 | the library. |
Andy Green | 809d69a | 2016-01-14 11:37:56 +0800 | [diff] [blame] | 949 | |
Andy Green | ba119e9 | 2016-01-26 21:40:32 +0800 | [diff] [blame] | 950 | 8) New API |
| 951 | |
| 952 | LWS_VISIBLE struct lws * |
| 953 | lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd) |
| 954 | |
| 955 | allows foreign sockets accepted by non-lws code to be adopted by lws as if they |
| 956 | had just been accepted by lws' own listen socket. |
Andy Green | 3df5800 | 2015-12-25 12:44:12 +0800 | [diff] [blame] | 957 | |
Danomi Czaski | 4e9c7f3 | 2016-01-28 09:40:53 +0800 | [diff] [blame] | 958 | 9) X-Real-IP: header has been added as WSI_TOKEN_HTTP_X_REAL_IP |
| 959 | |
Andy Green | 86ed65f | 2016-02-14 09:27:41 +0800 | [diff] [blame] | 960 | 10) Libuv support is added, there are new related user apis |
| 961 | |
| 962 | typedef void (lws_uv_signal_cb_t)(uv_loop_t *l, uv_signal_t *w, int revents); |
| 963 | |
| 964 | LWS_VISIBLE LWS_EXTERN int |
| 965 | lws_uv_sigint_cfg(struct lws_context *context, int use_uv_sigint, |
| 966 | lws_uv_signal_cb_t *cb); |
| 967 | |
| 968 | LWS_VISIBLE LWS_EXTERN int |
| 969 | lws_uv_initloop(struct lws_context *context, uv_loop_t *loop, int tsi); |
| 970 | |
| 971 | LWS_VISIBLE void |
| 972 | lws_uv_sigint_cb(uv_loop_t *loop, uv_signal_t *watcher, int revents); |
| 973 | |
| 974 | and CMAKE option |
| 975 | |
| 976 | LWS_WITH_LIBUV |
| 977 | |
Danomi Czaski | 4e9c7f3 | 2016-01-28 09:40:53 +0800 | [diff] [blame] | 978 | |
Andy Green | 3246ebb | 2015-12-26 12:03:06 +0800 | [diff] [blame] | 979 | User api changes |
| 980 | ---------------- |
| 981 | |
| 982 | 1) LWS_SEND_BUFFER_POST_PADDING is now 0 and deprecated. You can remove it; if |
| 983 | you still use it, obviously it does nothing. Old binary code with nonzero |
| 984 | LWS_SEND_BUFFER_POST_PADDING is perfectly compatible, the old code just |
Andy Green | 5b85e39 | 2015-12-26 13:23:11 +0800 | [diff] [blame] | 985 | allocated a buffer bigger than the library is going to use. |
Andy Green | 3246ebb | 2015-12-26 12:03:06 +0800 | [diff] [blame] | 986 | |
Andy Green | 5b85e39 | 2015-12-26 13:23:11 +0800 | [diff] [blame] | 987 | The example apps no longer use LWS_SEND_BUFFER_POST_PADDING. |
Andy Green | 3246ebb | 2015-12-26 12:03:06 +0800 | [diff] [blame] | 988 | |
Andy Green | 4e2ac76 | 2015-12-26 20:26:11 +0800 | [diff] [blame] | 989 | The only path who made use of it was sending with LWS_WRITE_CLOSE ---> |
Andy Green | 3246ebb | 2015-12-26 12:03:06 +0800 | [diff] [blame] | 990 | |
Andy Green | 1fb95e8 | 2015-12-26 17:20:34 +0800 | [diff] [blame] | 991 | 2) Because of lws_close_reason() formalizing handling close frames, |
| 992 | LWS_WRITE_CLOSE is removed from libwebsockets.h. It was only of use to send |
| 993 | close frames...close frame content should be managed using lws_close_reason() |
| 994 | now. |
| 995 | |
Andy Green | 44a7f65 | 2015-12-29 11:20:09 +0800 | [diff] [blame] | 996 | 3) We check for invalid CLOSE codes and complain about protocol violation in |
| 997 | our close code. But it changes little since we were in the middle of closing |
| 998 | anyway. |
| 999 | |
| 1000 | 4) zero-length RX frames and zero length TX frames are now allowed. |
| 1001 | |
| 1002 | 5) Pings and close used to be limited to 124 bytes, the correct limit is 125 |
| 1003 | so that is now also allowed. |
Andy Green | 3246ebb | 2015-12-26 12:03:06 +0800 | [diff] [blame] | 1004 | |
Steffen Vogel | f926717 | 2016-02-09 07:19:15 +0100 | [diff] [blame] | 1005 | 6) LWS_PRE is provided as a synonym for LWS_SEND_BUFFER_PRE_PADDING, either is |
Andy Green | 6711266 | 2016-01-11 11:34:01 +0800 | [diff] [blame] | 1006 | valid to use now. |
| 1007 | |
| 1008 | 7) There's generic support for RFC7462 style extension options built into the |
| 1009 | library now. As a consequence, a field "options" is added to lws_extension. |
| 1010 | It can be NULL if there are no options on the extension. Extension internal |
| 1011 | info is part of the public abi because extensions may be implemented outside |
| 1012 | the library. |
| 1013 | |
Danomi Czaski | 4e9c7f3 | 2016-01-28 09:40:53 +0800 | [diff] [blame] | 1014 | 8) WSI_TOKEN_PROXY enum was accidentally defined to collide with another token |
| 1015 | of value 73. That's now corrected and WSI_TOKEN_PROXY moved to his own place at |
| 1016 | 77. |
| 1017 | |
Andy Green | 86ed65f | 2016-02-14 09:27:41 +0800 | [diff] [blame] | 1018 | 9) With the addition of libuv support, libev is not the only event loop |
| 1019 | library in town and his api names must be elaborated with _ev_ |
| 1020 | |
| 1021 | Callback typedef: lws_signal_cb ---> lws_ev_signal_cb_t |
| 1022 | lws_sigint_cfg --> lws_ev_sigint_cfg |
| 1023 | lws_initloop --> lws_ev_initloop |
| 1024 | lws_sigint_cb --> lws_ev_sigint_cb |
| 1025 | |
| 1026 | 10) Libev support is made compatible with multithreaded service, |
| 1027 | lws_ev_initloop (was lws_initloop) gets an extra argument for the |
| 1028 | thread service index (use 0 if you will just have 1 service thread). |
| 1029 | |
| 1030 | LWS_VISIBLE LWS_EXTERN int |
Andy Green | ff69648 | 2016-02-17 07:46:27 +0800 | [diff] [blame] | 1031 | lws_ev_initloop(struct lws_context *context, ev_loop_t *loop, int tsi); |
Andy Green | 86ed65f | 2016-02-14 09:27:41 +0800 | [diff] [blame] | 1032 | |
Andy Green | 3df5800 | 2015-12-25 12:44:12 +0800 | [diff] [blame] | 1033 | |
Andy Green | aef3dc4 | 2016-05-06 07:45:19 +0800 | [diff] [blame] | 1034 | (for earlier changelogs, see the tagged releases) |