1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
Commit graph

1136 commits

Author SHA1 Message Date
Andy Green
b45054ed39 http2 build with alpn capable ssl no debug
Signed-off-by: Andy Green <andy@warmcat.com>
2016-03-25 21:03:01 +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
7dbdb776d9 b64decode correct decode of some strings
https://github.com/warmcat/libwebsockets/issues/467

Signed-off-by: Andy Green <andy@warmcat.com>
2016-03-19 07:48:24 +08:00
Alex Hultman
5594735115 Optimize payload exhaustion
https://github.com/warmcat/libwebsockets/pull/462

AG refactor and do loop unrolling
2016-03-17 09:42:10 +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
bjqiwei
934cc2a8ce client perform WSI_CREATE callback 2016-03-15 16:27:49 +08:00
Joakim Soderberg
d36fa29ac4 ssl ecdh adapt if missing ecdh.h include
https://github.com/warmcat/libwebsockets/issues/457
2016-03-12 08:49:09 +08:00
Andy Green
f192c01a13 client ext hdr skip if no arg
https://github.com/warmcat/libwebsockets/issues/453

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-03-09 23:35:41 +08:00
Andy Green
ec11114182 libev set foreign loop properly
After gaby64

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-03-09 07:47:34 +08:00
Andy Green
dc410bfb78 windows deal with no snprintf
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-03-04 10:58:52 +08:00
Alex Hultman
3eb59c90bf libuv.c: Service fd with LWS_POLLHUP on poll errors 2016-03-02 18:59:55 +08:00
Ondraco
3816a05c4f wince minor adaptations
https://github.com/warmcat/libwebsockets/issues/444
2016-03-01 07:33:56 +08:00
Andy Green
980ca50c39 libuv when in use skip shutdown close phase
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-29 11:11:48 +08:00
Andy Green
ea3cf82769 windows listen for pollhup
After Ondraco

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-29 10:09:15 +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
Andy Green
360c0a8ee4 ah move more_rx_waiting to wsi scope
Originally this was alright in wsi->u.hdr, because ah implied header
processing.  But since we allowed ah to be held across http
keep-alive transactions if we saw we had more header data, it means
we were trying to read this union member out of scope after it had
transitioned.

Moving the more_rx_waiting member to be a 1-bit bifield in the wsi
solves it and lets us check the state any time later at http
transaction completion.

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-28 11:02:42 +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
5e091c62a8 force service properly when unconsumed rxbuf in ah
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-26 10:50:04 +08:00
Andy Green
00aaa3aa12 close wsi must do detatch ah flow even if no ah
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-25 21:55:06 +08:00
Andy Green
12369b0c91 improve timeout and ah list comments
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-25 21:54:31 +08:00
Andy Green
d19dec7922 remove ah scan
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-25 21:54:06 +08:00
Andy Green
b55ea5eaed fix missing callback return check
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-25 20:23:45 +08:00
Andy Green
d2a95e0c82 unix privs change group before user
Otherwise we no longer have privs to change the group after doing the user

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-25 15:15:41 +08:00
Andy Green
ee2f1ea667 defeat POLLOUT if socket in shutdown wait
After andrejs.hanins@ubnt.com

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-24 21:32:31 +08:00
Andy Green
3daefb876a ws union member must have actual struct at start not pointer
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-24 19:18:51 +08:00
Andrejs Hanins
b14f842891 client callback closed if not upgraded also for server connection
https://github.com/warmcat/libwebsockets/issues/437
https://github.com/warmcat/libwebsockets/pull/440
2016-02-24 19:18:46 +08:00
Andrejs Hanins
171d29695f client connect must init position_in_fds_table 2016-02-22 23:35:31 +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
Sebastian Reimer
00919de84e lwsl stderr sink use formatted time
AG change to use localtime_r for threadsafety and leave old method as fallback
2016-02-21 07:45:03 +08:00
Andy Green
a3f688c189 ssl get rid of build_cert_chain
It's not supported on major distro SSL (Fedora is 1.1) and
libressl (on 2.x) doesn't have it either.

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-21 07:10:55 +08:00
Alex Hultman
1499ab6b33 Stop uv loop in default signal handler, clean-ups 2016-02-20 23:06:32 +08:00
Alex Hultman
a3a0792012 Make sure every handle is closed before destroying the uv loop 2016-02-20 22:50:53 +08:00
Alex Hultman
f2ee57e734 Don't destroy ev/uv loops if they haven't been created yet 2016-02-20 19:35:33 +08:00
Andy Green
81c461f5de lws_return_http_status send content length
If we're sending content, we must do so with a
content-length on http/1.1

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-20 08:04:56 +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
3310dd19b5 ah pool lifetime use dynamic rxpos
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-20 08:04:09 +08:00
Andy Green
4cdf00e04c windows plat correct assert test in lws_poll_listen_fd
After https://github.com/warmcat/libwebsockets/issues/430

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-18 21:02:34 +08:00
Andy Green
48a967d4e7 ssl add server ecdh curve init
Using "real" SSL certs requires some init for openssl ECDH
curve.  Add a default curve "prime256v1" and allow overriding it
at context creation time.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-18 19:25:46 +08:00
Andy Green
59cb88f1fe ssl ecdh check errors properly
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-17 11:10:39 +08:00
Peter Pentchev
1c9c278f49 Fix some typos. 2016-02-16 21:48:38 +08:00
Andy Green
7714f71e4e debug reduce noise
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-16 18:47:24 +08:00
Andy Green
27966c29e1 coverity 158145 lws_header_table_detatch must handle no ah attached
callers should protect it so this doesn't make a problem.  But
Coverity is correct the code is confused about it.

Make it okay if we close a connection before the ah got attached.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 21:03:51 +08:00
Andy Green
200a6a296e timeout settable from info
This adds an info member that allows the user code to
set the library's network action timeout in seconds.

If left at the default 0, the build-time default
AWAITING_TIMEOUT continues to be used.

As suggested

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 20:39:07 +08:00
Andy Green
c9259876d2 http_transaction_completed handle two completions in detach reset order
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-15 19:05:43 +08:00
Andy Green
2c218e705f ah owns rxbuf
This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.

Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.

Having the rx buffer in the ah means we can delay using the
rx until a later service loop.

Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.

The possible http/1.1 situations and their dispositions are:

 1) exactly one set of http headers come.  After processing,
    the ah is detached since no pending rx left.  If more
    headers come later, a fresh ah is aqcuired when available
    and the rx flow control blocks the read until then.

 2) more that one whole set of headers come and we remain in
    http mode (no upgrade).  The ah is left attached and
    returns to the service loop after the first set of headers.
    We will get forced service due to the ah having pending
    content (respecting flowcontrol) and process the pending
    rx in the ah.  If we use it all up, we will detach the
    ah.

 3) one set of http headers come with ws traffic appended.
    We service the headers, do the upgrade, and keep the ah
    until the remaining ws content is used.  When we
    exhausted the ws traffix in the ah rx buffer, we
    detach the ah.

Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.

When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code.  However this
is untested.

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
a43c2ac272 libuv initial replace libev version 2016-02-14 07:31:44 +08:00
Dan Albert
cd5e7bff82 Ask sysconf for Android's getdtablesize. 2016-02-12 08:58:16 +08:00
Andy Green
892f03a7d8 lws_reset_header_table dont reset NULL
This is only a temporary, fragile solution.

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-09 09:15:02 +08:00