diff --git a/lib/core-net/private-lib-core-net.h b/lib/core-net/private-lib-core-net.h index f63823cfc..e8a9097b8 100644 --- a/lib/core-net/private-lib-core-net.h +++ b/lib/core-net/private-lib-core-net.h @@ -174,6 +174,7 @@ enum pmd_return { PMDR_HAS_PENDING, PMDR_EMPTY_NONFINAL, PMDR_EMPTY_FINAL, + PMDR_NOTHING_WE_SHOULD_DO, PMDR_FAILED = -1 }; diff --git a/lib/roles/ws/client-parser-ws.c b/lib/roles/ws/client-parser-ws.c index cacadd298..688e1ebda 100644 --- a/lib/roles/ws/client-parser-ws.c +++ b/lib/roles/ws/client-parser-ws.c @@ -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", diff --git a/lib/roles/ws/ext/extension-permessage-deflate.c b/lib/roles/ws/ext/extension-permessage-deflate.c index 58fc7fa7a..de7fc1d41 100644 --- a/lib/roles/ws/ext/extension-permessage-deflate.c +++ b/lib/roles/ws/ext/extension-permessage-deflate.c @@ -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 diff --git a/lib/roles/ws/ops-ws.c b/lib/roles/ws/ops-ws.c index d81e285d7..a322f59ba 100644 --- a/lib/roles/ws/ops-ws.c +++ b/lib/roles/ws/ops-ws.c @@ -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", @@ -691,7 +692,8 @@ utf8_fail: /* if pmd not enabled, in == out */ - if (n == PMDR_DID_NOTHING + if (n == PMDR_DID_NOTHING || + n == PMDR_NOTHING_WE_SHOULD_DO #if !defined(LWS_WITHOUT_EXTENSIONS) || n == PMDR_UNKNOWN