From 30fd219e6367d413eb22961ad9a94ca74d286e8e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 29 Jan 2010 16:34:44 +0100 Subject: [PATCH] rtsp: ignore \n and \r as the first line Be more forgiving for bad servers and ignore \r and \n when we are looking for the response/request line. See #608417 --- gst-libs/gst/rtsp/gstrtspconnection.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index 3548beb9f2..813eefdd33 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -1834,22 +1834,31 @@ build_next (GstRTSPBuilder * builder, GstRTSPMessage * message, while (TRUE) { switch (builder->state) { case STATE_START: + { + guint8 c; + builder->offset = 0; res = read_bytes (conn, (guint8 *) builder->buffer, &builder->offset, 1); if (res != GST_RTSP_OK) goto done; + c = builder->buffer[0]; + /* we have 1 bytes now and we can see if this is a data message or * not */ - if (builder->buffer[0] == '$') { + if (c == '$') { /* data message, prepare for the header */ builder->state = STATE_DATA_HEADER; + } else if (c == '\n' || c == '\r') { + /* skip \n and \r */ + builder->offset = 0; } else { builder->line = 0; builder->state = STATE_READ_LINES; } break; + } case STATE_DATA_HEADER: { res =