HHeaderAnvil
Product

Product features · ASCII HTTP header boundaries

01

Reject invalid name characters, line breaks, controls and non-ASCII input, allowing an empty value without creating an extra header.

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.

ASCII HTTP header boundaries

● ● ●HeaderAnvil●
A concrete starting point · ASCII HTTP header boundaries ×
import re
TOKEN = re.compile(r"[!#$%&'*+.^_`|~0-9A-Za-z-]+")
def header_line(name, value):
    if not isinstance(name, str) or not TOKEN.fullmatch(name):
        raise ValueError("header name")
    if not isinstance(value, str) or any(not 32 <= ord(c) <= 126 for c in value):
        raise ValueError("ASCII header value")
    return name + ": " + value
✳Format an ASCII HTTP header from a name and value.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