Fix: local message incoming from rpc #45
Merged
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.
handle_http_server_messagefunction has not been tampered with, so there is some redundancy. I.e. the message is being transformed twice, outside and inside the handler. I prefer that the functionshandle_xyz_messagehave the same format. If priority is different, I can trim it down and change the name to e.g.handle_http_server_http_request.There are four cases of messages relevant in this context: local through some app, local through http-server, remote through some app, remote through http-server.
When done with
kit inject-message, messages will go throughhttp-server:distro:sys. So whether I send a message tagged as remote or as local, they will both end up in the local handler. Not sure if this is correct behavior, but it makes sense given that all calls via the rpc endpoint are expected to be local (afaict), otherwise they would be hitting http endpoints directly.If there is a misformatted HTTP message, we will parse it as a local message, which might be clunky for devs. I can add logging in the local message handler to say something like "If you are sending an HTTP message (rather than local), it might be formatted wrong."