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

4776 commits

Author SHA1 Message Date
Andy Green
5de5ee74bf ss: lws_ss_client_connect also only pass up return
We removed the _lws_ss_handle_state_ret_CAN_DESTROY_HANDLE() from
request_tx, hane to do the same for lws_ss_client_connect()
2021-08-19 05:31:15 +01:00
Andy Green
af501eab1a windows: plat: only build client ctx init if WITH_TLS
https://github.com/warmcat/libwebsockets/issues/2385
2021-08-19 05:31:15 +01:00
Andy Green
708903cb47 minimal: eventlib: custom: add client demonstration 2021-08-19 05:31:15 +01:00
Andy Green
43f290adbc sspc: add LWSSSCS_UPSTREAM_LINK_RETRY state
Add a transient state that indicates that we are retrying an upstream link
before the sspc creation can proceed.

The state() ack paramemeter shows the number of ms we have been retrying.

This is only issued if proxy mode clients are having difficulty reaching
their proxy, and are retrying.

As a transient state it doesn't affect the ss overall state, which will not
have reached CREATING yet.
2021-08-19 05:31:15 +01:00
Andy Green
770dc7bc85 client: connections: add detailed dynamic CCE info
Let's improve the details returned in CLIENT_CONNECTION_ERROR in string so
we can get more clues about the problem.  Create dynamic strings that
classify at what step the error happened, and add dynamic info like the
errno.
2021-08-19 05:31:15 +01:00
Andy Green
0043ea5d44 ws: check protocol before debug log 2021-08-19 05:31:15 +01:00
Andy Green
5b8a597c1d server: http-proxy: fix POST 2021-08-19 05:31:15 +01:00
Andy Green
e49a5f3698 sai: centos8-aarch64 2021-08-19 05:31:15 +01:00
Andy Green
6d8c4a7bdd sai: debian 11 2021-08-19 05:31:15 +01:00
Andy Green
79c8d6be17 sai: rejuvenate netbsd/aarch64BE and add netbsd/x64_64-amd 2021-08-19 05:31:15 +01:00
Andy Green
568fa014ce lws_struct: add CHILD_PTR setting 2021-08-19 05:31:15 +01:00
Andy Green
37f3244076 conmon: add dns and protocol_specific
This adds an indication of dns disposition to the conmon results,
and for http, if it gets that far a protocol-specific indication
of http response code.
2021-08-19 05:31:04 +01:00
Zhao Lou
2951a92ed8 conmon: fix missing quote in JSON 2021-08-19 05:28:27 +01:00
Yichen Gu
4c99f85a16 conmon: pass userobj to ss rx not handle 2021-08-16 08:07:35 +01:00
Andy Green
387a406f07 ss: conmon: assert if wsi ss handle is stale
Add a way to confirm that the ss handle recovered from a ss wsi is still
valid, by walking the pt ss list and confirming it is on there before using
it with conmon.

If it isn't, it will assert.
2021-08-16 08:07:35 +01:00
Andy Green
9cd8d1f9f3 sspc: enable CCEs on proxy link wsi
Normally we suppress CCEs while still in the client connection loop time,
since we can return failure directly to the caller.

In sspc client case, defeat that, in order to have a convenient place to
put code that cares about ongoing proxy link connection failures.
2021-08-16 08:07:35 +01:00
Andy Green
243c21deac ss: add fault injections in creation
Add 9 fault injection cases in SS creation flow, and 5 of those
instantiate in the minimal examples ctests.  The other 4 relate
to static policy and server, I tested the server ones by hand.

These tests confirm the recent change to unpick create using
lws_ss_destroy.
2021-08-16 08:07:35 +01:00
Andy Green
2b75c6fb89 smd: avoid recursive lock when unregistering during delivery 2021-08-16 08:07:35 +01:00
Jed Lu
ca16a07a9b ss: unpick failed create using destroy
The late_bail discrete unpick flow is missing some pieces compared
to lws_ss_destroy.  Unify the creation fail flow to also use
lws_ss_destroy so everything in one place.

Make lws_ss_destroy() not issue any states if the creation flow
didn't get as far as issuing CREATING.
2021-08-16 08:07:35 +01:00
Andy Green
406b79e440 ss: handle DESTROY_ME from inside ss creation
Normally when doing a Client Connection Error handling,
we can action any ss relationship straight away since
we are in a wsi callback without any ss-aware parents
in the call stack.

But in the specific case we're doing the initial onward
wsi connection part on behalf of a ss, in fact the call
stack does have earlier  parents holding references on
the related ss.

For example

  secstream_h1 (ss-h1.c:470)                          CCE
  lws_inform_client_conn_fail (close.c:319)           fails early
  lws_client_connect_2_dnsreq (connect2.c:349)
  lws_http_client_connect_via_info2 (connect.c:71)
  lws_header_table_attach (parsers.c:291)
  rops_client_bind_h1 (ops-h1.c:1001)
  lws_client_connect_via_info (connect.c:429)         start onward connect
  _lws_ss_client_connect (secure-streams.c:859)
  _lws_ss_request_tx (secure-streams.c:1577)
  lws_ss_request_tx (secure-streams.c:1515)           request tx
  ss_cpd_state (captive-portal-detect.c:50)
  lws_ss_event_helper (secure-streams.c:408)
  lws_ss_create (secure-streams.c:1256)                SS Create

Under these conditions, we can't action the DESTROY_ME that
is coming when the CCE exhausts the retries.

This patch adds a flag that is set during the SS's onward wsi
connection attempt and causes it to stash rather than action
the result code.

