OpenHAP::HTTP(3p) Perl Library Manual OpenHAP::HTTP(3p)

OpenHAP::HTTP - HTTP/1.1 parser for HAP protocol

    use OpenHAP::HTTP;
    # Parse HTTP request
    my $request = OpenHAP::HTTP::parse($data);
    print $request->{method}, " ", $request->{path}, "\n";
    # Build HTTP response
    my $response = OpenHAP::HTTP::build_response(
        status => 200,
        headers => { 'Content-Type' => 'application/hap+json' },
        body => $json_data,
    );

This module implements a simple HTTP/1.1 parser and response builder for the HomeKit Accessory Protocol.

Parses HTTP request data and returns a hashref with: - method: HTTP method (GET, POST, PUT) - path: Request path - version: HTTP version - headers: Hash of headers (lowercase keys) - body: Request body

Builds an HTTP response. Arguments: - status: HTTP status code (default: 200) - status_text: Status text (auto-generated if not provided) - headers: Hashref of headers - body: Response body

spec/HAP-HTTP.md

2026-07-27 OpenBSD