From f104fd55517c49eaf29e54453d91204478961363 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Sat, 30 Oct 2021 08:49:07 +0000 Subject: [PATCH] Fix: Allow Content-type: with parameters (such as codecs, or charset) See: #1902 --- src/format.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/format.c b/src/format.c index 06e656c1..c3c84ab7 100644 --- a/src/format.c +++ b/src/format.c @@ -54,6 +54,15 @@ static int format_prepare_headers (source_t *source, client_t *client); format_type_t format_get_type (const char *contenttype) { + char buf[32]; + const char *separator = strpbrk(contenttype, "; \t"); + + if (separator && (size_t)(separator - contenttype) < sizeof(buf)) { + memcpy(buf, contenttype, separator - contenttype); + buf[separator - contenttype] = 0; + contenttype = buf; + } + if(strcmp(contenttype, "application/x-ogg") == 0) return FORMAT_TYPE_OGG; /* Backwards compatibility */ else if(strcmp(contenttype, "application/ogg") == 0)