[Live-devel] RTSPClient does not accept folded headers

Paul Clark paul at packetship.com
Fri Nov 14 06:21:54 PST 2008


Hi,

It seems that the RTSPClient doesn't accept folded headers from the 
server, at least for OPTIONS responses and possibly other requests as 
well.  The relevant code is around RTSPClient.cpp:586:

    // Look for a "Public:" header (which will contain our result str):
    char* lineStart;
    while (1) {
      lineStart = nextLineStart;
      if (lineStart == NULL) break;

      nextLineStart = getLine(lineStart);

      if (_strncasecmp(lineStart, "Public: ", 8) == 0) {
    delete[] result; result = strDup(&lineStart[8]);
#ifdef SUPPORT_REAL_RTSP
      } else if (_strncasecmp(lineStart, "RealChallenge1: ", 16) == 0) {
    delete[] fRealChallengeStr; fRealChallengeStr = strDup(&lineStart[16]);
#endif
      }
    }

This just looks for a line beginning "Public: " without worrying whether 
a subsequent line is a header fold beginning with whitespace.  This is 
allowed in the RFC 2326 grammar (check out token 'LWS'), which it 
inherits from HTTP and SMTP.

We've tripped over this because VLC now uses the present of 
GET_PARAMETER in the OPTIONS response to determine whether to send 
GET_PARAMETER 'keepalives', which our server requires.  The OPTIONS 
request/response is as follows:

---
Sending request: OPTIONS rtsp://barque/testcard RTSP/1.0
CSeq: 29
User-Agent: VLC media player (LIVE555 Streaming Media v2008.07.24)

Received OPTIONS response: RTSP/1.0 200 OK
CSeq: 29
Server: Packet Ship RTSP Server v2.3.0
Date: Fri, Nov 14 2008 14:11:35 GMT
Public: OPTIONS, DESCRIBE, SETUP, PLAY, PAUSE, TEARDOWN,
  GET_PARAMETER, SET_PARAMETER
---

Because the GET_PARAMETER has been (correctly) folded to the next line, 
it isn't picked up by VLC and hence no keepalive is sent.

We can (and have) worked round this by putting GET_PARAMETER at the 
front of the OPTIONS list, but I thought I should point this out as a 
protocol issue in the library.

Many thanks

Paul
--
Paul Clark
Packet Ship Technologies Limited
http://www.packetship.com



More information about the live-devel mailing list