Motion-Project / motion

Motion, a software motion detector. Home page: https://motion-project.github.io/
GNU General Public License v2.0
3.6k stars 544 forks source link

invalid content-type for "current" image #1171

Closed Doomic closed 3 years ago

Doomic commented 4 years ago

i tried to add the current url (static image / snapshot) to domoticz. Somehow domoticz can't display the image. It works when i directly navigate to the url. I tried to put /image.jpg at the end of the url (motion will ignore this) but still domoticz is not getting a valid image. What i saw in my bowser tab is that it is of type "document" and not of type "jpeg". Next i saw that the response header content-type is "image/jpeg;". I guess that is this issue; because it should have been "image/jpeg" (without the [;] character). I am not well known in "C" language. But found: https://github.com/Motion-Project/motion/blob/392779e90bf101eeaebb2f95309963281d55395e/src/webu_stream.c#L328 maybe a typo there? can it be fixed? or is there a reason why it is like that?

tosiara commented 4 years ago

IMO it is "domotics" who needs to fix a bug. Semicolon is a valid char in Content-type as it is used as delimeter between the type and the parameters. For example: Content-type: text/plain;charset=UTF-8 However, I could agree that motion could omit semicolon if it does not provide any parmeters following the type

Doomic commented 4 years ago

Thanks for the response. Maybe you are right.. however W3 specify it as Content-Type := type "/" subtype *[";" parameter] https://www.w3.org/Protocols/rfc1341/4_Content-Type.html So i think the semicolon should only be there if you have params specified. But i am not completly sure about this.

And i am not sure as well if this is the reason why it does not work ik Domoticz. Maybe there is something else going wrong in Domoticz.

However because Google Chrome browser is not saying it is an image type as well (in the dev tools network tab). I guess it is not the format as it should be. And i can't think of a reason why Motion should not change it to the more common format (without semicolon).

Thanks in advange

tosiara commented 3 years ago

PR created