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

154 commits

Author SHA1 Message Date
Andy Green
d3308df40f windows: pthreads
Add support for external pthreads lib on windows and some docs about how to do.

It can build with LWS_WITH_THREADPOOL and LWS_WITH_MINIMAL_EXAMPLES including the
pthreads-dependent ones without warnings or errors on windows platform as well with this.

pthreads_t can be anything, including a struct - not a pointer-to-a-struct
but the struct itself.  These can't be cast to a void * for printing as they can
on linux, where the base type is a pointer.

Let's fix all the usage of those to determine their own thread index in terms
of the meaning to the program rather than as a tid.
2020-04-07 14:05:21 +01:00
Andy Green
2d55e18947 ss: windows build adaptations
Windows compiler finds various non-bug things to complain about when
building with SS and other options, fix them up
2020-04-06 20:25:06 +01:00
Andy Green
370ba6f5ed lws_struct: handle empty char array serialization 2020-04-05 12:06:31 +01:00
Andy Green
fb3fd499e3 threadpool: allow multiple threadpool tasks to bind to same wsi 2020-04-04 10:47:11 +01:00
Andy Green
4caeb56bec vfork
There's a subtle difference between fork and vfork... when doing the
dup() before the exec, with cfork we are still dealing with the
parent process "possessed" by the forked process briefly inbetween
the vfork() and the exec().

That matters because when we close the duplicated fds for the stdxxx
pipes, with vfork we're closing the fd we still want to hold in the
parent process.
2020-04-01 05:56:45 +01:00
Andy Green
c261f5a90e spawn: on OSX only waitpid can get return code 2020-03-24 11:21:10 +00:00
Andy Green
6d5ebd237c threadpool: lack of task when getting status should be taken as FINISHED 2020-03-21 14:43:50 +00:00
Andy Green
54029c4896 lws_struct: sqlite: order defaults to _lws_idx but may be overridden
The internal order that a dll2 of structs was written might or might not be
what the guy deserializing it cares about
2020-03-20 19:44:10 +00:00
Andy Green
44fa7e39e3 lws_dir: uv: clean up temp loop on fail 2020-03-19 14:34:29 +00:00
Andy Green
c6165f8680 lws_spawn: get result to temp si
We pass the temp si to the reap callback, we delete the lsp one beforehand.
But we were collecting the spawn retcode into the lsp one...
2020-03-18 12:20:41 +00:00
Andy Green
af20721500 threadpool: enable to use secure streams as well as direct wsi
This extends threadpool slightly so it can bind enqueued tasks to a
secure streams handle as well as a straight wsi.

Either the .wsi must be set as before, or the .ss handle if you are
using secure streams, when enqueuing a task on the taskpool.

A couple of other helpers get ss-aware wrappers if LWS_WITH_SECURE_STREAMS

Although threadpool was originally designed for server (gitohashi)
actually it's also fine working with client wsi / Secure Streams,
if you have a situation a client connection is associated with heavy
processing.
2020-03-16 13:58:07 +00:00
Andy Green
993c7c3192 fsmount: delete session dir on mount 2020-03-05 14:12:24 +00:00
Andy Green
28ce32af64 client: secure streams
Secure Streams is an optional layer on top of lws that separates policy
like endpoint selection and tls cert validation into a device JSON
policy document.

Code that wants to open a client connection just specifies a streamtype name,
and no longer deals with details like the endpoint, the protocol (!) or anything
else other than payloads and optionally generic metadata; the JSON policy
contains all the details for each streamtype.  h1, h2, ws and mqtt client
connections are supported.

Logical secure streams outlive any particular connection and supports "nailed-up"
connectivity regardless of underlying connection stability.
2020-03-04 12:17:49 +00:00
Andy Green
55ea791a77 lws_struct: store which toplevel schema matched
We can give the lws_struct parser a table of toplevel schemas, record
which one we chose so the caller can know how to interpret the result
2020-03-04 12:17:48 +00:00
Andy Green
30fc8e9caf lws_struct sqlite3
Continue with lws_struct, add sqlite support for one
level of lws_dll2_t lists of structs serialization and
deserialization, plus the matching api-test.
2020-03-04 11:00:04 +00:00
Andy Green
1da0096d4d lws_fsmount: overlayfs apis 2020-02-21 17:32:41 +00:00
Andy Green
8a7e0edb7d lws_spawn_piped: break out from cgi
The vfork optimized spawn, stdxxx and terminal handling in the cgi
implementation is quite mature and sophisticated, and useful for
other things unrelated to cgi.  Break it out into its own public
api under LWS_WITH_SPAWN, off by default.

