[Live-devel] Range header parsing

Rob Casey rob.casey at swishgroup.com.au
Thu Aug 17 03:07:49 PDT 2006


Ross,

I would note that within the parseRangeHeader function (in the file liveMedia/RTSPServer.cpp), the Range header is parsed expecting spaces to be present between the elements of the NPT specification.  See below:

    590   float start, end;
    591   if (sscanf(fields, "npt = %f - %f", &start, &end) == 2) {
    592     rangeStart = start;
    593     rangeEnd = end;
    594   } else if (sscanf(fields, "npt = %f -", &start) == 1) {
    595     rangeStart = start;
    596   } else {
    597     return False; // The header is malformed
    598   }

Is there a reason for the parsing of NPT information in this manner?  The specification of NPT within RFC2326 does not appear to include spaces between NPT elements.  And I would additionally note that even when Range headers are returned by the liveMedia library, these do not include spaces between NPT elements.

As such I would propose the following amendment of this code (which maintains operability with existing code which may depend upon this specification of NPT information):

    590   float start, end;
    591   if (sscanf(fields, "npt = %f - %f", &start, &end) == 2 ||
    592       sscanf(fields, "npt=%f-%f", &start, &end) == 2) {
    593     rangeStart = start;
    594     rangeEnd = end;
    595   } else if (sscanf(fields, "npt = %f -", &start) == 1 ||
    596              sscanf(fields, "npt=%f-", &start) == 1) {
    597     rangeStart = start;
    598   } else {
    599     return False; // The header is malformed
    600   }

Regards,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20060817/7b9dd485/attachment.html 


More information about the live-devel mailing list