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

3190 commits

Author SHA1 Message Date
Andy Green
29ce631669 metrics: increase type of us_schedule to uint64_t 2021-04-02 16:46:21 +01:00
Gary Christiansen
886d53f541 mqtt: Fixes setting the length of the last will message
It was previously using the length of the topic for the message. It
would break if the topic and message were not the same length.
2021-04-02 16:45:57 +01:00
Jed Lu
a9905822aa ss: allow that request_tx may get told DESTROY_ME 2021-04-02 16:45:42 +01:00
Andy Green
272225d602 route: assert if route table becomes full 2021-03-30 08:16:06 +01:00
Bram Peeters
4f71c5b49f vhost: dont log null origin 2021-03-30 08:15:55 +01:00
Andy Green
d213b0fb1f ss: mqtt: allow ACK_REMOTE to ACK_REMOTE transition
MQTT doesn't follow http type transaction flow, so it's
quite possible to have n PUBLISH getting acked in a row.
2021-03-30 08:15:42 +01:00
Chunho Lee
8fc7dc33a3 mqtt: topic validation for different mqtt servers
AWS IoT enforces limits topic level and length. If 'aws_iot' is set
on the policy, the topic limits will be enforced for AWS IoT.
2021-03-30 08:15:22 +01:00
Sakthi Kannan
d464df74a3 mqtt: wildcard topic and topic to 256 chars
Adding supports to MQTT wildcard support, topic to 256 chars,
incorrect topic validation.
2021-03-30 08:15:09 +01:00
Sakthi Kannan
9c7843fbe6 mqtt: Setting the CONNECTED state only when SUBACK is received
Setting the CONNECTED state only when SUBACK is received if the stream has
defined a subscription topic. This is to avoid SS from sending out SUBSCRIBE
right after CONNACK, even when the connection is not valid.
2021-03-30 08:15:02 +01:00
Andy Green
c15744f1d0 sai: openbsd: fix sigv4 2021-03-26 10:33:38 +00:00
Andy Green
e2feea7657 openbsd: fix up ctest 2021-03-26 10:05:31 +00:00
Andy Green
eba2d5cabd ws: wsi unusability only applies when no pending
We basically hear about HUP out-of-band with respect to
pending rx... now we mark the wsi as "unusable" once we
see the HUP - the connection has ended.

This means we have to differentiate between the wsi
being unusable for new things now, like replying, and
what it has already sent still being servicible and
pending.
2021-03-26 08:24:36 +00:00
Andy Green
213babc1af h2: dont try to get ahead of POST if its a cgi mount or proxied 2021-03-26 08:23:31 +00:00
Andy Green
f72acc9e07 active_conns: simplify h1 exclusion rule 2021-03-26 08:21:52 +00:00
Andy Green
5cdc9c114d http_proxy: report failed http code
Improve how we report what happened with http_proxy... if
we can't recognize the response as http/1.0 or http/1.1
do a CCE with "http_proxy fail", or if we did get valid h1
response but no 200 response code, do a CCE with
"http_proxy -> xxx" where xxx is the decimal representation
of the response code, eg, "http_proxy -> 407"
2021-03-26 08:20:10 +00:00
Andy Green
edb98b3eb0 ws: accept newer IANA close codes
Close codes 1012 - 1014 are not defined in RFC6455 but were defined later
in https://www.iana.org/assignments/websocket/websocket.xml#close-code-number

Accept these guys that are a bit late to the party, and 1015 as well.
2021-03-26 08:19:21 +00:00
Andy Green
dae01d2470 logs: reduce verbosity on plugins probing 2021-03-26 08:19:05 +00:00
Andy Green
9ee007e30f sspc: make sure we cancel any retry 2021-03-15 05:17:15 +00:00
Andy Green
4b689a1433 adopt: rejection should not loop with listen adoption 2021-03-14 15:15:15 +00:00
Andy Green
60ad3f8791 ss: make sure pointer to failed ss creation is wiped out 2021-03-14 15:07:01 +00:00
Andy Green
f6e799a645 ssproxy: break immediately after determining we will not allow the stream 2021-03-14 15:07:01 +00:00
Andy Green
801dd35def ssproxy: deal with lack of policy when replying with stream denied 2021-03-14 15:07:01 +00:00
Andy Green
bbcd597787 ss: add set_metadata that takes a heap copy and make ss-h1 use it
Until now we set metadata value pointers into the onward wsi ah data
area... that's OK until we get a situation the wsi has gone away before we
have a chance to deliver the metadata over the proxy link.

Add a variant lws_ss_alloc_set_metadata() that allocates space on the heap
and takes a copy of the input metadata.  Change ss-h1 to alloc copies of
its metadata so we no longer race the wsi ah lifetime.
2021-03-14 15:06:48 +00:00
Andy Green
b9a2abc097 ss: force check all set_metadata returns
lws_ss_set_metadata can fail... eg, due to transient OOM situation... if it does,
caller must take appropriate action like disconnect and retry.