Expand it so the parent wsi is optional, and the role and protocol
bindings for stdxxx pipes can be set.  Allow optional sul timeout
and external lws_dll2 owner for extant children.

Remove inline style from minimal http-server-cgi
2020-02-21 17:32:41 +00:00
Andy Green
6a737b7ca6 lwsac: add lwsac_extend api 2020-02-21 17:32:41 +00:00
Andy Green
4683ae2596 cmake: fix situation like mingw where toolchain file sets platform defines
https://github.com/warmcat/libwebsockets/issues/1831
2020-02-04 14:16:18 +00:00
Andy Green
774240f73b linkit: support build using public sdk
This provides support to build lws using the linkit 7697 public SDK
from here https://docs.labs.mediatek.com/resource/mt7687-mt7697/en/downloads

This toolchain has some challenges, its int32_t / uint32_t are long,
so assumptions about format strings for those being %u / %d / %x all
break.  This fixes all the cases for the features enabled by the
default cmake settings.
2020-01-17 07:45:34 +00:00
Andy Green
72a5993deb clean: explicitly include libwebsockets.h in internal c now we use stddint types earlier
Some toolchains don't bring it in soon enough by reference from
other headers
2020-01-15 12:07:20 +00:00
Andy Green
157acfc906 windows: clean type warnings
There are some minor public api type improvements rather than cast everywhere
inside lws and user code to work around them... these changed from int to
size_t

 - lws_buflist_use_segment() return
 - lws_tokenize_t .len and .token_len
 - lws_tokenize_cstr() length
 - lws_get_peer_simple() namelen
 - lws_get_peer_simple_fd() namelen, int fd -> lws_sockfd_type fd
 - lws_write_numeric_address() len
 - lws_sa46_write_numeric_address() len

These changes are typically a NOP for user code
2020-01-11 14:04:50 +00:00
Andy Green
0bfd39135e cleaning 2020-01-05 22:17:58 +00:00
Andy Green
c4ab815aaf _GNU_SOURCE: only define if not already defined
https://github.com/warmcat/libwebsockets/issues/1803
2019-12-22 18:17:45 +00:00
Andy Green
277d0e5e4c license: fix up last mentions of lgpl outside of the source file license grant part 2019-12-02 11:19:30 +00:00
Andy Green
b2a112568c cov263975: help coverity see false positive 2019-11-12 10:28:53 +00:00
Zhiwen Zheng
3299c54130 illumos: fix build errors 2019-11-04 13:49:13 +00:00
Andy Green
ef14f00f64 osx: needs sys/dirent.h 2019-11-04 13:49:13 +00:00
Andy Green
ce55c5dfe4 lwsac: fix header split optimization 2019-11-02 18:34:05 +00:00
Kristján Valur Jónsson
1b51301c8d lejp: fix warnings on windows 2019-10-23 06:36:11 +01:00
Andy Green
ebdc0ad084 lwsac-backfill
Optimizations for memory-tight systems.

Check all previous gaps first for any usage, so gaps we created when
faced with perhaps a relatively large allocation that left a lot of
the last chunk on the table can be backfilled with smaller things as
it goes on.

Separate the members that only live in the head object out of the
buffer management object, reducing the cost of new chunks.  Allocate
the head object members as the first thing in the first chunk, and
adjust all the code to look there for them.
2019-10-17 09:19:57 +01:00
Andy Green
c776ac50d6 lwsac: add blob deduplication helper
Add lwsac helper api to allow user code to perform constant string folding
easily within an lwsac.  After isolating a string or blob that it wants to store in
the lwsac and point to, it can check if the string or blob already exists earlier
in the lwsac first, and if so just point to that without copying it in again.

