gst/typefind/gsttypefindfunctions.c: Better detection for multipart/x-mixed-replace: accept leading whitespaces befor...

Original commit message from CVS:
Patch by: Sjoerd Simons  <sjoerd at luon net>
* 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).
This commit is contained in:
Sjoerd Simons 2006-08-08 08:41:13 +00:00 committed by Tim-Philipp Müller
parent 33e0a62c5c
commit 99a8910d4f
2 changed files with 19 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2006-08-08 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Sjoerd Simons <sjoerd at luon net>
* 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 <tim at centricular dot net>
Patch by: Young-Ho Cha <ganadist at chollian net>

View file

@ -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:
* --<some ascii chars>[\r]\n
* <maybe some whitespace>--<some ascii chars>[\r]\n
* <more ascii chars>[\r]\nContent-type:<more ascii>[\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 */