Commit graph

317 commits

Author SHA1 Message Date
Namowen
09d8720034 echo: fix debug build
https://github.com/warmcat/libwebsockets/issues/716#issuecomment-267377856
2016-12-16 07:06:33 +08:00
Andy Green
72d78ed4f8 test-client: fix broken protocol names 2016-12-15 13:34:06 +08:00
Andy Green
151aa809a6 lws_snprintf
Thanks to Fabrice Gilot for reporting the problem that led to uncovering this.

Due to a misunderstanding of the return value of snprintf (it is not truncated according
to the max size passed in) in places relying on snprintf to truncate the length
overflows are possible.

This patch wraps snprintf with a new lws_snprintf() which does truncate its length to allow
the buffer limiting scheme to work properly.

All users should update with these fixes.

In 1.7.x, there's no affected code in the library itself, just a couple on instances in the
test app code.
2016-09-15 02:36:22 +08:00
Andy Green
9a90ed20ac fix %3d handling in path part and add attack.sh
https://github.com/warmcat/libwebsockets/issues/518

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-07 08:33:07 +08:00
Andy Green
381cbf2dc1 client fix reaction to tls failure
https://github.com/warmcat/libwebsockets/issues/508

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-03 08:08:32 +08:00
Andy Green
82753d8db6 urldecode forbid malformed
And update attack.sh to confirm the new test cases

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-07 18:57:28 +08:00
Meir Yanovich
ec81fd460b win32 needs strange strftime args 2016-04-05 19:51:25 +08:00
Meir Yanovich
b1f80eeeb7 libuv win32 fixes 2
https://github.com/warmcat/libwebsockets/issues/411#issuecomment-204284368
2016-04-05 07:31:16 +08:00
Andy Green
8cd06ca315 test server align rxbuf with permessage deflate rx buf size
Add a test html button that will send 9KB of junk to confirm it

https://github.com/warmcat/libwebsockets/issues/480

permessage-deflate now checks the protocol rx buffer size for being
>=128, if not, permessage-deflate is disabled on that connection.

If it is >=128 but less than the zlib decompress buffer size, the
zlib decompress buffer size for that connection is reduced to the
nearest power of two of the protocol rx buf size.

To test this, dumb_increment is left violating the >= 128 rx buffer
size and permessage-deflte can be seen to be disabled on his
connections in the test html.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-01 09:30:09 +08:00
Denis Osvald
3d033984f5 libuv: handle signals only if requested
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
2016-03-23 08:04:39 +08:00
Andy Green
20f18e0b1e clang fixes 1
https://github.com/warmcat/libwebsockets/issues/461

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-03-15 21:24:04 +08:00
Andy Green
814a7d28c1 test server libuv support status protocol
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-29 01:11:55 +08:00
Andy Green
6671327c8d libuv create 1Hz background timeout check
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-29 01:09:01 +08:00
Kamil Rytarowski
e841206653 Don't include <sys/cdefs.h> for NetBSD
We needed it for the BSD symbol to be defined, while __NetBSD__ is defined
with a compiler.

Thanks Andy Green for the initial fix.

Signed-off-by: Kamil Rytarowski <n54@gmx.com>
2016-02-27 10:24:40 +08:00
Andy Green
8df3ef15ab netbsd netinet include
https://github.com/warmcat/libwebsockets/issues/442

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-27 09:34:48 +08:00
Andy Green
314ca966a0 test server log LWS_CALLBACK_HTTP
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-25 15:08:03 +08:00
Andy Green
7bb600f0c7 lws status fix LWS_PRE
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-25 09:27:02 +08:00
Andy Green
969212e1dd windows doesnt have localtime_r
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-21 21:41:22 +08:00
Andy Green
b33c72c770 test server status no ssl include time header
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-21 15:12:20 +08:00
Andy Green
4038721baf test server add lws_status
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-21 13:44:07 +08:00
Andy Green
466defa72d test html add tabs
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-21 13:43:41 +08:00
Andy Green
228ecc6e56 libwebsockets.org url updates
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-21 10:49:04 +08:00
Andy Green
90a73cc45f attack.sh add check for nonexistant file processing
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-20 08:11:35 +08:00
Andy Green
78468e08b3 test server example systemd service file
Make sure you have daemonization enabled to use this

make .. -DLWS_WITHOUT_DAEMONIZE=0

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-20 08:04:53 +08:00
Andy Green
df9be06522 daemonize work under systemd
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-20 08:04:32 +08:00
Andy Green
1610223737 test server allow set uid gid from cmdline
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-20 08:03:51 +08:00
Andy Green
737049b065 test server SSL STS header delivery example
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-18 19:39:24 +08:00
Andy Green
922f68c85e test server allow only best quality ciphers
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-18 19:27:08 +08:00
Andy Green
835ad120aa test server allow external certs
Allow the test server to use external certs for testing