For some formats with repeated strings like JSON, the saving can add up to
something useful.
2019-10-17 09:19:57 +01:00
Andy Green
127e53cf98 client: multipart mime generation helpers
lws has been able to generate client multipart mime as shown
in minimal-http-client-post, but it requires a lot of user
boilerplate to handle the boundary, related transaction header,
and multipart headers.

This patch adds a client creation flag to indicate it will
carry multipart mime, which autocreates the boundary string
and applies the transaction header with it, and an api to
form the boundary headers between the different mime parts
and the terminating boundary.
2019-10-12 12:41:14 +01:00
Zhiwen Zheng
14746d9014 illumos: fixes for build warnings 2019-10-12 12:41:14 +01:00
Andy Green
6a6f365ce7 semmle: fix warnings
They're all cosmetic or minor js stuff.

Add related shield.io icons to README.
2019-09-22 09:35:07 -07:00
Andy Green
c591e1adfc asynchronous dns for ipv4 and ipv6
This adds the option to have lws do its own dns resolution on
the event loop, without blocking.  Existing implementations get
the name resolution done by the libc, which is blocking.  In
the case you are opening client connections but need to carefully
manage latency, another connection opening and doing the name
resolution becomes a big problem.

Currently it supports

 - ipv4 / A records
 - ipv6 / AAAA records
 - ipv4-over-ipv6 ::ffff:1.2.3.4 A record promotion for ipv6
 - only one server supported over UDP :53
 - nameserver discovery on linux, windows, freertos

It also has some nice advantages

 - lws-style paranoid response parsing
 - random unique tid generation to increase difficulty of poisoning
 - it's really integrated with the lws event loop, it does not spawn
   threads or use the libc resolver, and of course no blocking at all
 - platform-specific server address capturing (from /etc/resolv.conf
   on linux, windows apis on windows)
 - it has LRU caching
 - piggybacking (multiple requests before the first completes go on
   a list on the first request, not spawn multiple requests)
 - observes TTL in cache
 - TTL and timeout use lws_sul timers on the event loop
 - ipv6 pieces only built if cmake LWS_IPV6 enabled
2019-09-19 06:54:53 +01:00
Mike Owens
8fc54cec00 SmartOS: detection/build to all Illumos 2019-09-06 15:30:51 +01:00
Andy Green
adb6379df0 base64: stateful decode 2019-09-06 15:30:51 +01:00
Andy Green
0fa5563d18 freertos: rename esp32 plat to freertos 2019-08-26 09:58:57 +01:00
Andy Green
d7f0521aeb private.h: rename to contain dir
Having unique private header names is a requirement of a particular
platform build system it's desirable to work with
2019-08-15 10:49:52 +01:00
Andy Green
26319663f7 license: switch LGPLv2.1+SLE parts to MIT 2019-08-14 10:44:38 +01:00
Mike Owens
22ece2c0e4 Subject: Build on SmartOS 2019-08-12 12:45:31 +01:00
Andy Green
2fc35ef6bd stats: move to pt and improve presentation 2019-08-12 06:18:04 +01:00
Andy Green
4692c1a7ee rtos: clean warnings where uint32_t is an unsigned long 2019-06-07 11:11:46 +01:00
Andy Green
f89aa401cc generic-sessions update
Generic sessions has been overdue some love to align it with
the progress in the rest of lws.

1) Strict Content Security Policy
2) http2 compatibility
3) fixes and additions for use in a separate process via unix domain socket
4) work on ws and http proxying in lws
5) add minimal example
2019-05-06 10:24:51 +01:00
Andy Green
8d473ad78c smtp: make abstract 2019-05-04 08:28:31 +01:00
Andy Green
8f06b6fbad lejp: allow up to 20 digit decimal numbers
https://github.com/warmcat/libwebsockets/issues/1559
2019-05-02 09:28:45 +01:00
Andy Green
0405c0c878 lejp: make sure child object close is not mistaken for parent 2019-05-02 09:28:38 +01:00
Andy Green
38fb0e31da lws_struct
lws_struct JSON + sqlite3 serializer and deserializer


See READMEs/README.lws_struct.md
2019-04-06 06:08:47 +08:00
Andy Green
fd1f4e4de7 lwsac_use_zero 2019-03-29 05:03:01 +08:00