Closed Bug 1152162 Opened 5 years ago Closed Last year
MediaResource.cpp do_QueryInterface() parses the HTTP Accept-Ranges header like this: nsAutoCString ranges; hc->GetResponseHeader(NS_LITERAL_CSTRING("Accept-Ranges"), ranges); bool acceptsRanges = ranges.EqualsLiteral("bytes"); This means that if the string "bytes" shows up in the header at all, it will match -- making it error-prone if a range using that sequence of characters is ever defined (e.g., "newbytes" as recently proposed on the HTTP WG mailing list). The syntax isn't difficult to parse, it's a comma-separated list of tokens with optional whitespace (the same as several other headers): http://httpwg.github.io/specs/rfc7233.html#header.accept-ranges (found by Rodger Combs on the IETF HTTP WG mailing list)
Correction: the existing implementation would only match if the header value is exactly "bytes", so it'd be error-prone if the server listed multiple range units including "bytes".
Component: DOM: Device Interfaces → Audio/Video
Hi Kershaw, Would you take a look at this bug? Thanks!
Priority: -- → P3
Summary: Simply use nsHttp::FindToken to parse Accept-Ranges header. Thanks.
Assignee: nobody → kershaw
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8998157 - Flags: review?(valentin.gosu)
Attachment #8998157 - Flags: review?(valentin.gosu) → review+
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/5472b2d8b9a0 Correct parsing Accept-Range header, r=valentin
You need to log in before you can comment on or make changes to this bug.