libwebsockets-test-server --ssl -C libwebsockets.org.crt -K libwebsockets.org.key -A libwebsockets.org.cer

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-17 12:00:40 +08:00
Peter Pentchev
1c9c278f49 Fix some typos. 2016-02-16 21:48:38 +08:00
Andy Green
0b85a64bf0 coverity 158147 test ping sprintf bounds
Well, just in the test app arg processing, but yes...

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 21:09:00 +08:00
Andy Green
0fba8e6ef8 coverity 158146 test fraggle sprintf bounds
Well, just in the test app arg processing, but yes...

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 21:07:09 +08:00
Andy Green
42f93ffbfa attack.sh add http1.1 pipelining check
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 14:57:55 +08:00
Andy Green
86ed65ff00 libuv integration
This gets the libuv stuff plumbed in and working.

Currently it's only workable for some service thread, and there
is an isolated valgrind problem left

==28425== 128 bytes in 1 blocks are definitely lost in loss record 3 of 3
==28425==    at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28425==    by 0x4C2AB1E: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28425==    by 0x58BBB27: maybe_resize (core.c:748)
==28425==    by 0x58BBB27: uv__io_start (core.c:787)
==28425==    by 0x58C1B80: uv__signal_loop_once_init (signal.c:225)
==28425==    by 0x58C1B80: uv_signal_init (signal.c:260)
==28425==    by 0x58BF7A6: uv_loop_init (loop.c:66)
==28425==    by 0x4157F5: lws_uv_initloop (libuv.c:89)
==28425==    by 0x405536: main (test-server-libuv.c:284)

libuv wants to sign off on all libuv 'handles' that will close, and
callback to do the close confirmation asynchronously.  The wsi close function
is adapted when libuv is in use to work with libuv accordingly and exit the uv
loop the number of remaining wsi is zero.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-14 09:31:13 +08:00
Alex Hultman
19bb09133d port test-server-libuv.c from libev to libuv 2016-02-14 09:28:28 +08:00
Andy Green
083c73e7e9 license clarification and test apps CC zero
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-08 08:44:21 +08:00
Andy Green
d2c140c8ed lws_parse_uri fix test client use and add more docs
https://github.com/warmcat/libwebsockets/issues/414

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-07 07:28:21 +08:00
Andy Green
4939a708f8 LWS_WARN_DEPRECATED and fixup older test apps
Enforce no more internal use of deprecated apis (esp in the test apps)

Also signal clearly to users what is on the way out.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-02 09:02:24 +08:00
Andy Green
8e1b7cb692 attack.sh exit 0 on success
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-31 11:53:49 +08:00
Andy Green
4019aab8da ah http1.1 deal with pipelined headers properly
Connections must hold an ah for the whole time they are
processing one header set, even if eg, the headers are
fragmented and it involves network roundtrip times.

However on http1.1 / keepalive, it must drop the ah when
there are no more header sets to deal with, and reacquire
the ah later when more data appears.  It's because the
time between header sets / http1.1 requests is unbounded
and the ah would be tied up forever.

But in the case that we got pipelined http1.1 requests,
even partial already buffered, we must keep the ah,
resetting it instead of dropping it.  Because we store
the rx data conveniently in a per-tsi buffer since it only
does one thing at a time per thread, we cannot go back to
the event loop to await a new ah inside one service action.

But no problem since we definitely already have an ah,
let's just reuse it at http completion time if more rx is
already buffered.

NB: attack.sh makes request with echo | nc, this
accidentally sends a trailing '\n' from the echo showing
this problem.  With this patch attack.sh can complete well.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-30 11:43:10 +08:00
Andy Green
1b2c9a23e1 clean pre 1.7
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 23:17:43 +08:00
Andy Green
6f4e2d297b coverity 157403 fuzxy handle currently impossible error
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 15:35:01 +08:00
Andy Green
92f96f3edf cleanup test app startup messages
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 09:35:58 +08:00
Andy Green
8c1f6026a7 multithread stability
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-26 20:56:56 +08:00
Andy Green
0b09734953 fuzxy some toolchains need sys socket.h
https://github.com/warmcat/libwebsockets/issues/407

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-25 21:00:37 +08:00
Andy Green
7d83bf93e4 fuzxy add test parser and some tests
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-21 10:56:26 +08:00
Andy Green
05ae649b66 timeout also fixup for0middle guy deletion case
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 23:11:39 +08:00
Andy Green
72dba09932 timeout check take copies since he may be deleted
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 22:34:44 +08:00
Andy Green
ed6b3961c5 test server http dont print junk if string too long
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 22:20:18 +08:00
Andy Green
1f8ec7c865 coverity 156864 fuzxy close socket if connect fails
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 21:44:20 +08:00