mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
rtsp: Normalize lines (remove extra whitespace) before parsing.
This commit is contained in:
parent
5716cd102a
commit
11c8b811f3
1 changed files with 20 additions and 0 deletions
|
@ -1706,6 +1706,25 @@ parse_error:
|
|||
}
|
||||
}
|
||||
|
||||
/* convert all consecutive whitespace to a single space */
|
||||
static void
|
||||
normalize_line (guint8 * buffer)
|
||||
{
|
||||
while (*buffer) {
|
||||
if (g_ascii_isspace (*buffer)) {
|
||||
guint8 *tmp;
|
||||
|
||||
*buffer++ = ' ';
|
||||
for (tmp = buffer; g_ascii_isspace (*tmp); tmp++) {
|
||||
}
|
||||
if (buffer != tmp)
|
||||
memmove (buffer, tmp, strlen ((gchar *) tmp) + 1);
|
||||
} else {
|
||||
buffer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* returns:
|
||||
* GST_RTSP_OK when a complete message was read.
|
||||
* GST_RTSP_EEOF: when the socket is closed
|
||||
|
@ -1803,6 +1822,7 @@ build_next (GstRTSPBuilder * builder, GstRTSPMessage * message,
|
|||
}
|
||||
|
||||
/* we have a line */
|
||||
normalize_line (builder->buffer);
|
||||
if (builder->line == 0) {
|
||||
/* first line, check for response status */
|
||||
if (memcmp (builder->buffer, "RTSP", 4) == 0 ||
|
||||
|
|
Loading…
Reference in a new issue