blob: f6b85d94cbccca7c321f3f08fa18e2ccd053d841 [file] [log] [blame]
Andy Greena35c86f2013-01-31 10:16:44 +08001Changelog
2---------
3
Andy Green54cb3462013-02-14 22:23:54 +08004(development since 1.22)
5
6User api additions
7------------------
8
9 - You can now call libwebsocket_callback_on_writable() on http connectons,
10 and get a LWS_CALLBACK_HTTP_WRITEABLE callback, the same way you can
11 regulate writes with a websocket protocol connection.
12
Andy Green2672fb22013-02-22 09:54:35 +080013 - A new member in the context creation parameter struct "ssl_cipher_list" is
14 added, replacing CIPHERS_LIST_STRING. NULL means use the ssl library
15 default list of ciphers.
16
Andy Green58f214e2013-03-09 13:03:53 +080017 - Not really an api addition, but libwebsocket_service_fd() will now zero
18 the revents field of the pollfd it was called with if it handled the
19 descriptor. So you can tell if it is a non-lws fd by checking revents
20 after the service call... if it's still nonzero, the descriptor
21 belongs to you and you need to take care of it.
22
Andy Greenb55451c2013-03-16 12:32:27 +080023 - libwebsocket_rx_flow_allow_all_protocol(protocol) will unthrottle all
24 connections with the established protocol. It's designed to be
25 called from user server code when it sees it can accept more input
26 and may have throttled connections using the server rx flow apis
27 while it was unable to accept any other input The user server code
28 then does not have to try to track while connections it choked, this
29 will free up all of them in one call.
30
Andy Green0c9563b2013-06-10 22:54:40 +080031 - there's a new, optional callback LWS_CALLBACK_CLOSED_HTTP which gets
32 called when an HTTP protocol socket closes
33
Andy Greenb55451c2013-03-16 12:32:27 +080034
Andy Green50097dd2013-02-15 22:36:30 +080035User api changes
36----------------
37
38 - the external poll callbacks now get the socket descriptor coming from the
39 "in" parameter. The user parameter provides the user_space for the
40 wsi as it normally does on the other callbacks.
Edwin van den Oetelaar8c8a8e12013-02-20 20:56:59 +080041 LWS_CALLBACK_FILTER_NETWORK_CONNECTION also has the socket descriptor
42 delivered by @in now instead of @user.
Andy Green50097dd2013-02-15 22:36:30 +080043
Andy Greenfc7c5e42013-02-23 10:50:10 +080044 - libwebsocket_write() now returns -1 for error, or the amount of data
45 actually accepted for send. Under load, the OS may signal it is
46 ready to send new data on the socket, but have only a restricted
47 amount of memory to buffer the packet compared to usual.
48
Andy Green50097dd2013-02-15 22:36:30 +080049
Andy Greendc914cf2013-02-18 16:54:26 +080050User api removal
51----------------
52
53 - libwebsocket_ensure_user_space() is removed from the public api, if you
54 were using it to get user_space, you need to adapt your code to only
55 use user_space inside the user callback.
56
Andy Green2672fb22013-02-22 09:54:35 +080057 - CIPHERS_LIST_STRING is removed
58
Andy Green0097a992013-03-09 13:06:37 +080059 - autotools build has been removed. See README.build for info on how to
60 use CMake for your platform
61
Andy Green54cb3462013-02-14 22:23:54 +080062
Andy Green53a46782013-02-14 11:23:49 +080063v1.21-chrome26-firefox18
64========================
65
66 - Fixes buffer overflow bug in max frame size handling if you used the
67 default protocol buffer size. If you declared rx_buffer_size in your
68 protocol, which is recommended anyway, your code was unaffected.
69
Andy Green182cb9a2013-02-13 11:54:08 +080070v1.2-chrome26-firefox18
71=======================
72
73Diffstat
74--------
75
76 .gitignore | 16 +++
77 CMakeLists.txt | 544 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
78 LICENSE | 526 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
79 Makefile.am | 1 +
80 README | 20 +++
81 README.build | 258 ++++++++++++++++++++++++++++++++-----
82 README.coding | 52 ++++++++
83 changelog | 136 ++++++++++++++++++++
84 cmake/FindOpenSSLbins.cmake | 33 +++++
85 config.h.cmake | 173 +++++++++++++++++++++++++
86 configure.ac | 22 +++-
87 lib/Makefile.am | 20 ++-
88 lib/base64-decode.c | 2 +-
89 lib/client-handshake.c | 190 +++++++++++-----------------
90 lib/client-parser.c | 88 +++++++------
91 lib/client.c | 384 ++++++++++++++++++++++++++++++-------------------------
92 lib/daemonize.c | 32 +++--
93 lib/extension-deflate-frame.c | 58 +++++----
94 lib/extension-deflate-stream.c | 19 ++-
95 lib/extension-deflate-stream.h | 4 +-
96 lib/extension.c | 11 +-
97 lib/getifaddrs.c | 315 +++++++++++++++++++++++-----------------------
98 lib/getifaddrs.h | 30 ++---
99 lib/handshake.c | 124 +++++++++++-------
100 lib/libwebsockets.c | 736 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------
101 lib/libwebsockets.h | 237 ++++++++++++++++++++++------------
102 lib/output.c | 192 +++++++++++-----------------
103 lib/parsers.c | 966 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------
104 lib/private-libwebsockets.h | 225 +++++++++++++++++++++------------
105 lib/server-handshake.c | 82 ++++++------
106 lib/server.c | 96 +++++++-------
107 libwebsockets-api-doc.html | 189 ++++++++++++++++++----------
108 libwebsockets.spec | 17 +--
109 test-server/attack.sh | 148 ++++++++++++++++++++++
110 test-server/test-client.c | 125 +++++++++---------
111 test-server/test-echo.c | 31 +++--
112 test-server/test-fraggle.c | 32 ++---
113 test-server/test-ping.c | 52 ++++----
114 test-server/test-server.c | 129 ++++++++++++-------
115 win32port/libwebsocketswin32/libwebsocketswin32.vcxproj | 279 ----------------------------------------
116 win32port/libwebsocketswin32/libwebsocketswin32.vcxproj.filters | 23 +++-
117 41 files changed, 4398 insertions(+), 2219 deletions(-)
118
Andy Green7b405452013-02-01 10:50:15 +0800119
120User api additions
121------------------
122
123 - lws_get_library_version() returns a const char * with a string like
124 "1.1 9e7f737", representing the library version from configure.ac
125 and the git HEAD hash the library was built from
126
Andy Greena47865f2013-02-10 09:39:47 +0800127 - TCP Keepalive can now optionally be applied to all lws sockets, on Linux
128 also with controllable timeout, number of probes and probe interval.
129 (On BSD type OS, you can only use system default settings for the
130 timing and retries, although enabling it is supported by setting
131 ka_time to nonzero, the exact value has no meaning.)
132 This enables detection of idle connections which are logically okay,
133 but are in fact dead, due to network connectivity issues at the server,
Andy Greena690cd02013-02-09 12:25:31 +0800134 client, or any intermediary. By default it's not enabled, but you
135 can enable it by setting a non-zero timeout (in seconds) at the new
136 ka_time member at context creation time.
137
Andy Greena7109e62013-02-11 12:05:54 +0800138 - Two new optional user callbacks added, LWS_CALLBACK_PROTOCOL_DESTROY which
139 is called one-time per protocol as the context is being destroyed, and
140 LWS_CALLBACK_PROTOCOL_INIT which is called when the context is created
141 and the protocols are added, again it's a one-time affair.
142 This lets you manage per-protocol allocations properly including
143 cleaning up after yourself when the server goes down.
Andy Green7b405452013-02-01 10:50:15 +0800144
Andy Greened334462013-02-07 21:14:33 +0800145User api changes
146----------------
147
Andy Green1b265272013-02-09 14:01:09 +0800148 - libwebsocket_create_context() has changed from taking a ton of parameters
149 to just taking a pointer to a struct containing the parameters. The
150 struct lws_context_creation_info is in libwebsockets.h, the members
151 are in the same order as when they were parameters to the call
152 previously. The test apps are all updated accordingly so you can
153 see example code there.
154
Andy Greened334462013-02-07 21:14:33 +0800155 - Header tokens are now deleted after the websocket connection is
Andy Green54495112013-02-06 21:10:16 +0900156 established. Not just the header data is saved, but the pointer and
157 length array is also removed from (union) scope saving several hundred
158 bytes per connection once it is established
159
160 - struct libwebsocket_protocols has a new member rx_buffer_size, this
161 controls rx buffer size per connection of that protocol now. Sources
162 for apps built against older versions of the library won't declare
163 this in their protocols, defaulting it to 0. Zero buffer is legal,
164 it causes a default buffer to be allocated (currently 4096)
165
166 If you want to receive only atomic frames in your user callback, you
167 should set this to greater than your largest frame size. If a frame
168 comes that exceeds that, no error occurs but the callback happens as
169 soon as the buffer limit is reached, and again if it is reached again
170 or the frame completes. You can detect that has happened by seeing
171 there is still frame content pending using
172 libwebsockets_remaining_packet_payload()
173
174 By correctly setting this, you can save a lot of memory when your
175 protocol has small frames (see the test server and client sources).
176
Andy Green16ab3182013-02-10 18:02:31 +0800177 - LWS_MAX_HEADER_LEN now defaults to 1024 and is the total amount of known
178 header payload lws can cope with, that includes the GET URL, origin
179 etc. Headers not understood by lws are ignored and their payload
180 not included in this.
181
Andy Green54495112013-02-06 21:10:16 +0900182
183User api removals
184-----------------
185
Andy Green16ab3182013-02-10 18:02:31 +0800186 - The configuration-time option MAX_USER_RX_BUFFER has been replaced by a
187 buffer size chosen per-protocol. For compatibility, there's a default
188 of 4096 rx buffer, but user code should set the appropriate size for
189 the protocol frames.
190
191 - LWS_INITIAL_HDR_ALLOC and LWS_ADDITIONAL_HDR_ALLOC are no longer needed
192 and have been removed. There's a new header management scheme that
193 handles them in a much more compact way.
Andy Greened334462013-02-07 21:14:33 +0800194
Andy Green70edd6f2013-02-12 10:15:25 +0800195 - libwebsockets_hangup_on_client() is removed. If you want to close the
196 connection you must do so from the user callback and by returning
197 -1 from there.
198
Andy Green508946c2013-02-12 10:19:08 +0800199 - libwebsocket_close_and_free_session() is now private to the library code
200 only and not exposed for user code. If you want to close the
201 connection, you must do so from the user callback by returning -1
202 from there.
203
Andy Greened334462013-02-07 21:14:33 +0800204
Andy Greendf60b0c2013-02-06 19:57:12 +0900205New features
206------------
207
Andy Green9b09dc02013-02-08 12:48:36 +0800208 - Cmake project file added, aimed initially at Windows support: this replaces
Andy Green16ab3182013-02-10 18:02:31 +0800209 the visual studio project files that were in the tree until now.
Andy Greendf60b0c2013-02-06 19:57:12 +0900210
Andy Greenc3ef0d62013-02-12 10:50:49 +0800211 - CyaSSL now supported in place of OpenSSL (--use-cyassl on configure)
212
Andy Green9b09dc02013-02-08 12:48:36 +0800213 - PATH_MAX or MAX_PATH no longer needed
Andy Greendf60b0c2013-02-06 19:57:12 +0900214
Andy Green54495112013-02-06 21:10:16 +0900215 - cutomizable frame rx buffer size by protocol
216
Andy Greenc3ef0d62013-02-12 10:50:49 +0800217 - optional TCP keepalive so dead peers can be detected, can be enabled at
218 context-creation time
219
220 - valgrind-clean: no SSL or CyaSSL: completely clean. With OpenSSL, 88 bytes
221 lost at OpenSSL library init and symptomless reports of uninitialized
222 memory usage... seems to be a known and ignored problem at OpenSSL
223
Andy Greena3957ef2013-02-11 09:31:43 +0800224 - By default debug is enabled and the library is built for -O0 -g to faclitate
225 that. Use --disable-debug configure option to build instead with -O4
226 and no -g (debug info), obviously providing best performance and
227 reduced binary size.
Andy Green7b405452013-02-01 10:50:15 +0800228
Andy Green895d56d2013-02-11 09:32:53 +0800229 - 1.0 introduced some code to try to not deflate small frames, however this
230 seems to break when confronted with a mixture of frames above and
231 below the threshold, so it's removed. Veto the compression extension
232 in your user callback if you will typically have very small frames.
233
Andy Green16ab3182013-02-10 18:02:31 +0800234 - There are many memory usage improvements, both a reduction in malloc/
235 realloc and architectural changes. A websocket connection now
236 consumes only 296 bytes with SSL or 272 bytes without on x86_64,
237 during header processing an additional 1262 bytes is allocated in a
238 single malloc, but is freed when the websocket connection starts.
239 The RX frame buffer defined by the protocol in user
240 code is also allocated per connection, this represents the largest
241 frame you can receive atomically in that protocol.
242
Andy Greenc3ef0d62013-02-12 10:50:49 +0800243 - On ARM9 build, just http+ws server no extensions or ssl, <12Kbytes .text
244 and 112 bytes per connection (+1328 only during header processing)
245
Andy Green895d56d2013-02-11 09:32:53 +0800246
Andy Greenbd1132f2013-01-31 19:53:05 +0800247v1.1-chrome26-firefox18
Andy Greena35c86f2013-01-31 10:16:44 +0800248=======================
249
250Diffstat
251--------
252
253 Makefile.am | 4 +
254 README-test-server | 291 ---
255 README.build | 239 ++
256 README.coding | 138 ++
257 README.rst | 72 -
258 README.test-apps | 272 +++
259 configure.ac | 116 +-
260 lib/Makefile.am | 55 +-
261 lib/base64-decode.c | 5 +-
262 lib/client-handshake.c | 121 +-
263 lib/client-parser.c | 394 ++++
264 lib/client.c | 807 +++++++
265 lib/daemonize.c | 212 ++
266 lib/extension-deflate-frame.c | 132 +-
267 lib/extension-deflate-stream.c | 12 +-
268 lib/extension-x-google-mux.c | 1223 ----------
269 lib/extension-x-google-mux.h | 96 -
270 lib/extension.c | 8 -
271 lib/getifaddrs.c | 271 +++
272 lib/getifaddrs.h | 76 +
273 lib/handshake.c | 582 +----
274 lib/libwebsockets.c | 2493 ++++++---------------
275 lib/libwebsockets.h | 115 +-
276 lib/md5.c | 217 --
277 lib/minilex.c | 440 ++++
278 lib/output.c | 628 ++++++
279 lib/parsers.c | 2016 +++++------------
280 lib/private-libwebsockets.h | 284 +--
281 lib/server-handshake.c | 275 +++
282 lib/server.c | 377 ++++
283 libwebsockets-api-doc.html | 300 +--
284 m4/ignore-me | 2 +
285 test-server/Makefile.am | 111 +-
286 test-server/libwebsockets.org-logo.png | Bin 0 -> 7029 bytes
287 test-server/test-client.c | 45 +-
288 test-server/test-echo.c | 330 +++
289 test-server/test-fraggle.c | 20 +-
290 test-server/test-ping.c | 22 +-
291 test-server/test-server-extpoll.c | 554 -----
292 test-server/test-server.c | 349 ++-
293 test-server/test.html | 3 +-
294 win32port/zlib/ZLib.vcxproj | 749 ++++---
295 win32port/zlib/ZLib.vcxproj.filters | 188 +-
296 win32port/zlib/adler32.c | 348 ++-
297 win32port/zlib/compress.c | 160 +-
298 win32port/zlib/crc32.c | 867 ++++----
299 win32port/zlib/crc32.h | 882 ++++----
300 win32port/zlib/deflate.c | 3799 +++++++++++++++-----------------
301 win32port/zlib/deflate.h | 688 +++---
302 win32port/zlib/gzclose.c | 50 +-
303 win32port/zlib/gzguts.h | 325 ++-
304 win32port/zlib/gzlib.c | 1157 +++++-----
305 win32port/zlib/gzread.c | 1242 ++++++-----
306 win32port/zlib/gzwrite.c | 1096 +++++----
307 win32port/zlib/infback.c | 1272 ++++++-----
308 win32port/zlib/inffast.c | 680 +++---
309 win32port/zlib/inffast.h | 22 +-
310 win32port/zlib/inffixed.h | 188 +-
311 win32port/zlib/inflate.c | 2976 +++++++++++++------------
312 win32port/zlib/inflate.h | 244 +-
313 win32port/zlib/inftrees.c | 636 +++---
314 win32port/zlib/inftrees.h | 124 +-
315 win32port/zlib/trees.c | 2468 +++++++++++----------
316 win32port/zlib/trees.h | 256 +--
317 win32port/zlib/uncompr.c | 118 +-
318 win32port/zlib/zconf.h | 934 ++++----
319 win32port/zlib/zlib.h | 3357 ++++++++++++++--------------
320 win32port/zlib/zutil.c | 642 +++---
321 win32port/zlib/zutil.h | 526 ++---
322 69 files changed, 19556 insertions(+), 20145 deletions(-)
323
324user api changes
325----------------
326
327 - libwebsockets_serve_http_file() now takes a context as first argument
328
329 - libwebsockets_get_peer_addresses() now takes a context and wsi as first
330 two arguments
331
332
333user api additions
334------------------
335
336 - lwsl_...() logging apis, default to stderr but retargetable by user code;
337 may be used also by user code
338
339 - lws_set_log_level() set which logging apis are able to emit (defaults to
340 notice, warn, err severities), optionally set the emit callback
341
342 - lwsl_emit_syslog() helper callback emits to syslog
343
344 - lws_daemonize() helper code that forks the app into a headless daemon
345 properly, maintains a lock file with pid in suitable for sysvinit etc to
346 control lifecycle
347
348 - LWS_CALLBACK_HTTP_FILE_COMPLETION callback added since http file
349 transfer is now asynchronous (see test server code)
350
351 - lws_frame_is_binary() from a wsi pointer, let you know if the received
352 data was sent in BINARY mode
353
354
355user api removals
356-----------------
357
358 - libwebsockets_fork_service_loop() - no longer supported (had intractable problems)
359 arrange your code to act from the user callback instead from same
360 process context as the service loop
361
362 - libwebsockets_broadcast() - use libwebsocket_callback_on_writable[_all_protocol]()
363 instead from same process context as the service loop. See the test apps
364 for examples.
365
366 - x-google-mux() removed until someone wants it
367
368 - pre -v13 (ancient) protocol support removed
369
370
371New features
372------------
373
374 - echo test server and client compatible with echo.websocket.org added
375
376 - many new configure options (see README.build) to reduce footprint of the
377 library to what you actually need, eg, --without-client and
378 --without-server
379
380 - http + websocket server can build to as little as 12K .text for ARM
381
382 - no more MAX_CLIENTS limitation; adapts to support the max number of fds
383 allowed to the process by ulimit, defaults to 1024 on Fedora and
384 Ubuntu. Use ulimit to control this without needing to configure
385 the library. Code here is smaller and faster.
386
387 - adaptive ratio of listen socket to connection socket service allows
388 good behaviour under Apache ab test load. Tested with thousands
389 of simultaneous connections
390
391 - reduction in per-connection memory footprint by moving to a union to hold
392 mutually-exclusive state for the connection
393
394 - robustness: Out of Memory taken care of for all allocation code now
395
396 - internal getifaddrs option if your toolchain lacks it (some uclibc)
397
398 - configurable memory limit for deflate operations
399
400 - improvements in SSL code nonblocking operation, possible hang solved,
401 some SSL operations broken down into pollable states so there is
402 no library blocking, timeout coverage for SSL_connect
403
404 - extpoll test server merged into single test server source
405
406 - robustness: library should deal with all recoverable socket conditions
407
408 - rx flowcontrol for backpressure notification fixed and implmeneted
409 correctly in the test server
410
411 - optimal lexical parser added for header processing; all headers in a
412 single 276-byte state table
413
414 - latency tracking api added (configure --with-latency)
415
416 - Improved in-tree documentation, REAME.build, README.coding,
417 README.test-apps, changelog
418
419 - Many small fixes
420
421
422v1.0-chrome25-firefox17 (6cd1ea9b005933f)