Commit graph

1441 commits

Author SHA1 Message Date
Andy Green
027fb683cc libuv only cleanup if in use
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-03 07:07:31 +08:00
Andy Green
86224b5093 libuv test server update for deprecated apis
We have to set a good example everywhere now
lws_get_internal_extensions() blows a warning / error

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-03 07:07:31 +08:00
Andy Green
ba78cd36a6 lib_v move start stop handling into change_pollfd
The existing lib_v handling copied around to each change_pollfd instance
can be easily missed off if new change_pollfd uses are added.  Instead
migrate it directly into change_pollfd to guarantee it is handled and
simplify the code.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-03 07:07:31 +08:00
Andy Green
da408c0d2b libuv libev abstraction
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-03 07:07:31 +08:00
Alex Hultman
fa4619416e libuv initial replace libev version 2016-02-03 07:07:31 +08:00
Andy Green
1b89b933a6 debug spew remove ah reset logging
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-03 07:06:52 +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
70e065b5db autobahn add test script
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-01 17:38:15 +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
ada3531aff coverity 157401 dont test SHUTDOWN state in mode switch
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 23:17:40 +08:00
Andy Green
e6dbaa236a coverity 157402 explicitly disallow handling invalid sockfd
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 15:40:08 +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
b39a151c9c coverity 157404 get rid of needless NULL check
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 15:30:05 +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
4bcbfe1ad4 restrict SO_REUSEPORT to multithreading only so no unexpected change otherwise
SO_REUSEPORT means you don't get any error any more if another
server instance is already running, this will be quite unexpected
for singlethreaded users.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 09:20:00 +08:00
Andy Green
6dd7e86f23 http1.1 keepalive drop ah betweentimes
https://github.com/warmcat/libwebsockets/issues/404

Tested with

wget -O- http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html

and confirm no connection processing during that on server side

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 09:06:22 +08:00
Andy Green
9c444d2709 win dont redefine _WINSOCK_DEPRECATED_NO_WARNINGS
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 01:26:31 +08:00
Danomi Czaski
4e9c7f3504 lextable add x-real-ip
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-28 09:40:53 +08:00
Andy Green
8d5351a0c4 reduce debug logging mark socket dead when pollert
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-27 08:50:31 +08:00
Andy Green
ba119e9057 lws_adopt_socket
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-26 21:40:32 +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
dcbe30a28e mbed simplify
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-26 20:45:10 +08:00
Andy Green
aa3c8cd371 pthreads only as needed
This just lets you build lws 1.6 without pthreads if your OS / toolchain
makes that possible, in the case you don't build the test apps
(libwebsockets-test-server-pthreads needs it)

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-25 21:39:07 +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
9666e1d438 fuzzer handle junk after upgrade header
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-21 10:59:07 +08:00
Andy Green
5a0e7866d3 unify bounds checking in parser
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-21 10:57:39 +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
cb17ad8740 win add dummy LWS_WARN_UNUSED_RESULT
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-21 10:56:20 +08:00
Andy Green
5086597878 mbed align with pt changes
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 17:35:18 +08:00
Andy Green
e99a83cb96 introduce LWS_WARN_UNUSED_RESULT
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 16:56:06 +08:00
Andy Green
af607da082 header fragment reject empty early
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:44:04 +08:00
Andy Green
f38ad33ddf tolower remove
https://github.com/warmcat/libwebsockets/issues/403

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 07:55:41 +08:00
Andy Green
bc4012916d parser issue_char audit
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 07:40:13 +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
Andy Green
4ccc13d3ee coverity 156863 fuzxy handle cant get socket
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 21:42:13 +08:00
Andy Green
e34d4b4b35 coverity 156860 wsi dereference before NULL check
... bit in reality, wsi can never be NULL

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 21:33:52 +08:00
Andy Green
2e3bf06139 coverity 156861 context destroy dereference context before NULL check
Context could be NULL only if context creation failed in the first
place and user error path is bad... no network connectivity at that
point...

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 21:33:52 +08:00
Andy Green
2ec7c85e99 coverity 156862 unused return value
Not exactly a problem...

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 21:27:44 +08:00
Andy Green
d3a5505542 multithreaded service
This adds support for multithreaded service to lws without adding any
threading or locking code in the library.

At context creation time you can request split the service part of the
context into n service domains, which are load-balanced so that the most
idle one gets the next listen socket accept.

There's a single listen socket on one port still.

User code may then spawn n threads doing n service loops / poll()s
simultaneously.  Locking is only required (I think) in the existing
FD lock callbacks already handled by the pthreads server example,
and that locking takes place in user code.  So the library remains
completely agnostic about the threading / locking scheme.

And by default, it's completely compatible with one service thread
so no changes are required by people uninterested in multithreaded
service.

However for people interested in extremely lightweight mass http[s]/
ws[s] service with minimum provisioning, the library can now do
everything out of the box.

To test it, just try

$ libwebsockets-test-server-pthreads -j 8

where -j controls the number of service threads

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 20:02:36 +08:00
Andy Green
3f63560876 fix broken ext arg parsing
This gets us back to all the Autobahn tests passing

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 20:02:34 +08:00
Andy Green
d738f84ed1 timeout move to doubly linked list
In the case we have a lot of connections, checking them all for timeout state
once a second becomes burdensome.  At the moment if you have 100K connections,
once a second they all get checked for timeout in a loop.

This patch adds a doubly-linked list based in the context to each wsi, and
only wsi with pending timeouts appear on it.  At checking time, we traverse
the list, which costs nothing if empty because nobody has a pending timeout.

Similarly adding and removing from the list costs almost nothing since no
iteration is required no matter how big the list.

The extra 8 or 16 bytes in the wsi are offset a little bit by demoting .pps
from int to char (save 3 bytes).  And trim max act exts to 2, since we only
provide one, saving 8 /16 bytes by itself if exts enabled.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 04:32:14 +08:00
Andrew Cooks
15c92b1bf6 From 8dc784c121fb387f1871245b3194eae662bddfa3 Mon Sep 17 00:00:00 2001
Subject: [PATCH] bump version in rpm spec file.
2016-01-18 12:11:23 +08:00
Andrew Cooks
2a6df60fdc From 1e933db07bed7a0b5ac8dc49146815348ae37ded Mon Sep 17 00:00:00 2001
Subject: [PATCH] rpm specfile fixes: group, license, build requires, files
2016-01-18 12:10:34 +08:00
Andrew Cooks
cdcf5fc9c0 From 7f39ea761e98ea96f79a7e69d4cdeee0c39d316e Mon Sep 17 00:00:00 2001
Subject: [PATCH] fix missing ${LIB_SUFFIX} on cmake config dir
2016-01-18 12:09:43 +08:00
Peter Pentchev
2a0dbcf7ee Generate the API documentation in a reproducible way.
Sort the list of source files before passing them to the kernel-doc
script so that it always outputs the discovered functions and
structures in the same order.
2016-01-18 12:07:07 +08:00