NAME

Hypersonic::Protocol::HTTP1 - JIT code generation for HTTP/1.1 protocol

SYNOPSIS

use Hypersonic::Protocol::HTTP1;

# Build a complete response at compile time
my $response = Hypersonic::Protocol::HTTP1->build_response(
    status  => 200,
    headers => { 'X-Custom' => 'value' },
    body    => '{"ok":true}',
);

# Generate C code for method parsing
Hypersonic::Protocol::HTTP1->gen_method_parser($builder, $analysis);

DESCRIPTION

This module provides JIT compile-time code generation for HTTP/1.1 protocol handling. All methods either return pre-built strings or generate C code using XS::JIT::Builder. There is zero runtime overhead.

HTTP/1.1 Specifics

  • Text-based request format: GET /path HTTP/1.1\r\n

  • CRLF delimiters: \r\n between headers, \r\n\r\n before body

  • Keep-alive: Default in HTTP/1.1, detected via Connection: close

  • Response format: Status line + headers + body

METHODS

build_response(%args)

Build a complete HTTP/1.1 response string at compile time.

gen_method_parser($builder, $analysis)

Generate C code for parsing HTTP method using XS::JIT::Builder.

gen_path_parser($builder)

Generate C code for parsing request path.

gen_body_parser($builder, %opts)

Generate C code for finding request body.

gen_keepalive_check($builder)

Generate C code for detecting Connection: close.

AUTHOR

Hypersonic Contributors