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

ws: reporting PONG with pmd enabled

Add a return code NOTHING_WE_SHOULD_DO indicating that the
extension determined by ext-specific means its operation was
disabled on this frame.

https://github.com/warmcat/libwebsockets/issues/2076
This commit is contained in:
Andy Green 2020-10-08 14:06:43 +01:00
parent e44c8698ca
commit 27964ddaf2
4 changed files with 17 additions and 3 deletions

View file

@ -174,6 +174,7 @@ enum pmd_return {
PMDR_HAS_PENDING,
PMDR_EMPTY_NONFINAL,
PMDR_EMPTY_FINAL,
PMDR_NOTHING_WE_SHOULD_DO,
PMDR_FAILED = -1
};

View file

@ -554,6 +554,7 @@ drain_extension:
return -1;
}
if (n == PMDR_DID_NOTHING)
/* ie, not PMDR_NOTHING_WE_SHOULD_DO */
break;
#endif
lwsl_ext("%s: post inflate ebuf in len %d / out len %d\n",

View file

@ -192,10 +192,20 @@ lws_extension_callback_pm_deflate(struct lws_context *context,
lwsl_ext(" %s: LWS_EXT_CB_PAYLOAD_RX: in %d, existing in %d\n",
__func__, pmdrx->eb_in.len, priv->rx.avail_in);
/* if this frame is not marked as compressed, we ignore it */
/*
* If this frame is not marked as compressed,
* there is nothing we should do with it
*/
if (!(wsi->ws->rsv_first_msg & 0x40) || (wsi->ws->opcode & 8))
return PMDR_DID_NOTHING;
/*
* This is a bit different than DID_NOTHING... we have
* identified using ext-private bits in the packet, or
* by it being a control fragment that we SHOULD not do
* anything to it, parent should continue as if we
* processed it
*/
return PMDR_NOTHING_WE_SHOULD_DO;
/*
* we shouldn't come back in here if we already applied the

View file

@ -633,6 +633,7 @@ drain_extension:
return -1;
}
if (n == PMDR_DID_NOTHING)
/* ie, not PMDR_NOTHING_WE_SHOULD_DO */
break;
#endif
lwsl_debug("%s: post ext ret %d, ebuf in %d / out %d\n",
@ -693,7 +694,8 @@ utf8_fail:
if (n == PMDR_DID_NOTHING
#if !defined(LWS_WITHOUT_EXTENSIONS)
||
||
n == PMDR_NOTHING_WE_SHOULD_DO ||
n == PMDR_UNKNOWN
#endif
)