From: Sjoerd Simons Date: Tue, 8 Aug 2006 08:41:13 +0000 (+0000) Subject: gst/typefind/gsttypefindfunctions.c: Better detection for multipart/x-mixed-replace... X-Git-Tag: 1.19.3~511^2~11699 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99a8910d4ff6199f05026652c90386978ce0fad0;p=platform%2Fupstream%2Fgstreamer.git gst/typefind/gsttypefindfunctions.c: Better detection for multipart/x-mixed-replace: accept leading whitespaces befor... Original commit message from CVS: Patch by: Sjoerd Simons * gst/typefind/gsttypefindfunctions.c: (multipart_type_find): Better detection for multipart/x-mixed-replace: accept leading whitespaces before the boundary marker as well (as our very own multipartmux used to produce) (#349068). --- diff --git a/ChangeLog b/ChangeLog index 4ed6cdfabc..1cadba02c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-08-08 Tim-Philipp Müller + + Patch by: Sjoerd Simons + + * gst/typefind/gsttypefindfunctions.c: (multipart_type_find): + Better detection for multipart/x-mixed-replace: accept leading + whitespaces before the boundary marker as well (as our very own + multipartmux used to produce) (#349068). + 2006-08-07 Tim-Philipp Müller Patch by: Young-Ho Cha diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index fa68f855dc..157df08544 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -934,7 +934,7 @@ GST_STATIC_CAPS ("multipart/x-mixed-replace"); #define MULTIPART_CAPS gst_static_caps_get(&multipart_caps) /* multipart/x-mixed replace is: - * --[\r]\n + * --[\r]\n * [\r]\nContent-type:[\r]\n */ static void multipart_type_find (GstTypeFind * tf, gpointer unused) @@ -942,8 +942,15 @@ multipart_type_find (GstTypeFind * tf, gpointer unused) guint8 *data; guint8 *x; - data = gst_type_find_peek (tf, 0, 2); - if (!data || data[0] != '-' || data[1] != '-') +#define MULTIPART_MAX_BOUNDARY_OFFSET 16 + data = gst_type_find_peek (tf, 0, MULTIPART_MAX_BOUNDARY_OFFSET); + if (!data) + return; + + for (x = data; + x - data < MULTIPART_MAX_BOUNDARY_OFFSET - 2 && g_ascii_isspace (*x); + x++); + if (x[0] != '-' || x[1] != '-') return; /* Could be okay, peek what should be enough for a complete header */