I came across a dlink camera who's content type is multipart/x-mixed-replace;boundary=video boundary--
This fails to parse as the -- is not valid unless its in quotes.
Thus we need a way to sanitize the header to get `multipart/x-mixed-replace;boundary="video boundary--" (quotes added)
The following might be sufficient
func SanitizeContentType(s string) string {
if strings.HasSuffix(s, "-") {
// Boundary is not escaped
segments:= strings.Split(s, "boundary=")
formatted := segments[0] + "boundary=\"" + segments[1] + "\""
return formatted
}
return s
}
I came across a dlink camera who's content type is
multipart/x-mixed-replace;boundary=video boundary--
This fails to parse as the
--
is not valid unless its in quotes. Thus we need a way to sanitize the header to get`multipart/x-mixed-replace;boundary="video boundary--"
(quotes added)The following might be sufficient