Bug 143512 - Accept-Ranges parsing
Summary: Accept-Ranges parsing
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-07 21:54 PDT by Mark Nottingham
Modified: 2018-08-07 16:01 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 Rodger 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 Rodger Combs 2018-08-07 16:01:19 PDT
Ping; noticed that Firefox fixed a similar bug earlier today.