1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/minimal-examples/secure-streams
Andy Green 33da902ed4 ss: policy: response code mapping
This adds a per-streamtype JSON mapping table in the policy.

In addition to the previous flow, it lets you generate custom
SS state notifications for specific http response codes, eg:

   "http_resp_map": [ { "530": 1530 }, { "531": 1531 } ],

It's not recommended to overload the transport-layer response
code with application layer responses.  It's better to return
a 200 and then in the application protocol inside http, explain
what happened from the application perspective, usually with
JSON.  But this is designed to let you handle existing systems
that do overload the transport layer response code.

SS states for user use start at LWSSSCS_USER_BASE, which is
1000.

You can do a basic test with minimal-secure-streams and --respmap
flag, this will go to httpbin.org and get a 404, and the warmcat.com
policy has the mapping for 404 -> LWSSSCS_USER_BASE (1000).

Since the mapping emits states, these are serialized and handled
like any other state in the proxy case.

The policy2c example / tool is also updated to handle the additional
mapping tables.
2020-09-16 13:10:26 +01:00
..
minimal-secure-streams ss: policy: response code mapping 2020-09-16 13:10:26 +01:00
minimal-secure-streams-alexa sspc: fix intree build for sspc examples and increase post example body 2020-08-13 16:48:16 +01:00
minimal-secure-streams-avs sspc: fix intree build for sspc examples and increase post example body 2020-08-13 16:48:16 +01:00
minimal-secure-streams-client-tx cmake: provide LIBWEBSOCKETS_DEP_LIBS in CONFIG 2020-06-16 19:45:35 +01:00
minimal-secure-streams-metadata sspc: fix intree build for sspc examples and increase post example body 2020-08-13 16:48:16 +01:00
minimal-secure-streams-policy2c ss: policy: response code mapping 2020-09-16 13:10:26 +01:00
minimal-secure-streams-post event libs: default to building as dynamically loaded plugins 2020-08-31 16:51:37 +01:00
minimal-secure-streams-proxy lws_smd: system message distribution 2020-06-27 07:57:22 +01:00
minimal-secure-streams-seq cmake: provide LIBWEBSOCKETS_DEP_LIBS in CONFIG 2020-06-16 19:45:35 +01:00
minimal-secure-streams-server event libs: default to building as dynamically loaded plugins 2020-08-31 16:51:37 +01:00
minimal-secure-streams-server-raw lws_smd: take care about build with disabled 2020-08-16 05:35:56 +01:00
minimal-secure-streams-smd sspc: fix intree build for sspc examples and increase post example body 2020-08-13 16:48:16 +01:00
minimal-secure-streams-staticpolicy ss: rx metadata 2020-09-16 13:10:26 +01:00
README.md client: secure streams 2020-03-04 12:17:49 +00:00

Secure Streams

Secure Streams is a client API that strictly decouples the policy for connections from the payloads. The user code only deals with the stream type name and payloads, a policy database set at lws_context creation time decides all policy about the connection, including the endpoint, tls CA, and even the wire protocol.

name demonstrates
minimal-secure-streams Minimal secure streams client / proxy example
minimal-secure-streams-tx Proxy used for client-tx test below
minimal-secure-streams-client-tx Secure streams client showing tx and rx