Fixes to resolve mimepart issues in the event stream from Hikvision cameras#51
Open
xtelinco wants to merge 4 commits intotoxuin:masterfrom
Open
Fixes to resolve mimepart issues in the event stream from Hikvision cameras#51xtelinco wants to merge 4 commits intotoxuin:masterfrom
xtelinco wants to merge 4 commits intotoxuin:masterfrom
Conversation
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.
As mentioned in this issue #34 the Hikvision server code generates these types of errors when processing the stream of events from Hikvision cameras.
I have tracked this down to the Hikvision camera sending bogus --boundary lines at the end of some XML. So the mimepart parser sees this as an error and misses an event. This is because the mimepart parser sees
I have added a filter to detect this and strip the bogus boundary.
Also the event stream generates image/jpeg type mime entries for some messages. These were completely unhandled and were processed as XML. These changes inspect the Content-Type header and only process the messages as XML if the content type suggests so. If the Content-Type is 'image/jpeg' you can now optionally send this to MQTT as well.