So mark the api as requiring the result checking, and make sure all the
examples do it.
2021-03-14 09:03:03 +00:00
Haopeng Li
e427e21cde ss: make ss timeout handle underlying wsi gone 2021-03-13 07:16:32 +00:00
Andy Green
4a4200d680 connect2: log dereferences things that may have been destroyed
It's perfectly possible we will have destroyed the wsi and report that
back in the return code.  So let's not dumbly defreference the wsi to
make a log inbetweentimes.

Found with fault injection and valgrind.
2021-03-10 20:31:05 +00:00
Andy Green
0734e1a1cb connect: erase previous unusability when retrying connect
In the case that we try ipv6 that isn't routable, we get a POLLHUP, that
marks the wsi as unusable (for writes, not pending reads), that's what
we want.

But in the case we go around and retry other dns results that are
routable, we have to clear the wsi unusable flag.  Otherwise we will
connect and find that we can't write on the connection...
2021-03-10 20:31:00 +00:00
Andy Green
27cc9e33e0 client: DNS failure should retry while waiting for connect timeout
If the DNS lookup fails, we just sit out the remaining connect time.

The adapts it to reuse the wsi->sul_connect_timeout to schedule DNS lookup
retries until we're out of time.

Eventually we want to try other things as well, this is aligned with that.

Found with fault injection.
2021-03-10 20:30:51 +00:00
Jin Wang
991e9f9994 sspc: allow longer streamtype names in proxy 2021-03-10 04:06:04 +00:00
Andy Green
3f4623bb36 lws_metrics
There are a few build options that are trying to keep and report
various statistics

 - DETAILED_LATENCY
 - SERVER_STATUS
 - WITH_STATS

remove all those and establish a generic rplacement, lws_metrics.

lws_metrics makes its stats available via an lws_system ops function
pointer that the user code can set.

Openmetrics export is supported, for, eg, prometheus scraping.
2021-03-08 21:47:28 +00:00
Andy Green
c11a49c0b9 sai: solaris 2021-03-08 21:47:14 +00:00
Andy Green
d72955cc7f solaris: spawn: vfork is deprecated on solaris 11 2021-03-08 20:43:50 +00:00
Andy Green
2123bfce25 solaris: dir: remove accidental dirent type reference 2021-03-08 20:43:39 +00:00
Andy Green
e7a96a7175 solaris: socket priority 2021-03-08 20:43:29 +00:00
Andy Green
f9c3d432a8 netlink: migrate to context
For SMP case, it was desirable to have a netlink listener per pt so they
could deal with pt-level changes in the pt's local service thread.  But
Linux restricts the process to just one netlink listener.

We worked around it by only listening on pt[0], this aligns us a bit more
with the reality and moves to a single routing table in the context.
There's still more to do for SMP case locking.
2021-03-08 20:43:19 +00:00
Curi0
8dbe8507a3 windows-resolv: fix dns resolution
before this patch all i got was 'cant get dns servers' on my laptop running windows 10 1909
2021-03-05 20:08:51 +00:00
Andy Green
6d0f2500b0 windows: doesnt have #warning 2021-03-05 20:08:49 +00:00
Andy Green
ede7f8b0f3 ss: support huge urls 2021-03-05 14:13:26 +00:00
Andreas Weigel
d1763df9ed lws_struct: fix implicit schema recognition
actually use the index to iterate through the map of children to
not only match the first ever occurring entry
2021-03-01 19:51:12 +00:00
Andy Green
9af105ebf8 sai: xenial 2021-02-28 19:05:25 +00:00
Andy Green
09b9ac6e33 minimal-http-client: set option to fix broken server window update 2021-02-28 12:10:26 +00:00
Andy Green
a79342014d sspc: only do CREATING if its our first rodeo 2021-02-26 08:23:12 +00:00
Andy Green
789d98b98b sspc: handle loss of proxy manifesting itself as 0 length rx
If the client library loses the proxy connection, it can receive
an endless stream of 0 length rx instead of understanding that
the UDS peer has gone.

Handle that correctly so the client reacts to the loss of the
proxy link by trying to reacquire it.

Adapt the sspc state to be suitable for retry in that case,
by dropping any dsh and letting the logical ss know that he
is DISCONNECTED, if he thought he was CONNECTED.
2021-02-26 07:59:13 +00:00
Andy Green
cb5c0059a3 sai-resource 2021-02-24 08:56:27 +00:00
Andy Green
b47511352e async-dns: 2021-02-20 13:54:38 +00:00
Andy Green
14c5b7ebaf ss: state violations need to report lifecycle tags
The state tracking and violation detection is very powerful at enforcing
only legal transitions, but if it's busy, we don't get to see which stream
had to problem.  Add a pointer to the handle lc tag, do that rather than
just pass the handle so we can deal with ss and sspc handles cleanly.
2021-02-20 13:54:37 +00:00
Andy Green
10a6afdcd9 sspc: avoid dsh deref if stream instantiation failed 2021-02-20 13:54:35 +00:00
Andy Green
3fe08ce5d8 fault injection 2021-02-20 13:54:35 +00:00
Andy Green
8a087043c6 smd: account for new interested peers joining while queue exists 2021-02-20 13:54:35 +00:00
Andy Green
fc5302589c HUP: mark socket unusable 2021-02-20 13:54:34 +00:00