← LeaderboardThe Skill Leaderboard

http-range-response-testing

Verify HTTP byte-range server behavior on deterministic loopback routes across 206 Partial Content, Content-Range, 416, If-Range validators, suffix/open ranges, and multi-range.

Published by sickn33 ↗sickn33/agentic-awesome-skills

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: http-range-response-testingdescription: "Verify HTTP byte-range server behavior on deterministic loopback routes across 206 Partial Content, Content-Range, 416, If-Range validators, suffix/open ranges, and multi-range."category: developmentrisk: safesource: selfsource_type: selfdate_added: "2026-12-01"author: Koushik-Katkamtags: [http, rfc9110, range-requests, partial-content, testing, api]

HTTP Range Response Testing

Overview

Run deterministic loopback HTTP tests grounded in RFC 9110 (HTTP Semantics, Sections 13.1.5 & 14) for endpoints that explicitly promise byte-range support (Accept-Ranges: bytes). Verifies exact response bytes, inclusive boundaries, open-ended and suffix ranges, 206 Partial Content + Content-Range, 416 Range Not Satisfiable, matching vs. stale If-Range, 200 OK fallback semantics, Content-Length consistency, and optional multipart/byteranges support.

Distinction from existing skills:

  • weather-model-data-fetching: covers client-side GRIB2 .idx range fetching from AWS S3/NOMADS (Range: bytes=START-END, expecting 206 without multipart) rather than auditing an HTTP server's RFC 9110 server-side range handler.
  • http-status-code-tester: checks general URL status codes/redirects for SEO auditing without byte-range boundary, Content-Range, or If-Range verification.
  • api-contract-testing: focuses on consumer-provider schema contracts rather than RFC 9110 partial-content byte framing.

When to Use

  • Testing custom file-streaming, CDN-proxy, artifact, or media API routes that advertise Accept-Ranges: bytes.
  • Reproducing partial-download corruption caused by off-by-one byte slices, mismatched Content-Length, stale If-Range returning 206, or broken 416 responses.
  • Distinguishing RFC 9110-permitted behavior (for example, ignoring Range and returning 200 OK when a server chooses not to serve partial responses) from route-contract violations when an endpoint explicitly promises 206 byte-range support.
  • Do not use this skill against external third-party URLs or production endpoints without explicit authorization.

Prerequisites

  • Python 3.10+ with pytest (tested with Python 3.12.10 stdlib http.server / http.client and pytest==9.1.1).
  • No external HTTP clients or live network endpoints required; tests bind strictly to 127.0.0.1:0 with bounded timeouts and deterministic cleanup.

How It Works

1. Distinguish RFC-permitted behavior from route promises

  • Under RFC 9110 §14.2, a general origin server is allowed to ignore Range and send 200 OK with the full representation; Accept-Ranges: bytes indicates advertised support rather than an irrevocable guarantee that every subsequent Range request will return 206.
  • Similarly, RFC 9110 §15.5.17 / §14.4 classifies returning Content-Range: bytes */<complete-length> on a 416 Range Not Satisfiable byte-range response as SHOULD, not MUST.
  • This harness enforces explicit application-contract assertions for partial-content routes (requiring 206 on single satisfiable ranges unless triggered by stale/weak If-Range, and requiring Content-Range: bytes */<complete-length> on 416) while separating RFC MUST correctness bugs (off_by_one, stale_if_range_206, bad_content_length, missing_content_range on 206) from route-contract policy checks.

2. Exercise bounded loopback fixtures

Run the local suite in HTTP range loopback harness:

  1. Exact slices & inclusive boundaries: bytes=0-4 returns 206, Content-Range: bytes 0-4/32, Content-Length: 5, and exact 5 bytes (payload[0:5]); single-byte bytes=7-7 returns 1 byte (bytes 7-7/32).
  2. Open-ended & suffix ranges: bytes=20- returns bytes 20-31/32 (12 bytes); bytes=-6 returns the trailing 6 bytes (bytes 26-31/32); oversized suffix bytes=-999 clamps to bytes 0-31/32.
  3. Unsatisfiable ranges (416): bytes=99-120 on a 32-byte payload returns 416, Content-Range: bytes */32, and empty body; malformed syntactic ranges (bytes=10-5 or unsupported units items=0-2) do not return 206.
  4. Conditional If-Range (RFC 9110 §13.1.5): Matching ETag returns 206 slice; stale/mismatched ETag forces 200 OK full representation with no Content-Range.
  5. Multiple ranges (multipart/byteranges): On routes declaring multi-range support, Range: bytes=0-3, 10-12 returns 206, Content-Type: multipart/byteranges; boundary=..., valid part Content-Range headers, exact byte slices, and consistent outer Content-Length.
  6. Non-vacuous negative mutations: Verify intentional bugs (off_by_one, stale_if_range_206, wrong_416_status, bad_content_length) fail loudly.

Examples

Run the self-contained verification suite in HTTP range loopback harness:

User request: "Test our artifact download endpoint for RFC 9110 Range, If-Range, and 416 correctness."
Inputs: Loopback HTTP route fixture (127.0.0.1:0, 32-byte payload, ETag '"v1-payload"').
Expected result: All inclusive, open-ended, suffix, If-Range (match=206, stale=200), 416, fallback,
  and multipart/byteranges assertions pass; broken server mutations (off-by-one, bad Content-Length,
  stale If-Range 206, missing 416 Content-Range) fail with concrete diagnostic errors.

Limitations

  • Tests local loopback fixtures over HTTP/1.1 (http.client.HTTPConnection); reverse proxies, CDNs, HTTP/2 frame reassembly, and TLS termination can rewrite or strip Range/If-Range headers in production.
  • The included loopback server's _parse_range_header helper is a limited synthetic test-fixture parser (not a full RFC 9110 production parser; it omits optional whitespace variations, overlapping-range coalescing, and HTTP-date If-Range validators).
  • If-Range HTTP-date validator parsing is omitted; only strong quoted ETag matching and weak ETag (W/"..." -> 200 OK fallback per RFC 9110 §13.1.5) are tested.
  • Non-2xx error behavior for empty (0-byte) files is reported as unsatisfiable (416 bytes */0) for byte-ranges and assumes static representation length.

Safety and Side Effects

  • Strictly loopback-only (127.0.0.1:0) using ephemeral OS-assigned ports and in-memory byte payloads with bounded 2.0s socket timeouts and deterministic server.shutdown() + server.server_close() cleanup.
  • Never sends requests to external domains or modifies files on disk.

Sources and related skills