[Live-devel] Range header parsing

Ross Finlayson finlayson at live555.com
Thu Aug 17 05:04:21 PDT 2006


>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?

Yes, because it *allows*, but does not *require*, white space to be 
present in the input.

Note the following, from "man sscanf()":
    "White space (such as
      blanks, tabs, or newlines) in the format string match any amount of white
      space, including none, in the input."

>   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.

However, because of the way that "scanf()" works, these should be 
parsed OK by the existing code.
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20060817/9057fb9a/attachment.html 


More information about the live-devel mailing list