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