public function getHTTPUpdateRange(RequestInterface $request)
    {
        $range = $request->getHeader('X-Update-Range');
        if (is_null($range)) {
            return null;
        }

        // Matching "Range: bytes=1234-5678: both numbers are optional

        if (!preg_match('/^(append)|(?:bytes=([0-9]+)-([0-9]*))|(?:bytes=(-[0-9]+))$/i', $range, $matches)) {
            return null;
        }

        if ('append' === $matches[1]) {
            return [self::RANGE_APPEND];
        } elseif (strlen($matches[2]) > 0) {
            return [self::RANGE_START, (int) $matches[2], (int) $matches[3] ?: null];
        } else {
            return [self::RANGE_END, (int) $matches[4]];
        }
    }