1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00
This commit is contained in:
Andy Green 2020-10-04 07:27:22 +01:00
parent 44e860642b
commit 67d24d7c00
8 changed files with 27 additions and 22 deletions

View file

@ -41,7 +41,7 @@
"default": false
},
"windows-10/x86_64-amd/msvc": {
"build": "mkdir build && cd build && set SAI_CPACK=\"-G ZIP\" && cmake .. -DLWS_OPENSSL_LIBRARIES=\"C:\\Program Files\\OpenSSL\\lib\\libssl.lib;C:\\Program Files\\OpenSSL\\lib\\libcrypto.lib\" -DLWS_OPENSSL_INCLUDE_DIRS=\"C:\\Program Files\\OpenSSL\\include\" -DLWS_EXT_PTHREAD_INCLUDE_DIR=\"C:\\Program Files (x86)\\pthreads\\include\" -DLWS_EXT_PTHREAD_LIBRARIES=\"C:\\Program Files (x86)\\pthreads\\lib\\x64\\libpthreadGC2.a\" ${cmake} && cmake --build . --config DEBUG && set CTEST_OUTPUT_ON_FAILURE=1 && ctest . -C DEBUG -j4 --output-on-failure",
"build": "mkdir build && cd build && set SAI_CPACK=\"-G ZIP\" && cmake .. -DLWS_OPENSSL_LIBRARIES=\"C:\\Program Files\\OpenSSL\\lib\\libssl.lib;C:\\Program Files\\OpenSSL\\lib\\libcrypto.lib\" -DLWS_OPENSSL_INCLUDE_DIRS=\"C:\\Program Files\\OpenSSL\\include\" -DLWS_EXT_PTHREAD_INCLUDE_DIR=\"C:\\Program Files (x86)\\pthreads\\include\" -DLWS_EXT_PTHREAD_LIBRARIES=\"C:\\Program Files (x86)\\pthreads\\lib\\x64\\libpthreadGC2.a\" ${cmake} && cmake --build . --config DEBUG && set CTEST_OUTPUT_ON_FAILURE=1 && ctest . -C DEBUG -j1 --output-on-failure",
"default": false
},
"windows-10/x86_64-amd/mingw32": {

View file

@ -165,9 +165,9 @@ typedef struct lws_ss_metadata {
void *value__may_own_heap;
size_t length;
uint8_t value_on_lws_heap; /* proxy + rx metadata does this */
uint8_t value_is_http_token; /* valid if set by policy */
uint8_t value_length; /* only valid if set by policy */
uint8_t value_is_http_token; /* valid if set by policy */
uint8_t value_on_lws_heap:1; /* proxy + rx metadata does this */
#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)
uint8_t pending_onward:1;
#endif

View file

@ -310,6 +310,16 @@ enum {
* we are an accepted connection from a server's listening socket */
};
typedef lws_ss_state_return_t (*lws_sscb_rx)(void *userobj, const uint8_t *buf,
size_t len, int flags);
typedef lws_ss_state_return_t (*lws_sscb_tx)(void *userobj,
lws_ss_tx_ordinal_t ord,
uint8_t *buf, size_t *len,
int *flags);
typedef lws_ss_state_return_t (*lws_sscb_state)(void *userobj, void *h_src,
lws_ss_constate_t state,
lws_ss_tx_ordinal_t ack);
typedef struct lws_ss_info {
const char *streamtype; /**< type of stream we want to create */
size_t user_alloc; /**< size of user allocation */
@ -319,15 +329,12 @@ typedef struct lws_ss_info {
/**< offset of opaque user data ptr in user_alloc type, set to
offsetof(mytype, opaque_ud_member) */
lws_ss_state_return_t (*rx)(void *userobj, const uint8_t *buf,
size_t len, int flags);
lws_sscb_rx rx;
/**< callback with rx payload for this stream */
lws_ss_state_return_t (*tx)(void *userobj, lws_ss_tx_ordinal_t ord,
uint8_t *buf, size_t *len, int *flags);
lws_sscb_tx tx;
/**< callback to send payload on this stream... 0 = send as set in
* len and flags, 1 = do not send anything (ie, not even 0 len frame) */
lws_ss_state_return_t (*state)(void *userobj, void *h_src /* ss handle type */,
lws_ss_constate_t state, lws_ss_tx_ordinal_t ack);
lws_sscb_state state;
/**< advisory cb about state of stream and QoS status if applicable...
* h_src is only used with sinks and LWSSSCS_SINK_JOIN/_PART events.
* Return nonzero to indicate you want to destroy the stream. */
@ -654,12 +661,8 @@ lws_ss_server_ack(struct lws_ss_handle *h, int nack);
* to the default when the transaction wanting it is completed.
*/
LWS_VISIBLE LWS_EXTERN void
lws_ss_change_handlers(struct lws_ss_handle *h,
int (*rx)(void *userobj, const uint8_t *buf, size_t len, int flags),
int (*tx)(void *userobj, lws_ss_tx_ordinal_t ord, uint8_t *buf,
size_t *len, int *flags),
int (*state)(void *userobj, void *h_src /* ss handle type */,
lws_ss_constate_t state, lws_ss_tx_ordinal_t ack));
lws_ss_change_handlers(struct lws_ss_handle *h, lws_sscb_rx rx, lws_sscb_tx tx,
lws_sscb_state state);
/**
* lws_ss_add_peer_tx_credit() - allow peer to transmit more to us

View file

@ -48,7 +48,7 @@ lws_http_string_to_known_header(const char *s, size_t slen)
if (!strncmp(set[n], s, slen))
return n;
return -1;
return LWS_HTTP_NO_KNOWN_HEADER;
}
int

View file

@ -94,6 +94,8 @@ void
lws_ranges_reset(struct lws_range_parsing *rp);
#endif
#define LWS_HTTP_NO_KNOWN_HEADER 0xff
/*
* these are assigned from a pool held in the context.
* Both client and server mode uses them for http header analysis

View file

@ -113,7 +113,7 @@ lws_ss_get_metadata(struct lws_ss_handle *h, const char *name,
lws_ss_metadata_t *
lws_ss_get_handle_metadata(struct lws_ss_handle *h, const char *name)
{
int n = 0;
int n;
for (n = 0; n < h->policy->metadata_count; n++)
if (!strcmp(name, h->metadata[n].name))

View file

@ -670,8 +670,8 @@ lws_ss_policy_parser_cb(struct lejp_ctx *ctx, char reason)
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
/*
* Check the metadata value part to see if it's a well-known
* http header... if so, 0xff means no header string match else
* it's the well-known header index
* http header... if so, LWS_HTTP_NO_KNOWN_HEADER (0xff) means
* no header string match else it's the well-known header index
*/
a->curr[LTY_POLICY].p->metadata->value_is_http_token = (uint8_t)
lws_http_string_to_known_header(ctx->buf, ctx->npos);

View file

@ -236,7 +236,7 @@ lws_extract_metadata(lws_ss_handle_t *h, struct lws *wsi)
while (polmd) {
if (polmd->value_is_http_token != 0xff) {
if (polmd->value_is_http_token != LWS_HTTP_NO_KNOWN_HEADER) {
/* it's a well-known header token */
@ -299,8 +299,8 @@ lws_extract_metadata(lws_ss_handle_t *h, struct lws *wsi)
}
/*
* copy the named custom header value into the
* malloc'd buffer
* copy the named custom header value
* into the malloc'd buffer
*/
if (lws_hdr_custom_copy(wsi, p, n + 1,