Bug 143512

Summary: Accept-Ranges parsing
Product: WebKit Reporter: Mark Nottingham <mnot>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: rcombs
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Mark Nottingham 2015-04-07 21:54:24 PDT
In /WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp StreamingClient::handleResponseReceived(), the HTTP Accept-Ranges header is parsed like this:


"""
    priv->seekable = length > 0 && g_ascii_strcasecmp("none", response.httpHeaderField(HTTPHeaderName::AcceptRanges).utf8().data()
"""

This means that if the string "none" 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.

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)
Comment 1 Ridley Combs 2015-04-08 06:27:26 PDT
Correction: the current implementation matches only if the header value is exactly "none", which means it'd be error-prone if the server reported some range unit other than "bytes" (the one WebKit actually supports).
Comment 2 Ridley Combs 2018-08-07 16:01:19 PDT
Ping; noticed that Firefox fixed a similar bug earlier today.