fix: respond to unsupported requests instead of dropping them - #209
Open
thexeos wants to merge 1 commit into
Open
Conversation
The publisher mapped FETCH, SUBSCRIBE_NAMESPACE and the other requests it does not implement to SessionError::unimplemented. recv_message swallows that error with a warning, so a peer sending a legal, spec-defined request gets no answer at all and is left waiting on a request that will never be resolved. Reply with the per-request error draft-14 defines for each instead: FETCH_ERROR for FETCH and SUBSCRIBE_NAMESPACE_ERROR for SUBSCRIBE_NAMESPACE, both carrying NOT_SUPPORTED (0x3). FETCH_CANCEL, UNSUBSCRIBE_NAMESPACE, PUBLISH_OK and PUBLISH_ERROR reference an earlier request rather than opening one and have no error response of their own, so they are logged and ignored. This matches the behaviour main already has via send_not_supported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The publisher maps FETCH, SUBSCRIBE_NAMESPACE and the other requests it does not implement to
SessionError::unimplemented, whichrecv_messageswallows with a warning. A peer that sends one of these legal, spec-defined requests therefore receives no response at all and is left waiting on a request that will never be resolved.This replies with the per-request error draft-14 defines for each instead: FETCH_ERROR for FETCH and SUBSCRIBE_NAMESPACE_ERROR for SUBSCRIBE_NAMESPACE, both carrying NOT_SUPPORTED (0x3, §13.1). FETCH_CANCEL, UNSUBSCRIBE_NAMESPACE, PUBLISH_OK and PUBLISH_ERROR reference an earlier request rather than opening one and have no error response of their own, so they are logged and ignored. This backports the behaviour
mainalready has viasend_not_supported, and adds unit tests covering each case.