blob: a2c46fd729c20f8b7a76cbef70b25d73a418bd75 [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 Green50097dd2013-02-15 22:36:30 +080013User api changes
14----------------
15
16 - the external poll callbacks now get the socket descriptor coming from the
17 "in" parameter. The user parameter provides the user_space for the
18 wsi as it normally does on the other callbacks.
19
20
Andy Green54cb3462013-02-14 22:23:54 +080021
Andy Green53a46782013-02-14 11:23:49 +080022v1.21-chrome26-firefox18
23========================
24
25 - Fixes buffer overflow bug in max frame size handling if you used the
26 default protocol buffer size. If you declared rx_buffer_size in your
27 protocol, which is recommended anyway, your code was unaffected.
28
Andy Green182cb9a2013-02-13 11:54:08 +080029v1.2-chrome26-firefox18
30=======================
31
32Diffstat
33--------
34
35 .gitignore | 16 +++
36 CMakeLists.txt | 544 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
37 LICENSE | 526 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38 Makefile.am | 1 +
39 README | 20 +++
40 README.build | 258 ++++++++++++++++++++++++++++++++-----
41 README.coding | 52 ++++++++
42 changelog | 136 ++++++++++++++++++++
43 cmake/FindOpenSSLbins.cmake | 33 +++++
44 config.h.cmake | 173 +++++++++++++++++++++++++
45 configure.ac | 22 +++-
46 lib/Makefile.am | 20 ++-
47 lib/base64-decode.c | 2 +-
48 lib/client-handshake.c | 190 +++++++++++-----------------
49 lib/client-parser.c | 88 +++++++------
50 lib/client.c | 384 ++++++++++++++++++++++++++++++-------------------------
51 lib/daemonize.c | 32 +++--
52 lib/extension-deflate-frame.c | 58 +++++----
53 lib/extension-deflate-stream.c | 19 ++-
54 lib/extension-deflate-stream.h | 4 +-
55 lib/extension.c | 11 +-
56 lib/getifaddrs.c | 315 +++++++++++++++++++++++-----------------------
57 lib/getifaddrs.h | 30 ++---
58 lib/handshake.c | 124 +++++++++++-------
59 lib/libwebsockets.c | 736 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------
60 lib/libwebsockets.h | 237 ++++++++++++++++++++++------------
61 lib/output.c | 192 +++++++++++-----------------
62 lib/parsers.c | 966 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------
63 lib/private-libwebsockets.h | 225 +++++++++++++++++++++------------
64 lib/server-handshake.c | 82 ++++++------
65 lib/server.c | 96 +++++++-------
66 libwebsockets-api-doc.html | 189 ++++++++++++++++++----------
67 libwebsockets.spec | 17 +--
68 test-server/attack.sh | 148 ++++++++++++++++++++++
69 test-server/test-client.c | 125 +++++++++---------
70 test-server/test-echo.c | 31 +++--
71 test-server/test-fraggle.c | 32 ++---
72 test-server/test-ping.c | 52 ++++----
73 test-server/test-server.c | 129 ++++++++++++-------
74 win32port/libwebsocketswin32/libwebsocketswin32.vcxproj | 279 ----------------------------------------
75 win32port/libwebsocketswin32/libwebsocketswin32.vcxproj.filters | 23 +++-
76 41 files changed, 4398 insertions(+), 2219 deletions(-)
77
Andy Green7b405452013-02-01 10:50:15 +080078
79User api additions
80------------------
81
82 - lws_get_library_version() returns a const char * with a string like
83 "1.1 9e7f737", representing the library version from configure.ac
84 and the git HEAD hash the library was built from
85
Andy Greena47865f2013-02-10 09:39:47 +080086 - TCP Keepalive can now optionally be applied to all lws sockets, on Linux
87 also with controllable timeout, number of probes and probe interval.
88 (On BSD type OS, you can only use system default settings for the
89 timing and retries, although enabling it is supported by setting
90 ka_time to nonzero, the exact value has no meaning.)
91 This enables detection of idle connections which are logically okay,
92 but are in fact dead, due to network connectivity issues at the server,
Andy Greena690cd02013-02-09 12:25:31 +080093 client, or any intermediary. By default it's not enabled, but you
94 can enable it by setting a non-zero timeout (in seconds) at the new
95 ka_time member at context creation time.
96
Andy Greena7109e62013-02-11 12:05:54 +080097 - Two new optional user callbacks added, LWS_CALLBACK_PROTOCOL_DESTROY which
98 is called one-time per protocol as the context is being destroyed, and
99 LWS_CALLBACK_PROTOCOL_INIT which is called when the context is created
100 and the protocols are added, again it's a one-time affair.
101 This lets you manage per-protocol allocations properly including
102 cleaning up after yourself when the server goes down.
Andy Green7b405452013-02-01 10:50:15 +0800103
Andy Greened334462013-02-07 21:14:33 +0800104User api changes
105----------------
106
Andy Green1b265272013-02-09 14:01:09 +0800107 - libwebsocket_create_context() has changed from taking a ton of parameters
108 to just taking a pointer to a struct containing the parameters. The
109 struct lws_context_creation_info is in libwebsockets.h, the members
110 are in the same order as when they were parameters to the call
111 previously. The test apps are all updated accordingly so you can
112 see example code there.
113
Andy Greened334462013-02-07 21:14:33 +0800114 - Header tokens are now deleted after the websocket connection is
Andy Green54495112013-02-06 21:10:16 +0900115 established. Not just the header data is saved, but the pointer and
116 length array is also removed from (union) scope saving several hundred
117 bytes per connection once it is established
118
119 - struct libwebsocket_protocols has a new member rx_buffer_size, this
120 controls rx buffer size per connection of that protocol now. Sources
121 for apps built against older versions of the library won't declare
122 this in their protocols, defaulting it to 0. Zero buffer is legal,
123 it causes a default buffer to be allocated (currently 4096)
124
125 If you want to receive only atomic frames in your user callback, you
126 should set this to greater than your largest frame size. If a frame
127 comes that exceeds that, no error occurs but the callback happens as
128 soon as the buffer limit is reached, and again if it is reached again
129 or the frame completes. You can detect that has happened by seeing
130 there is still frame content pending using
131 libwebsockets_remaining_packet_payload()
132
133 By correctly setting this, you can save a lot of memory when your
134 protocol has small frames (see the test server and client sources).
135
Andy Green16ab3182013-02-10 18:02:31 +0800136 - LWS_MAX_HEADER_LEN now defaults to 1024 and is the total amount of known
137 header payload lws can cope with, that includes the GET URL, origin
138 etc. Headers not understood by lws are ignored and their payload
139 not included in this.
140
Andy Green54495112013-02-06 21:10:16 +0900141
142User api removals
143-----------------
144
Andy Green16ab3182013-02-10 18:02:31 +0800145 - The configuration-time option MAX_USER_RX_BUFFER has been replaced by a
146 buffer size chosen per-protocol. For compatibility, there's a default
147 of 4096 rx buffer, but user code should set the appropriate size for
148 the protocol frames.
149
150 - LWS_INITIAL_HDR_ALLOC and LWS_ADDITIONAL_HDR_ALLOC are no longer needed
151 and have been removed. There's a new header management scheme that
152 handles them in a much more compact way.
Andy Greened334462013-02-07 21:14:33 +0800153
Andy Green70edd6f2013-02-12 10:15:25 +0800154 - libwebsockets_hangup_on_client() is removed. If you want to close the
155 connection you must do so from the user callback and by returning
156 -1 from there.
157
Andy Green508946c2013-02-12 10:19:08 +0800158 - libwebsocket_close_and_free_session() is now private to the library code
159 only and not exposed for user code. If you want to close the
160 connection, you must do so from the user callback by returning -1
161 from there.
162
Andy Greened334462013-02-07 21:14:33 +0800163
Andy Greendf60b0c2013-02-06 19:57:12 +0900164New features
165------------
166
Andy Green9b09dc02013-02-08 12:48:36 +0800167 - Cmake project file added, aimed initially at Windows support: this replaces
Andy Green16ab3182013-02-10 18:02:31 +0800168 the visual studio project files that were in the tree until now.
Andy Greendf60b0c2013-02-06 19:57:12 +0900169
Andy Greenc3ef0d62013-02-12 10:50:49 +0800170 - CyaSSL now supported in place of OpenSSL (--use-cyassl on configure)
171
Andy Green9b09dc02013-02-08 12:48:36 +0800172 - PATH_MAX or MAX_PATH no longer needed
Andy Greendf60b0c2013-02-06 19:57:12 +0900173
Andy Green54495112013-02-06 21:10:16 +0900174 - cutomizable frame rx buffer size by protocol
175
Andy Greenc3ef0d62013-02-12 10:50:49 +0800176 - optional TCP keepalive so dead peers can be detected, can be enabled at
177 context-creation time
178
179 - valgrind-clean: no SSL or CyaSSL: completely clean. With OpenSSL, 88 bytes
180 lost at OpenSSL library init and symptomless reports of uninitialized
181 memory usage... seems to be a known and ignored problem at OpenSSL
182
Andy Greena3957ef2013-02-11 09:31:43 +0800183 - By default debug is enabled and the library is built for -O0 -g to faclitate
184 that. Use --disable-debug configure option to build instead with -O4
185 and no -g (debug info), obviously providing best performance and
186 reduced binary size.
Andy Green7b405452013-02-01 10:50:15 +0800187
Andy Green895d56d2013-02-11 09:32:53 +0800188 - 1.0 introduced some code to try to not deflate small frames, however this
189 seems to break when confronted with a mixture of frames above and
190 below the threshold, so it's removed. Veto the compression extension
191 in your user callback if you will typically have very small frames.
192
Andy Green16ab3182013-02-10 18:02:31 +0800193 - There are many memory usage improvements, both a reduction in malloc/
194 realloc and architectural changes. A websocket connection now
195 consumes only 296 bytes with SSL or 272 bytes without on x86_64,
196 during header processing an additional 1262 bytes is allocated in a
197 single malloc, but is freed when the websocket connection starts.
198 The RX frame buffer defined by the protocol in user
199 code is also allocated per connection, this represents the largest
200 frame you can receive atomically in that protocol.
201
Andy Greenc3ef0d62013-02-12 10:50:49 +0800202 - On ARM9 build, just http+ws server no extensions or ssl, <12Kbytes .text
203 and 112 bytes per connection (+1328 only during header processing)
204
Andy Green895d56d2013-02-11 09:32:53 +0800205
Andy Greenbd1132f2013-01-31 19:53:05 +0800206v1.1-chrome26-firefox18
Andy Greena35c86f2013-01-31 10:16:44 +0800207=======================
208
209Diffstat
210--------
211
212 Makefile.am | 4 +
213 README-test-server | 291 ---
214 README.build | 239 ++
215 README.coding | 138 ++
216 README.rst | 72 -
217 README.test-apps | 272 +++
218 configure.ac | 116 +-
219 lib/Makefile.am | 55 +-
220 lib/base64-decode.c | 5 +-
221 lib/client-handshake.c | 121 +-
222 lib/client-parser.c | 394 ++++
223 lib/client.c | 807 +++++++
224 lib/daemonize.c | 212 ++
225 lib/extension-deflate-frame.c | 132 +-
226 lib/extension-deflate-stream.c | 12 +-
227 lib/extension-x-google-mux.c | 1223 ----------
228 lib/extension-x-google-mux.h | 96 -
229 lib/extension.c | 8 -
230 lib/getifaddrs.c | 271 +++
231 lib/getifaddrs.h | 76 +
232 lib/handshake.c | 582 +----
233 lib/libwebsockets.c | 2493 ++++++---------------
234 lib/libwebsockets.h | 115 +-
235 lib/md5.c | 217 --
236 lib/minilex.c | 440 ++++
237 lib/output.c | 628 ++++++
238 lib/parsers.c | 2016 +++++------------
239 lib/private-libwebsockets.h | 284 +--
240 lib/server-handshake.c | 275 +++
241 lib/server.c | 377 ++++
242 libwebsockets-api-doc.html | 300 +--
243 m4/ignore-me | 2 +
244 test-server/Makefile.am | 111 +-
245 test-server/libwebsockets.org-logo.png | Bin 0 -> 7029 bytes
246 test-server/test-client.c | 45 +-
247 test-server/test-echo.c | 330 +++
248 test-server/test-fraggle.c | 20 +-
249 test-server/test-ping.c | 22 +-
250 test-server/test-server-extpoll.c | 554 -----
251 test-server/test-server.c | 349 ++-
252 test-server/test.html | 3 +-
253 win32port/zlib/ZLib.vcxproj | 749 ++++---
254 win32port/zlib/ZLib.vcxproj.filters | 188 +-
255 win32port/zlib/adler32.c | 348 ++-
256 win32port/zlib/compress.c | 160 +-
257 win32port/zlib/crc32.c | 867 ++++----
258 win32port/zlib/crc32.h | 882 ++++----
259 win32port/zlib/deflate.c | 3799 +++++++++++++++-----------------
260 win32port/zlib/deflate.h | 688 +++---
261 win32port/zlib/gzclose.c | 50 +-
262 win32port/zlib/gzguts.h | 325 ++-
263 win32port/zlib/gzlib.c | 1157 +++++-----
264 win32port/zlib/gzread.c | 1242 ++++++-----
265 win32port/zlib/gzwrite.c | 1096 +++++----
266 win32port/zlib/infback.c | 1272 ++++++-----
267 win32port/zlib/inffast.c | 680 +++---
268 win32port/zlib/inffast.h | 22 +-
269 win32port/zlib/inffixed.h | 188 +-
270 win32port/zlib/inflate.c | 2976 +++++++++++++------------
271 win32port/zlib/inflate.h | 244 +-
272 win32port/zlib/inftrees.c | 636 +++---
273 win32port/zlib/inftrees.h | 124 +-
274 win32port/zlib/trees.c | 2468 +++++++++++----------
275 win32port/zlib/trees.h | 256 +--
276 win32port/zlib/uncompr.c | 118 +-
277 win32port/zlib/zconf.h | 934 ++++----
278 win32port/zlib/zlib.h | 3357 ++++++++++++++--------------
279 win32port/zlib/zutil.c | 642 +++---
280 win32port/zlib/zutil.h | 526 ++---
281 69 files changed, 19556 insertions(+), 20145 deletions(-)
282
283user api changes
284----------------
285
286 - libwebsockets_serve_http_file() now takes a context as first argument
287
288 - libwebsockets_get_peer_addresses() now takes a context and wsi as first
289 two arguments
290
291
292user api additions
293------------------
294
295 - lwsl_...() logging apis, default to stderr but retargetable by user code;
296 may be used also by user code
297
298 - lws_set_log_level() set which logging apis are able to emit (defaults to
299 notice, warn, err severities), optionally set the emit callback
300
301 - lwsl_emit_syslog() helper callback emits to syslog
302
303 - lws_daemonize() helper code that forks the app into a headless daemon
304 properly, maintains a lock file with pid in suitable for sysvinit etc to
305 control lifecycle
306
307 - LWS_CALLBACK_HTTP_FILE_COMPLETION callback added since http file
308 transfer is now asynchronous (see test server code)
309
310 - lws_frame_is_binary() from a wsi pointer, let you know if the received
311 data was sent in BINARY mode
312
313
314user api removals
315-----------------
316
317 - libwebsockets_fork_service_loop() - no longer supported (had intractable problems)
318 arrange your code to act from the user callback instead from same
319 process context as the service loop
320
321 - libwebsockets_broadcast() - use libwebsocket_callback_on_writable[_all_protocol]()
322 instead from same process context as the service loop. See the test apps
323 for examples.
324
325 - x-google-mux() removed until someone wants it
326
327 - pre -v13 (ancient) protocol support removed
328
329
330New features
331------------
332
333 - echo test server and client compatible with echo.websocket.org added
334
335 - many new configure options (see README.build) to reduce footprint of the
336 library to what you actually need, eg, --without-client and
337 --without-server
338
339 - http + websocket server can build to as little as 12K .text for ARM
340
341 - no more MAX_CLIENTS limitation; adapts to support the max number of fds
342 allowed to the process by ulimit, defaults to 1024 on Fedora and
343 Ubuntu. Use ulimit to control this without needing to configure
344 the library. Code here is smaller and faster.
345
346 - adaptive ratio of listen socket to connection socket service allows
347 good behaviour under Apache ab test load. Tested with thousands
348 of simultaneous connections
349
350 - reduction in per-connection memory footprint by moving to a union to hold
351 mutually-exclusive state for the connection
352
353 - robustness: Out of Memory taken care of for all allocation code now
354
355 - internal getifaddrs option if your toolchain lacks it (some uclibc)
356
357 - configurable memory limit for deflate operations
358
359 - improvements in SSL code nonblocking operation, possible hang solved,
360 some SSL operations broken down into pollable states so there is
361 no library blocking, timeout coverage for SSL_connect
362
363 - extpoll test server merged into single test server source
364
365 - robustness: library should deal with all recoverable socket conditions
366
367 - rx flowcontrol for backpressure notification fixed and implmeneted
368 correctly in the test server
369
370 - optimal lexical parser added for header processing; all headers in a
371 single 276-byte state table
372
373 - latency tracking api added (configure --with-latency)
374
375 - Improved in-tree documentation, REAME.build, README.coding,
376 README.test-apps, changelog
377
378 - Many small fixes
379
380
381v1.0-chrome25-firefox17 (6cd1ea9b005933f)