Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle payloads without XML declaration #7

Closed
raintonr opened this issue Dec 13, 2022 · 0 comments · Fixed by #8
Closed

Handle payloads without XML declaration #7

raintonr opened this issue Dec 13, 2022 · 0 comments · Fixed by #8

Comments

@raintonr
Copy link
Collaborator

Some cameras post events as multipart messages without XML declaration. Eg (thanks to @BlackandGold1 for the example):

--boundary Content-Disposition: form-data; name="fielddetection" Content-Type: application/xml Content-Length: 1185 <EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema"> <ipAddress>10.11.12.100</ipAddress> <portNo>8089</portNo> <protocol>HTTP</protocol> <macAddress>80:7c:62:76:15:b8</macAddress> <channelID>1</channelID> <dateTime>2022-12-13T10:43:47+01:00</dateTime> <activePostCount>1</activePostCount> <eventType>fielddetection</eventType> <eventState>active</eventState> <eventDescription>fielddetection alarm</eventDescription> <DetectionRegionList> <DetectionRegionEntry> <regionID>3</regionID> <sensitivityLevel>50</sensitivityLevel> <RegionCoordinatesList> <RegionCoordinates> <positionX>671</positionX> <positionY>977</positionY> </RegionCoordinates> <RegionCoordinates> <positionX>489</positionX> <positionY>998</positionY> </RegionCoordinates> <RegionCoordinates> <positionX>485</positionX> <positionY>869</positionY> </RegionCoordinates> <RegionCoordinates> <positionX>690</positionX> <positionY>892</positionY> </RegionCoordinates> </RegionCoordinatesList> </DetectionRegionEntry> </DetectionRegionList> <channelName>IPdome</channelName> <isDataRetransmission>false</isDataRetransmission> </EventNotificationAlert> --boundary--
--boundary Content-Disposition: form-data; name="fielddetection" Content-Type: application/xml Content-Length: 1185 
<EventNotificationAlert version="2.0"
	xmlns="http://www.hikvision.com/ver20/XMLSchema">
	<ipAddress>10.11.12.100</ipAddress>
	<portNo>8089</portNo>
	<protocol>HTTP</protocol>
	<macAddress>80:7c:62:76:15:b8</macAddress>
	<channelID>1</channelID>
	<dateTime>2022-12-13T10:43:47+01:00</dateTime>
	<activePostCount>1</activePostCount>
	<eventType>fielddetection</eventType>
	<eventState>active</eventState>
	<eventDescription>fielddetection alarm</eventDescription>
	<DetectionRegionList>
		<DetectionRegionEntry>
			<regionID>3</regionID>
			<sensitivityLevel>50</sensitivityLevel>
			<RegionCoordinatesList>
				<RegionCoordinates>
					<positionX>671</positionX>
					<positionY>977</positionY>
				</RegionCoordinates>
				<RegionCoordinates>
					<positionX>489</positionX>
					<positionY>998</positionY>
				</RegionCoordinates>
				<RegionCoordinates>
					<positionX>485</positionX>
					<positionY>869</positionY>
				</RegionCoordinates>
				<RegionCoordinates>
					<positionX>690</positionX>
					<positionY>892</positionY>
				</RegionCoordinates>
			</RegionCoordinatesList>
		</DetectionRegionEntry>
	</DetectionRegionList>
	<channelName>IPdome</channelName>
	<isDataRetransmission>false</isDataRetransmission>
</EventNotificationAlert>
--boundary--
@raintonr raintonr linked a pull request Dec 13, 2022 that will close this issue
raintonr added a commit that referenced this issue Dec 13, 2022
…laration

#7 Multipart regexp does not require xml declaration
raintonr added a commit that referenced this issue Dec 13, 2022
Handle multipart message payload ([#5](#5)).
Handle payloads without XML declaration ([#7](#7).)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant