RRangeTallow
Product

Product features · Single HTTP byte ranges

01

Inspect byte_range.py so the returned inclusive interval reflects the available resource rather than an assumed HTTP response.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Single HTTP byte ranges

● ● ●RangeTallow●
A concrete starting point · Single HTTP byte ranges ×
import re

def byte_range(header, size):
    if type(header) is not str or len(header) > 80 or type(size) is not int or not 0 <= size <= 10**12:
        raise ValueError("range.input")
    match = re.fullmatch(r"bytes=([0-9]*)-([0-9]*)", header)
    if match is None or not any(match.groups()):
        raise ValueError("range.syntax")
    left, right = match.groups()
    if not left:
        suffix = int(right)
        if suffix == 0 or size == 0:
            return None
        return max(0, size-suffix), size-1
    start = int(left)
    end = int(right) if right else size-1
    if start >= size or end < start:
        return None
    return start, min(end, size-1)
✳Single HTTP byte ranges
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