Commit graph

2010 commits

Author SHA1 Message Date
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
Andy Green
9a9d5eaeeb avoid using deallocated things during context dedtroy
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-18 12:07:07 +08:00
Andy Green
4319b4d78d fuzxy
This is the initial push of a fuzzing proxy we will use for testing lws.

Run libwebsockets-test-fuzxy and the test server if it's local.

Then run the test client with

http_proxy=localhost:8880 libwebsockets-test-client localhost (or whatever)

Right now he only fuzzes one thing but he is operational as a proxy.
2016-01-18 11:16:25 +08:00
Andy Green
a547554aa2 cleaning
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-18 11:16:20 +08:00
Andy Green
1d719ec87f lws_interface_to_sa
Expose interface handling code as an api
2016-01-16 12:09:38 +08:00
Andy Green
d5060d25a1 use lws_close not raw close
https://github.com/warmcat/libwebsockets/issues/400

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-16 11:14:46 +08:00
David Andrade
ec1296a667 Subject: [PATCH] Make echo test app option consistent with the other test
options
2016-01-15 22:48:17 +08:00
Andy Green
29cfeebcde permessage deflate male callback VISIBLE
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-15 22:16:54 +08:00
Andy Green
7c507e4700 fix client getting hung up on at negotiation
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-15 19:34:33 +08:00
Andy Green
809d69aa85 redirect
This adds redirect support to the client side.  Lws will follow
server redirects (301) up to three deep.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-15 19:32:47 +08:00
Andy Green
7a0fcf2fc5 parse_uri
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-15 19:32:47 +08:00
Vijay Khurdiya
e73d446461 ssl add ECDH server support
(AG clean style add option flag and docs)
2016-01-15 16:21:51 +08:00
Andy Green
7c15eb1e42 only report CLIENT_CONNECTION_ERROR once on some paths
In most cases the close api will see it should send the CCE because
we are still in the waiting server reply state until the end of the
interpretation.  Only if we completed the interpretation and moved
on to ESTABLISHED do we need to handle sending it ourselves.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-14 11:38:31 +08:00
Andy Green
389a4bb9f0 remove double free attempts from no ACCEPT server response cleanup path
The generic wsi close code is smart enough to clean up after these allocations itself

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-13 18:48:50 +08:00
Andy Green
8308073464 fuzzer eliminate hsecond ah free path firing assert sentinel
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-13 05:01:17 +08:00
Andy Green
9928cccdb6 fuzzer rx overflow mitigate
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-12 23:05:02 +08:00
Andy Green
5b3736682d lws_client_connect_via_info
https://github.com/warmcat/libwebsockets/issues/396

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-12 17:22:06 +08:00
Andy Green
b6289d1153 test client remove abs modulo
llvm and gcc 5.3 do different things with it

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-12 08:46:56 +08:00
Andy Green
6711266a50 extension permessage deflate
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-11 11:34:01 +08:00
Andy Green
58ad3d6e09 clean libev.c style
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-09 08:13:55 +08:00
Andy Green
5783b1a169 libev set events to match revents
https://github.com/warmcat/libwebsockets/issues/393

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-09 04:12:46 +08:00
Andy Green
5eeb4bd0d3 partial always use partial buffering if send incomplete
After "rerelease"

https://github.com/warmcat/libwebsockets/issues/392#issuecomment-170003294

Since we introduced partial buffering a long while ago,
user code shold never see partial sends and very few
user callbsck attempt to deal with them.

Let's just eliminate the whole concept of user callback
partial send handling under any circumstances.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-08 21:52:47 +08:00
Denis Osvald
27174e64de properly skip protocols with NULL name
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
2016-01-07 06:57:59 +08:00
Denis Osvald
034e514a0d fix callback typedefs and declarations
Remove declarations of callback and extension_callback as these are
functions declared in header but not defined anywhere.

Also rename typedefs callback_function and extension_callback_function
to lws_callback_function and lws_extension_callback_function so all
symbolx exported by header have lws prefix;

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
2016-01-07 06:44:38 +08:00
Andy Green
0c7e5a9418 doc improve docs around header access apis
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-30 14:53:50 +08:00
Andy Green
2b35e123f4 ext negotiation tolerate semicolon args
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-30 12:12:58 +08:00
Andy Green
86c1ef1e7c utf8 check compatible with extensions
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-30 11:43:36 +08:00
Andy Green
9b81d3c967 optimize utf8 check tests into state bit
Considering we go through it once per incoming char, the tests to see if we
should be checking utf-8 are too expensive... move them to a bit that lives
in the wsi and set them once per frame (except for CLOSE who has to update
after the close code has been skipped).

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-29 12:28:48 +08:00
Andy Green
44a7f65e1a introduce LWS_SERVER_OPTION_VALIDATE_UTF8
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-29 11:20:09 +08:00
Andy Green
0c7b38b144 autobahn check utf8 on TEXT and CLOSE
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-29 09:46:03 +08:00
Andy Green
7c2868486e autobahn reject forbidden close code ranges
Complain like autobahn expects if we get a funny close code

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-28 22:29:57 +08:00
Andy Green
fde3684384 autobahn README.test apps.md
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-28 22:29:57 +08:00