The result code is brought out from the stash when we return to
_lws_ss_client_connect level, and passed up in the SS flow until
it is actioned, cleanly aborting the ss create.
2021-08-16 08:07:35 +01:00
Andy Green
e644bb4a6e cpd: pass up lws_ss_request_tx ret 2021-08-16 08:07:32 +01:00
Andy Green
f3d5b9b99a service: assert on thread shenanigans 2021-08-13 05:25:01 +01:00
Andy Green
eb8c8354c4 logs: handle LWS_LOGS_TIMESTAMP disabled 2021-08-13 05:25:01 +01:00
Andy Green
a7e4724a5e http: date: use timegm 2021-08-13 05:25:00 +01:00
Andy Green
5f31ff8383 h2: data: frame header already parsed out 2021-08-09 17:31:16 +01:00
Andy Green
31dc6f0410 docs: event loops intro 2021-08-09 17:31:16 +01:00
Andy Green
d1f3762a05 types: handle ssize_t is int 2021-08-09 17:31:16 +01:00
Yichen Gu
9365490ef0 conmon: only build if WITH_CONMON 2021-08-09 17:31:16 +01:00
Jed Lu
62b915c879 ss: increase set_metadata length type to size_t 2021-08-09 17:31:16 +01:00
Andy Green
3073655759 ss: zero on destroy 2021-08-09 17:31:16 +01:00
Andy Green
d18d7a3643 http: redir: to tls from none 2021-07-30 11:32:27 +01:00
Andy Green
fac7c5bf9c seq: fix 2021-07-23 04:22:15 +01:00
Hassan Sahibzada
630d768419 b64: add downcasts for gcc 4.4
gcc 4.4 complains with the following:
warning: conversion to 'char' from 'int' may alter its value

After the explicit cast the warning is gone.
2021-07-23 04:22:15 +01:00
Yucong Sun
e5944a7da2 h2: server: file serving chunk restricted to max frame size from SETTINGS 2021-07-23 04:22:06 +01:00
Yucong Sun
faf091d8cd windows: tls: make sure we are telling correct errno 2021-07-20 10:34:03 +01:00
Yucong Sun
81e54df04d cmake: tls: check correct api for availability 2021-07-20 10:34:03 +01:00
Andy Green
5ddb03d146 iface: score binds
Choose the best fit for iface ip addresses by scoring the
unsorted results from getifaddrs()
2021-07-20 10:33:56 +01:00
Andy Green
c11311ff5a ws: ext: close wsi rather than spin if unable to clear buflist
If there's ssl pending and stuff in the buflist, it was observed we can
spin if the buflist is not cleared due to wsi state.

Add a sanity check for the number of times we will try to deal with that
before dropping the conn.
2021-07-18 11:25:24 +01:00
Andy Green
4b089788bc tls: mbedtls-3
Adapt mbedtls support for compatibility with v3, while maintaining
compatibility with v2.

Notice v3 has removed the ability to encrypt with pubkey and
decrypt with privkey.  Openssl still has it, atm with v3 these
fall back to encrypt with privkey and decrypt with pubkey.

> The RSA module no longer supports private-key operations with the
> public key or vice versa. As a consequence, RSA operation functions
> no longer have a mode parameter. If you were calling RSA operations
> with the normal mode (public key for verification or encryption,
> private key for signature or decryption), remove the
> MBEDTLS_MODE_PUBLIC or MBEDTLS_MODE_PRIVATE argument. If you were
> calling RSA operations with the wrong mode, which rarely makes sense
>from a security perspective, this is no longer supported.
2021-07-13 13:22:50 +01:00
Andy Green
215ec1daa8 remove LWS_WITH_DEPRECATED_THINGS 2021-07-13 13:22:46 +01:00
Nikias Bassen
ed7215f373 cmake: mbedtls: extra CMAKE_REQUIRED_INCLUDES
Make sure MBEDTLS_INCLUDE_DIRS and MBEDTLS_LIBRARIES are set in parent CMakeLists

Also set MBEDTLS_INCLUDE_DIRS in CMAKE_REQUIRED_INCLUDES so the CHECK_C_SOURCE_COMPILES
checks actually evaluate properly.
2021-07-13 08:27:27 +01:00
Andy Green
6852c3c64d README.md: update 2021-07-13 08:27:25 +01:00
Andy Green
c8176085df vhost: listen: protect listen port transfer between
...vhosts from vh destroy on zero refcount

https://github.com/warmcat/libwebsockets/issues/2343
2021-07-13 08:27:22 +01:00
Andy Green
1ae1fccbec mbedtls: sessions: clean session on bail path 2021-07-13 08:27:20 +01:00
Andy Green
4c4b2c5dcf libevent: use event_enable_debug_mode 2021-07-13 08:27:18 +01:00
Andy Green
a4720b7dbc windows: align plat insert socket POLLIN handling to linux
This is needed for, eg, libuv
2021-07-09 09:31:48 +01:00
Andy Green
f708d09a3a socks5: cast for mingw3 nonposix recv args 2021-07-08 15:24:15 +01:00
Andy Green
48541efcc2 mqtt: handle NULL mqtt publish metadata 2021-07-08 10:16:06 +01:00
marcelo-gonzalez
1809f37011 event libs: glib: use glib.h specifically
https://github.com/warmcat/libwebsockets/issues/2338
2021-07-08 06:22:47 +01:00
calvin2021y
6e3a6d9990 openssl: manage _GNU_SOURCE better 2021-07-08 06:22:47 +01:00